diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..1d8cdf80 --- /dev/null +++ b/.clang-format @@ -0,0 +1,23 @@ +# Use the Google style in this project. +BasedOnStyle: Google + +# Some folks prefer to write "int& foo" while others prefer "int &foo". The +# Google Style Guide only asks for consistency within a project, we chose +# "int& foo" for this project: +DerivePointerAlignment: false +PointerAlignment: Left + +# Rules for includes +# IncludeBlocks: IBS_Regroup # Requires clang-format 6.0+ +# Ordering of includes, higher priority lower in list +IncludeCategories: +- Regex: '^\"unit/' + Priority: 5999 +- Regex: '^\"' + Priority: 4000 +- Regex: '^<.*/.*' + Priority: 2000 +- Regex: '^<[^\/.]*>' + Priority: 1000 +- Regex: '^<.*.h>' + Priority: 500 diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..bf4629cb --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,42 @@ +--- +# Configure clang-tidy for this project. + +# Disabled: +# -clang-analyzer-cplusplus due to errors with the stl +# -google-readability-namespace-comments due to c++17 one line multinamespace +# -bugprone-suspicius-include does not support clang-tidy build styles +# -bugprone-easily-swappable-parameters often disallows simple functions +# -readability-function-cognitive-complexity disallows large functions +# -readability-identifier-length allows short variable names +# To be corrected: +Checks: '-*, bugprone-*, clang-*, google-readability-*, misc-*, modernize-*, readability-*, performance-*, -clang-analyzer-cplusplus*, -google-readability-namespace-comments, -bugprone-easily-swappable-parameters, -bugprone-suspicious-include, -readability-function-cognitive-complexity, -readability-identifier-length, -modernize-use-trailing-return-type' +# Most warnings should be errors +WarningsAsErrors: 'bugprone-*, clang-*, google-*, misc-*, modernize-*, readability-*, performance-*' +# Overall format style, Google Style Guide w/ extra restrictions +FormatStyle: file +CheckOptions: + - { key: readability-identifier-naming.ClassCase, value: CamelCase } + - { key: readability-identifier-naming.StructCase, value: CamelCase } + - { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase } + - { key: readability-identifier-naming.FunctionCase, value: CamelCase } + - { key: readability-identifier-naming.NamespaceCase, value: lower_case } + - { key: readability-identifier-naming.VariableCase, value: lower_case } + - { key: readability-identifier-naming.LocalConstantCase, value: lower_case } + - { key: readability-identifier-naming.LocalConstantCase, value: lower_case } + - { key: readability-identifier-naming.GlobalVariableCase, value: lower_case } + - { key: readability-identifier-naming.GlobalVariableSuffix, value: _ } + - { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase } + - { key: readability-identifier-naming.GlobalConstantPrefix, value: k } + - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ } + - { key: readability-identifier-naming.PrivateMemberCase, value: lower_case } + - { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ } + - { key: readability-identifier-naming.ProtectedMemberCase, value: lower_case } + - { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase } + - { key: readability-identifier-naming.ConstexprVariablePrefix, value: k } + - { key: readability-identifier-naming.EnumConstantCase, value: CamelCase } + - { key: readability-identifier-naming.EnumConstantPrefix, value: k } + - { key: readability-identifier-naming.MemberConstantCase, value: CamelCase } + - { key: readability-identifier-naming.MemberConstantPrefix, value: k } + - { key: readability-identifier-naming.StaticConstantCase, value: CamelCase } + - { key: readability-identifier-naming.StaticConstantPrefix, value: k } + - { key: readability-function-cognitive-complexity.Threshold, value: 35 } diff --git a/.gitignore b/.gitignore index 0cbac471..c2f63e85 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ CMakeFiles cmake_install.cmake CPackConfig.cmake CPackSourceConfig.cmake - +.cache diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d14fc46..0657bd15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.22) project(OpenDIS VERSION 1.0.1) # Build options @@ -7,10 +7,12 @@ option(BUILD_EXAMPLES "build example sender/receiver applications" OFF) option(BUILD_TESTS "build unit tests" OFF) # Enforce a C++11 compliant compiler -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + # include GNUInstallDirs Module to get more generic directory handling include(GNUInstallDirs) @@ -19,9 +21,14 @@ add_library(OpenDIS6 "") # Add src/ to the include directories to OpenDIS6 target_include_directories(OpenDIS6 - PUBLIC $ - $ - $) + PUBLIC $ + $ +) +target_include_directories(OpenDIS6 SYSTEM + PUBLIC $ + $ + PRIVATE $ +) # Define OpenDIS7 Library add_library(OpenDIS7 "") diff --git a/src/dis6/AcknowledgePdu.cpp b/src/dis6/AcknowledgePdu.cpp deleted file mode 100644 index e3bb87e2..00000000 --- a/src/dis6/AcknowledgePdu.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include - -using namespace DIS; - - -AcknowledgePdu::AcknowledgePdu() : SimulationManagementFamilyPdu(), - _acknowledgeFlag(0), - _responseFlag(0), - _requestID(0) -{ - setPduType( 15 ); -} - -AcknowledgePdu::~AcknowledgePdu() -{ -} - -unsigned short AcknowledgePdu::getAcknowledgeFlag() const -{ - return _acknowledgeFlag; -} - -void AcknowledgePdu::setAcknowledgeFlag(unsigned short pX) -{ - _acknowledgeFlag = pX; -} - -unsigned short AcknowledgePdu::getResponseFlag() const -{ - return _responseFlag; -} - -void AcknowledgePdu::setResponseFlag(unsigned short pX) -{ - _responseFlag = pX; -} - -unsigned int AcknowledgePdu::getRequestID() const -{ - return _requestID; -} - -void AcknowledgePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void AcknowledgePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _acknowledgeFlag; - dataStream << _responseFlag; - dataStream << _requestID; -} - -void AcknowledgePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _acknowledgeFlag; - dataStream >> _responseFlag; - dataStream >> _requestID; -} - - -bool AcknowledgePdu::operator ==(const AcknowledgePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_acknowledgeFlag == rhs._acknowledgeFlag) ) ivarsEqual = false; - if( ! (_responseFlag == rhs._responseFlag) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcknowledgePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _acknowledgeFlag - marshalSize = marshalSize + 2; // _responseFlag - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcknowledgePdu.h b/src/dis6/AcknowledgePdu.h deleted file mode 100644 index 449dbbff..00000000 --- a/src/dis6/AcknowledgePdu.h +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.5. Acknowledge the receiptof a start/resume, stop/freeze, or RemoveEntityPDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AcknowledgePdu : public SimulationManagementFamilyPdu -{ -protected: - /** type of message being acknowledged */ - unsigned short _acknowledgeFlag; - - /** Whether or not the receiving entity was able to comply with the request */ - unsigned short _responseFlag; - - /** Request ID that is unique */ - unsigned int _requestID; - - - public: - AcknowledgePdu(); - virtual ~AcknowledgePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getAcknowledgeFlag() const; - void setAcknowledgeFlag(unsigned short pX); - - unsigned short getResponseFlag() const; - void setResponseFlag(unsigned short pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcknowledgePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcknowledgeReliablePdu.cpp b/src/dis6/AcknowledgeReliablePdu.cpp deleted file mode 100644 index 2eb27c63..00000000 --- a/src/dis6/AcknowledgeReliablePdu.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include - -using namespace DIS; - - -AcknowledgeReliablePdu::AcknowledgeReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _acknowledgeFlag(0), - _responseFlag(0), - _requestID(0) -{ - setPduType( 55 ); -} - -AcknowledgeReliablePdu::~AcknowledgeReliablePdu() -{ -} - -unsigned short AcknowledgeReliablePdu::getAcknowledgeFlag() const -{ - return _acknowledgeFlag; -} - -void AcknowledgeReliablePdu::setAcknowledgeFlag(unsigned short pX) -{ - _acknowledgeFlag = pX; -} - -unsigned short AcknowledgeReliablePdu::getResponseFlag() const -{ - return _responseFlag; -} - -void AcknowledgeReliablePdu::setResponseFlag(unsigned short pX) -{ - _responseFlag = pX; -} - -unsigned int AcknowledgeReliablePdu::getRequestID() const -{ - return _requestID; -} - -void AcknowledgeReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void AcknowledgeReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _acknowledgeFlag; - dataStream << _responseFlag; - dataStream << _requestID; -} - -void AcknowledgeReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _acknowledgeFlag; - dataStream >> _responseFlag; - dataStream >> _requestID; -} - - -bool AcknowledgeReliablePdu::operator ==(const AcknowledgeReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_acknowledgeFlag == rhs._acknowledgeFlag) ) ivarsEqual = false; - if( ! (_responseFlag == rhs._responseFlag) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcknowledgeReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _acknowledgeFlag - marshalSize = marshalSize + 2; // _responseFlag - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcknowledgeReliablePdu.h b/src/dis6/AcknowledgeReliablePdu.h deleted file mode 100644 index 059e4b62..00000000 --- a/src/dis6/AcknowledgeReliablePdu.h +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.5: Ack receipt of a start-resume, stop-freeze, create-entity or remove enitty (reliable) pdus. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AcknowledgeReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** ack flags */ - unsigned short _acknowledgeFlag; - - /** response flags */ - unsigned short _responseFlag; - - /** Request ID */ - unsigned int _requestID; - - - public: - AcknowledgeReliablePdu(); - virtual ~AcknowledgeReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getAcknowledgeFlag() const; - void setAcknowledgeFlag(unsigned short pX); - - unsigned short getResponseFlag() const; - void setResponseFlag(unsigned short pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcknowledgeReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticBeamData.cpp b/src/dis6/AcousticBeamData.cpp deleted file mode 100644 index 6c13089b..00000000 --- a/src/dis6/AcousticBeamData.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include - -using namespace DIS; - - -AcousticBeamData::AcousticBeamData(): - _beamDataLength(0), - _beamIDNumber(0), - _pad2(0), - _fundamentalDataParameters() -{ -} - -AcousticBeamData::~AcousticBeamData() -{ -} - -unsigned short AcousticBeamData::getBeamDataLength() const -{ - return _beamDataLength; -} - -void AcousticBeamData::setBeamDataLength(unsigned short pX) -{ - _beamDataLength = pX; -} - -unsigned char AcousticBeamData::getBeamIDNumber() const -{ - return _beamIDNumber; -} - -void AcousticBeamData::setBeamIDNumber(unsigned char pX) -{ - _beamIDNumber = pX; -} - -unsigned short AcousticBeamData::getPad2() const -{ - return _pad2; -} - -void AcousticBeamData::setPad2(unsigned short pX) -{ - _pad2 = pX; -} - -AcousticBeamFundamentalParameter& AcousticBeamData::getFundamentalDataParameters() -{ - return _fundamentalDataParameters; -} - -const AcousticBeamFundamentalParameter& AcousticBeamData::getFundamentalDataParameters() const -{ - return _fundamentalDataParameters; -} - -void AcousticBeamData::setFundamentalDataParameters(const AcousticBeamFundamentalParameter &pX) -{ - _fundamentalDataParameters = pX; -} - -void AcousticBeamData::marshal(DataStream& dataStream) const -{ - dataStream << _beamDataLength; - dataStream << _beamIDNumber; - dataStream << _pad2; - _fundamentalDataParameters.marshal(dataStream); -} - -void AcousticBeamData::unmarshal(DataStream& dataStream) -{ - dataStream >> _beamDataLength; - dataStream >> _beamIDNumber; - dataStream >> _pad2; - _fundamentalDataParameters.unmarshal(dataStream); -} - - -bool AcousticBeamData::operator ==(const AcousticBeamData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_beamDataLength == rhs._beamDataLength) ) ivarsEqual = false; - if( ! (_beamIDNumber == rhs._beamIDNumber) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_fundamentalDataParameters == rhs._fundamentalDataParameters) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcousticBeamData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _beamDataLength - marshalSize = marshalSize + 1; // _beamIDNumber - marshalSize = marshalSize + 2; // _pad2 - marshalSize = marshalSize + _fundamentalDataParameters.getMarshalledSize(); // _fundamentalDataParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticBeamData.h b/src/dis6/AcousticBeamData.h deleted file mode 100644 index e5bdf1e4..00000000 --- a/src/dis6/AcousticBeamData.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Used in UA PDU - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AcousticBeamData -{ -protected: - /** beam data length */ - unsigned short _beamDataLength; - - /** beamIDNumber */ - unsigned char _beamIDNumber; - - /** padding */ - unsigned short _pad2; - - /** fundamental data parameters */ - AcousticBeamFundamentalParameter _fundamentalDataParameters; - - - public: - AcousticBeamData(); - virtual ~AcousticBeamData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getBeamDataLength() const; - void setBeamDataLength(unsigned short pX); - - unsigned char getBeamIDNumber() const; - void setBeamIDNumber(unsigned char pX); - - unsigned short getPad2() const; - void setPad2(unsigned short pX); - - AcousticBeamFundamentalParameter& getFundamentalDataParameters(); - const AcousticBeamFundamentalParameter& getFundamentalDataParameters() const; - void setFundamentalDataParameters(const AcousticBeamFundamentalParameter &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcousticBeamData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticBeamFundamentalParameter.cpp b/src/dis6/AcousticBeamFundamentalParameter.cpp deleted file mode 100644 index 334ed36f..00000000 --- a/src/dis6/AcousticBeamFundamentalParameter.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -AcousticBeamFundamentalParameter::AcousticBeamFundamentalParameter(): - _activeEmissionParameterIndex(0), - _scanPattern(0), - _beamCenterAzimuth(0.0), - _azimuthalBeamwidth(0.0), - _beamCenterDE(0.0), - _deBeamwidth(0.0) -{ -} - -AcousticBeamFundamentalParameter::~AcousticBeamFundamentalParameter() -{ -} - -unsigned short AcousticBeamFundamentalParameter::getActiveEmissionParameterIndex() const -{ - return _activeEmissionParameterIndex; -} - -void AcousticBeamFundamentalParameter::setActiveEmissionParameterIndex(unsigned short pX) -{ - _activeEmissionParameterIndex = pX; -} - -unsigned short AcousticBeamFundamentalParameter::getScanPattern() const -{ - return _scanPattern; -} - -void AcousticBeamFundamentalParameter::setScanPattern(unsigned short pX) -{ - _scanPattern = pX; -} - -float AcousticBeamFundamentalParameter::getBeamCenterAzimuth() const -{ - return _beamCenterAzimuth; -} - -void AcousticBeamFundamentalParameter::setBeamCenterAzimuth(float pX) -{ - _beamCenterAzimuth = pX; -} - -float AcousticBeamFundamentalParameter::getAzimuthalBeamwidth() const -{ - return _azimuthalBeamwidth; -} - -void AcousticBeamFundamentalParameter::setAzimuthalBeamwidth(float pX) -{ - _azimuthalBeamwidth = pX; -} - -float AcousticBeamFundamentalParameter::getBeamCenterDE() const -{ - return _beamCenterDE; -} - -void AcousticBeamFundamentalParameter::setBeamCenterDE(float pX) -{ - _beamCenterDE = pX; -} - -float AcousticBeamFundamentalParameter::getDeBeamwidth() const -{ - return _deBeamwidth; -} - -void AcousticBeamFundamentalParameter::setDeBeamwidth(float pX) -{ - _deBeamwidth = pX; -} - -void AcousticBeamFundamentalParameter::marshal(DataStream& dataStream) const -{ - dataStream << _activeEmissionParameterIndex; - dataStream << _scanPattern; - dataStream << _beamCenterAzimuth; - dataStream << _azimuthalBeamwidth; - dataStream << _beamCenterDE; - dataStream << _deBeamwidth; -} - -void AcousticBeamFundamentalParameter::unmarshal(DataStream& dataStream) -{ - dataStream >> _activeEmissionParameterIndex; - dataStream >> _scanPattern; - dataStream >> _beamCenterAzimuth; - dataStream >> _azimuthalBeamwidth; - dataStream >> _beamCenterDE; - dataStream >> _deBeamwidth; -} - - -bool AcousticBeamFundamentalParameter::operator ==(const AcousticBeamFundamentalParameter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_activeEmissionParameterIndex == rhs._activeEmissionParameterIndex) ) ivarsEqual = false; - if( ! (_scanPattern == rhs._scanPattern) ) ivarsEqual = false; - if( ! (_beamCenterAzimuth == rhs._beamCenterAzimuth) ) ivarsEqual = false; - if( ! (_azimuthalBeamwidth == rhs._azimuthalBeamwidth) ) ivarsEqual = false; - if( ! (_beamCenterDE == rhs._beamCenterDE) ) ivarsEqual = false; - if( ! (_deBeamwidth == rhs._deBeamwidth) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcousticBeamFundamentalParameter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _activeEmissionParameterIndex - marshalSize = marshalSize + 2; // _scanPattern - marshalSize = marshalSize + 4; // _beamCenterAzimuth - marshalSize = marshalSize + 4; // _azimuthalBeamwidth - marshalSize = marshalSize + 4; // _beamCenterDE - marshalSize = marshalSize + 4; // _deBeamwidth - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticBeamFundamentalParameter.h b/src/dis6/AcousticBeamFundamentalParameter.h deleted file mode 100644 index b1e7f8e6..00000000 --- a/src/dis6/AcousticBeamFundamentalParameter.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Used in UaPdu - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AcousticBeamFundamentalParameter -{ -protected: - /** parameter index */ - unsigned short _activeEmissionParameterIndex; - - /** scan pattern */ - unsigned short _scanPattern; - - /** beam center azimuth */ - float _beamCenterAzimuth; - - /** azimuthal beamwidth */ - float _azimuthalBeamwidth; - - /** beam center */ - float _beamCenterDE; - - /** DE beamwidth (vertical beamwidth) */ - float _deBeamwidth; - - - public: - AcousticBeamFundamentalParameter(); - virtual ~AcousticBeamFundamentalParameter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getActiveEmissionParameterIndex() const; - void setActiveEmissionParameterIndex(unsigned short pX); - - unsigned short getScanPattern() const; - void setScanPattern(unsigned short pX); - - float getBeamCenterAzimuth() const; - void setBeamCenterAzimuth(float pX); - - float getAzimuthalBeamwidth() const; - void setAzimuthalBeamwidth(float pX); - - float getBeamCenterDE() const; - void setBeamCenterDE(float pX); - - float getDeBeamwidth() const; - void setDeBeamwidth(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcousticBeamFundamentalParameter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticEmitter.cpp b/src/dis6/AcousticEmitter.cpp deleted file mode 100644 index 9a8161c8..00000000 --- a/src/dis6/AcousticEmitter.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -AcousticEmitter::AcousticEmitter(): - _acousticName(0), - _function(0), - _acousticIdNumber(0) -{ -} - -AcousticEmitter::~AcousticEmitter() -{ -} - -unsigned short AcousticEmitter::getAcousticName() const -{ - return _acousticName; -} - -void AcousticEmitter::setAcousticName(unsigned short pX) -{ - _acousticName = pX; -} - -unsigned char AcousticEmitter::getFunction() const -{ - return _function; -} - -void AcousticEmitter::setFunction(unsigned char pX) -{ - _function = pX; -} - -unsigned char AcousticEmitter::getAcousticIdNumber() const -{ - return _acousticIdNumber; -} - -void AcousticEmitter::setAcousticIdNumber(unsigned char pX) -{ - _acousticIdNumber = pX; -} - -void AcousticEmitter::marshal(DataStream& dataStream) const -{ - dataStream << _acousticName; - dataStream << _function; - dataStream << _acousticIdNumber; -} - -void AcousticEmitter::unmarshal(DataStream& dataStream) -{ - dataStream >> _acousticName; - dataStream >> _function; - dataStream >> _acousticIdNumber; -} - - -bool AcousticEmitter::operator ==(const AcousticEmitter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_acousticName == rhs._acousticName) ) ivarsEqual = false; - if( ! (_function == rhs._function) ) ivarsEqual = false; - if( ! (_acousticIdNumber == rhs._acousticIdNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcousticEmitter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _acousticName - marshalSize = marshalSize + 1; // _function - marshalSize = marshalSize + 1; // _acousticIdNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticEmitter.h b/src/dis6/AcousticEmitter.h deleted file mode 100644 index ab3cb0d2..00000000 --- a/src/dis6/AcousticEmitter.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.35. information about a specific UA emmtter - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AcousticEmitter -{ -protected: - /** the system for a particular UA emitter, and an enumeration */ - unsigned short _acousticName; - - /** The function of the acoustic system */ - unsigned char _function; - - /** The UA emitter identification number relative to a specific system */ - unsigned char _acousticIdNumber; - - - public: - AcousticEmitter(); - virtual ~AcousticEmitter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getAcousticName() const; - void setAcousticName(unsigned short pX); - - unsigned char getFunction() const; - void setFunction(unsigned char pX); - - unsigned char getAcousticIdNumber() const; - void setAcousticIdNumber(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcousticEmitter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticEmitterSystem.cpp b/src/dis6/AcousticEmitterSystem.cpp deleted file mode 100644 index 4575e6b0..00000000 --- a/src/dis6/AcousticEmitterSystem.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -AcousticEmitterSystem::AcousticEmitterSystem(): - _acousticName(0), - _acousticFunction(0), - _acousticID(0) -{ -} - -AcousticEmitterSystem::~AcousticEmitterSystem() -{ -} - -unsigned short AcousticEmitterSystem::getAcousticName() const -{ - return _acousticName; -} - -void AcousticEmitterSystem::setAcousticName(unsigned short pX) -{ - _acousticName = pX; -} - -unsigned char AcousticEmitterSystem::getAcousticFunction() const -{ - return _acousticFunction; -} - -void AcousticEmitterSystem::setAcousticFunction(unsigned char pX) -{ - _acousticFunction = pX; -} - -unsigned char AcousticEmitterSystem::getAcousticID() const -{ - return _acousticID; -} - -void AcousticEmitterSystem::setAcousticID(unsigned char pX) -{ - _acousticID = pX; -} - -void AcousticEmitterSystem::marshal(DataStream& dataStream) const -{ - dataStream << _acousticName; - dataStream << _acousticFunction; - dataStream << _acousticID; -} - -void AcousticEmitterSystem::unmarshal(DataStream& dataStream) -{ - dataStream >> _acousticName; - dataStream >> _acousticFunction; - dataStream >> _acousticID; -} - - -bool AcousticEmitterSystem::operator ==(const AcousticEmitterSystem& rhs) const - { - bool ivarsEqual = true; - - if( ! (_acousticName == rhs._acousticName) ) ivarsEqual = false; - if( ! (_acousticFunction == rhs._acousticFunction) ) ivarsEqual = false; - if( ! (_acousticID == rhs._acousticID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcousticEmitterSystem::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _acousticName - marshalSize = marshalSize + 1; // _acousticFunction - marshalSize = marshalSize + 1; // _acousticID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticEmitterSystem.h b/src/dis6/AcousticEmitterSystem.h deleted file mode 100644 index d8eb618c..00000000 --- a/src/dis6/AcousticEmitterSystem.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.3.35: Information about a particular UA emitter shall be represented using an Acoustic Emitter System record. This record shall consist of three fields: Acoustic Name, Function, and Acoustic ID Number - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AcousticEmitterSystem -{ -protected: - /** This field shall specify the system for a particular UA emitter. */ - unsigned short _acousticName; - - /** This field shall describe the function of the acoustic system. */ - unsigned char _acousticFunction; - - /** This field shall specify the UA emitter identification number relative to a specific system. This field shall be represented by an 8-bit unsigned integer. This field allows the differentiation of multiple systems on an entity, even if in some instances two or more of the systems may be identical UA emitter types. Numbering of systems shall begin with the value 1. */ - unsigned char _acousticID; - - - public: - AcousticEmitterSystem(); - virtual ~AcousticEmitterSystem(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getAcousticName() const; - void setAcousticName(unsigned short pX); - - unsigned char getAcousticFunction() const; - void setAcousticFunction(unsigned char pX); - - unsigned char getAcousticID() const; - void setAcousticID(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcousticEmitterSystem& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticEmitterSystemData.cpp b/src/dis6/AcousticEmitterSystemData.cpp deleted file mode 100644 index 5e6aa798..00000000 --- a/src/dis6/AcousticEmitterSystemData.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include - -using namespace DIS; - - -AcousticEmitterSystemData::AcousticEmitterSystemData(): - _emitterSystemDataLength(0), - _numberOfBeams(0), - _pad2(0), - _acousticEmitterSystem(), - _emitterLocation() -{ -} - -AcousticEmitterSystemData::~AcousticEmitterSystemData() -{ - _beamRecords.clear(); -} - -unsigned char AcousticEmitterSystemData::getEmitterSystemDataLength() const -{ - return _emitterSystemDataLength; -} - -void AcousticEmitterSystemData::setEmitterSystemDataLength(unsigned char pX) -{ - _emitterSystemDataLength = pX; -} - -unsigned char AcousticEmitterSystemData::getNumberOfBeams() const -{ - return _beamRecords.size(); -} - -unsigned short AcousticEmitterSystemData::getPad2() const -{ - return _pad2; -} - -void AcousticEmitterSystemData::setPad2(unsigned short pX) -{ - _pad2 = pX; -} - -AcousticEmitterSystem& AcousticEmitterSystemData::getAcousticEmitterSystem() -{ - return _acousticEmitterSystem; -} - -const AcousticEmitterSystem& AcousticEmitterSystemData::getAcousticEmitterSystem() const -{ - return _acousticEmitterSystem; -} - -void AcousticEmitterSystemData::setAcousticEmitterSystem(const AcousticEmitterSystem &pX) -{ - _acousticEmitterSystem = pX; -} - -Vector3Float& AcousticEmitterSystemData::getEmitterLocation() -{ - return _emitterLocation; -} - -const Vector3Float& AcousticEmitterSystemData::getEmitterLocation() const -{ - return _emitterLocation; -} - -void AcousticEmitterSystemData::setEmitterLocation(const Vector3Float &pX) -{ - _emitterLocation = pX; -} - -std::vector& AcousticEmitterSystemData::getBeamRecords() -{ - return _beamRecords; -} - -const std::vector& AcousticEmitterSystemData::getBeamRecords() const -{ - return _beamRecords; -} - -void AcousticEmitterSystemData::setBeamRecords(const std::vector& pX) -{ - _beamRecords = pX; -} - -void AcousticEmitterSystemData::marshal(DataStream& dataStream) const -{ - dataStream << _emitterSystemDataLength; - dataStream << ( unsigned char )_beamRecords.size(); - dataStream << _pad2; - _acousticEmitterSystem.marshal(dataStream); - _emitterLocation.marshal(dataStream); - - for(size_t idx = 0; idx < _beamRecords.size(); idx++) - { - AcousticBeamData x = _beamRecords[idx]; - x.marshal(dataStream); - } - -} - -void AcousticEmitterSystemData::unmarshal(DataStream& dataStream) -{ - dataStream >> _emitterSystemDataLength; - dataStream >> _numberOfBeams; - dataStream >> _pad2; - _acousticEmitterSystem.unmarshal(dataStream); - _emitterLocation.unmarshal(dataStream); - - _beamRecords.clear(); - for(size_t idx = 0; idx < _numberOfBeams; idx++) - { - AcousticBeamData x; - x.unmarshal(dataStream); - _beamRecords.push_back(x); - } -} - - -bool AcousticEmitterSystemData::operator ==(const AcousticEmitterSystemData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_emitterSystemDataLength == rhs._emitterSystemDataLength) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_acousticEmitterSystem == rhs._acousticEmitterSystem) ) ivarsEqual = false; - if( ! (_emitterLocation == rhs._emitterLocation) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _beamRecords.size(); idx++) - { - if( ! ( _beamRecords[idx] == rhs._beamRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int AcousticEmitterSystemData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _emitterSystemDataLength - marshalSize = marshalSize + 1; // _numberOfBeams - marshalSize = marshalSize + 2; // _pad2 - marshalSize = marshalSize + _acousticEmitterSystem.getMarshalledSize(); // _acousticEmitterSystem - marshalSize = marshalSize + _emitterLocation.getMarshalledSize(); // _emitterLocation - - for(unsigned long long idx=0; idx < _beamRecords.size(); idx++) - { - AcousticBeamData listElement = _beamRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AcousticEmitterSystemData.h b/src/dis6/AcousticEmitterSystemData.h deleted file mode 100644 index 9f97d64e..00000000 --- a/src/dis6/AcousticEmitterSystemData.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Used in the UA pdu; ties together an emmitter and a location. This requires manual cleanup; the beam data should not be attached to each emitter system. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AcousticEmitterSystemData -{ -protected: - /** Length of emitter system data */ - unsigned char _emitterSystemDataLength; - - /** Number of beams */ - unsigned char _numberOfBeams; - - /** padding */ - unsigned short _pad2; - - /** This field shall specify the system for a particular UA emitter. */ - AcousticEmitterSystem _acousticEmitterSystem; - - /** Represents the location wrt the entity */ - Vector3Float _emitterLocation; - - /** For each beam in numberOfBeams, an emitter system. This is not right--the beam records need to be at the end of the PDU, rather than attached to each system. */ - std::vector _beamRecords; - - - public: - AcousticEmitterSystemData(); - virtual ~AcousticEmitterSystemData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getEmitterSystemDataLength() const; - void setEmitterSystemDataLength(unsigned char pX); - - unsigned char getNumberOfBeams() const; - - unsigned short getPad2() const; - void setPad2(unsigned short pX); - - AcousticEmitterSystem& getAcousticEmitterSystem(); - const AcousticEmitterSystem& getAcousticEmitterSystem() const; - void setAcousticEmitterSystem(const AcousticEmitterSystem &pX); - - Vector3Float& getEmitterLocation(); - const Vector3Float& getEmitterLocation() const; - void setEmitterLocation(const Vector3Float &pX); - - std::vector& getBeamRecords(); - const std::vector& getBeamRecords() const; - void setBeamRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcousticEmitterSystemData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ActionRequestPdu.cpp b/src/dis6/ActionRequestPdu.cpp deleted file mode 100644 index 6098d35a..00000000 --- a/src/dis6/ActionRequestPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -ActionRequestPdu::ActionRequestPdu() : SimulationManagementFamilyPdu(), - _requestID(0), - _actionID(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 16 ); -} - -ActionRequestPdu::~ActionRequestPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int ActionRequestPdu::getRequestID() const -{ - return _requestID; -} - -void ActionRequestPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int ActionRequestPdu::getActionID() const -{ - return _actionID; -} - -void ActionRequestPdu::setActionID(unsigned int pX) -{ - _actionID = pX; -} - -unsigned int ActionRequestPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int ActionRequestPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& ActionRequestPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& ActionRequestPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void ActionRequestPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& ActionRequestPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& ActionRequestPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void ActionRequestPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void ActionRequestPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _actionID; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void ActionRequestPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _actionID; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool ActionRequestPdu::operator ==(const ActionRequestPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_actionID == rhs._actionID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ActionRequestPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _actionID - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ActionRequestPdu.h b/src/dis6/ActionRequestPdu.h deleted file mode 100644 index 37d055b3..00000000 --- a/src/dis6/ActionRequestPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.6. Request from simulation manager to an entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ActionRequestPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Request ID that is unique */ - unsigned int _requestID; - - /** identifies the action being requested */ - unsigned int _actionID; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - ActionRequestPdu(); - virtual ~ActionRequestPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getActionID() const; - void setActionID(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ActionRequestPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ActionRequestReliablePdu.cpp b/src/dis6/ActionRequestReliablePdu.cpp deleted file mode 100644 index f4fd801d..00000000 --- a/src/dis6/ActionRequestReliablePdu.cpp +++ /dev/null @@ -1,254 +0,0 @@ -#include - -using namespace DIS; - - -ActionRequestReliablePdu::ActionRequestReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0), - _actionID(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 56 ); -} - -ActionRequestReliablePdu::~ActionRequestReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned char ActionRequestReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void ActionRequestReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short ActionRequestReliablePdu::getPad1() const -{ - return _pad1; -} - -void ActionRequestReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char ActionRequestReliablePdu::getPad2() const -{ - return _pad2; -} - -void ActionRequestReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int ActionRequestReliablePdu::getRequestID() const -{ - return _requestID; -} - -void ActionRequestReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int ActionRequestReliablePdu::getActionID() const -{ - return _actionID; -} - -void ActionRequestReliablePdu::setActionID(unsigned int pX) -{ - _actionID = pX; -} - -unsigned int ActionRequestReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int ActionRequestReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& ActionRequestReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& ActionRequestReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void ActionRequestReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& ActionRequestReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& ActionRequestReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void ActionRequestReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void ActionRequestReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; - dataStream << _actionID; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void ActionRequestReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; - dataStream >> _actionID; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool ActionRequestReliablePdu::operator ==(const ActionRequestReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_actionID == rhs._actionID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ActionRequestReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _actionID - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ActionRequestReliablePdu.h b/src/dis6/ActionRequestReliablePdu.h deleted file mode 100644 index f0942582..00000000 --- a/src/dis6/ActionRequestReliablePdu.h +++ /dev/null @@ -1,120 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.6: request from a simulation manager to a managed entity to perform a specified action. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ActionRequestReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** request ID */ - unsigned int _requestID; - - /** request ID */ - unsigned int _actionID; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - ActionRequestReliablePdu(); - virtual ~ActionRequestReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getActionID() const; - void setActionID(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ActionRequestReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ActionResponsePdu.cpp b/src/dis6/ActionResponsePdu.cpp deleted file mode 100644 index 27b74827..00000000 --- a/src/dis6/ActionResponsePdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -ActionResponsePdu::ActionResponsePdu() : SimulationManagementFamilyPdu(), - _requestID(0), - _requestStatus(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 17 ); -} - -ActionResponsePdu::~ActionResponsePdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int ActionResponsePdu::getRequestID() const -{ - return _requestID; -} - -void ActionResponsePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int ActionResponsePdu::getRequestStatus() const -{ - return _requestStatus; -} - -void ActionResponsePdu::setRequestStatus(unsigned int pX) -{ - _requestStatus = pX; -} - -unsigned int ActionResponsePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int ActionResponsePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& ActionResponsePdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& ActionResponsePdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void ActionResponsePdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& ActionResponsePdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& ActionResponsePdu::getVariableDatums() const -{ - return _variableDatums; -} - -void ActionResponsePdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void ActionResponsePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _requestStatus; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void ActionResponsePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _requestStatus; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool ActionResponsePdu::operator ==(const ActionResponsePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_requestStatus == rhs._requestStatus) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ActionResponsePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _requestStatus - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ActionResponsePdu.h b/src/dis6/ActionResponsePdu.h deleted file mode 100644 index 3c3da49f..00000000 --- a/src/dis6/ActionResponsePdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.7. response to an action request PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ActionResponsePdu : public SimulationManagementFamilyPdu -{ -protected: - /** Request ID that is unique */ - unsigned int _requestID; - - /** Status of response */ - unsigned int _requestStatus; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - ActionResponsePdu(); - virtual ~ActionResponsePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getRequestStatus() const; - void setRequestStatus(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ActionResponsePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ActionResponseReliablePdu.cpp b/src/dis6/ActionResponseReliablePdu.cpp deleted file mode 100644 index 4a41c4c4..00000000 --- a/src/dis6/ActionResponseReliablePdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -ActionResponseReliablePdu::ActionResponseReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requestID(0), - _responseStatus(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 57 ); -} - -ActionResponseReliablePdu::~ActionResponseReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned int ActionResponseReliablePdu::getRequestID() const -{ - return _requestID; -} - -void ActionResponseReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int ActionResponseReliablePdu::getResponseStatus() const -{ - return _responseStatus; -} - -void ActionResponseReliablePdu::setResponseStatus(unsigned int pX) -{ - _responseStatus = pX; -} - -unsigned int ActionResponseReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int ActionResponseReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& ActionResponseReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& ActionResponseReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void ActionResponseReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& ActionResponseReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& ActionResponseReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void ActionResponseReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void ActionResponseReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _responseStatus; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void ActionResponseReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _responseStatus; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool ActionResponseReliablePdu::operator ==(const ActionResponseReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_responseStatus == rhs._responseStatus) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ActionResponseReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _responseStatus - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ActionResponseReliablePdu.h b/src/dis6/ActionResponseReliablePdu.h deleted file mode 100644 index 2f2e5419..00000000 --- a/src/dis6/ActionResponseReliablePdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.7: Response from an entity to an action request PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ActionResponseReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** request ID */ - unsigned int _requestID; - - /** status of response */ - unsigned int _responseStatus; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - ActionResponseReliablePdu(); - virtual ~ActionResponseReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getResponseStatus() const; - void setResponseStatus(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ActionResponseReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AggregateID.cpp b/src/dis6/AggregateID.cpp deleted file mode 100644 index d357635d..00000000 --- a/src/dis6/AggregateID.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -AggregateID::AggregateID(): - _site(0), - _application(0), - _aggregateID(0) -{ -} - -AggregateID::~AggregateID() -{ -} - -unsigned short AggregateID::getSite() const -{ - return _site; -} - -void AggregateID::setSite(unsigned short pX) -{ - _site = pX; -} - -unsigned short AggregateID::getApplication() const -{ - return _application; -} - -void AggregateID::setApplication(unsigned short pX) -{ - _application = pX; -} - -unsigned short AggregateID::getAggregateID() const -{ - return _aggregateID; -} - -void AggregateID::setAggregateID(unsigned short pX) -{ - _aggregateID = pX; -} - -void AggregateID::marshal(DataStream& dataStream) const -{ - dataStream << _site; - dataStream << _application; - dataStream << _aggregateID; -} - -void AggregateID::unmarshal(DataStream& dataStream) -{ - dataStream >> _site; - dataStream >> _application; - dataStream >> _aggregateID; -} - - -bool AggregateID::operator ==(const AggregateID& rhs) const - { - bool ivarsEqual = true; - - if( ! (_site == rhs._site) ) ivarsEqual = false; - if( ! (_application == rhs._application) ) ivarsEqual = false; - if( ! (_aggregateID == rhs._aggregateID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AggregateID::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _site - marshalSize = marshalSize + 2; // _application - marshalSize = marshalSize + 2; // _aggregateID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AggregateID.h b/src/dis6/AggregateID.h deleted file mode 100644 index a88f80c3..00000000 --- a/src/dis6/AggregateID.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.36. Each agregate in a given simulation app is given an aggregate identifier number unique for all other aggregates in that app and in that exercise. The id is valid for the duration of the the exercise. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AggregateID -{ -protected: - /** The site ID */ - unsigned short _site; - - /** The application ID */ - unsigned short _application; - - /** the aggregate ID */ - unsigned short _aggregateID; - - - public: - AggregateID(); - virtual ~AggregateID(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSite() const; - void setSite(unsigned short pX); - - unsigned short getApplication() const; - void setApplication(unsigned short pX); - - unsigned short getAggregateID() const; - void setAggregateID(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AggregateID& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AggregateMarking.cpp b/src/dis6/AggregateMarking.cpp deleted file mode 100644 index 8e002a32..00000000 --- a/src/dis6/AggregateMarking.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include - -using namespace DIS; - - -AggregateMarking::AggregateMarking(): - _characterSet(0) -{ - // Initialize fixed length array - for(int lengthcharacters= 0; lengthcharacters < 31; lengthcharacters++) - { - _characters[lengthcharacters] = 0; - } - -} - -AggregateMarking::~AggregateMarking() -{ -} - -unsigned char AggregateMarking::getCharacterSet() const -{ - return _characterSet; -} - -void AggregateMarking::setCharacterSet(unsigned char pX) -{ - _characterSet = pX; -} - -char* AggregateMarking::getCharacters() -{ - return _characters; -} - -const char* AggregateMarking::getCharacters() const -{ - return _characters; -} - -void AggregateMarking::setCharacters(const char* x) -{ - for(int i = 0; i < 31; i++) - { - _characters[i] = x[i]; - } -} - -void AggregateMarking::marshal(DataStream& dataStream) const -{ - dataStream << _characterSet; - - for(size_t idx = 0; idx < 31; idx++) - { - dataStream << _characters[idx]; - } - -} - -void AggregateMarking::unmarshal(DataStream& dataStream) -{ - dataStream >> _characterSet; - - for(size_t idx = 0; idx < 31; idx++) - { - dataStream >> _characters[idx]; - } - -} - - -bool AggregateMarking::operator ==(const AggregateMarking& rhs) const - { - bool ivarsEqual = true; - - if( ! (_characterSet == rhs._characterSet) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 31; idx++) - { - if(!(_characters[idx] == rhs._characters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int AggregateMarking::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _characterSet - marshalSize = marshalSize + 31 * 1; // _characters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AggregateMarking.h b/src/dis6/AggregateMarking.h deleted file mode 100644 index 5aae95ee..00000000 --- a/src/dis6/AggregateMarking.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.37. Specifies the character set used inthe first byte, followed by up to 31 characters of text data. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AggregateMarking -{ -protected: - /** The character set */ - unsigned char _characterSet; - - /** The characters */ - char _characters[31]; - - - public: - AggregateMarking(); - virtual ~AggregateMarking(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getCharacterSet() const; - void setCharacterSet(unsigned char pX); - - char* getCharacters(); - const char* getCharacters() const; - void setCharacters( const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AggregateMarking& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AggregateStatePdu.cpp b/src/dis6/AggregateStatePdu.cpp deleted file mode 100644 index 505b3d8f..00000000 --- a/src/dis6/AggregateStatePdu.cpp +++ /dev/null @@ -1,538 +0,0 @@ -#include - -using namespace DIS; - - -AggregateStatePdu::AggregateStatePdu() : EntityManagementFamilyPdu(), - _aggregateID(), - _forceID(0), - _aggregateState(0), - _aggregateType(), - _formation(0), - _aggregateMarking(), - _dimensions(), - _orientation(), - _centerOfMass(), - _velocity(), - _numberOfDisAggregates(0), - _numberOfDisEntities(0), - _numberOfSilentAggregateTypes(0), - _numberOfSilentEntityTypes(0), - _pad2(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 33 ); -} - -AggregateStatePdu::~AggregateStatePdu() -{ - _aggregateIDList.clear(); - _entityIDList.clear(); - _silentAggregateSystemList.clear(); - _silentEntitySystemList.clear(); - _variableDatumList.clear(); -} - -EntityID& AggregateStatePdu::getAggregateID() -{ - return _aggregateID; -} - -const EntityID& AggregateStatePdu::getAggregateID() const -{ - return _aggregateID; -} - -void AggregateStatePdu::setAggregateID(const EntityID &pX) -{ - _aggregateID = pX; -} - -unsigned char AggregateStatePdu::getForceID() const -{ - return _forceID; -} - -void AggregateStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char AggregateStatePdu::getAggregateState() const -{ - return _aggregateState; -} - -void AggregateStatePdu::setAggregateState(unsigned char pX) -{ - _aggregateState = pX; -} - -EntityType& AggregateStatePdu::getAggregateType() -{ - return _aggregateType; -} - -const EntityType& AggregateStatePdu::getAggregateType() const -{ - return _aggregateType; -} - -void AggregateStatePdu::setAggregateType(const EntityType &pX) -{ - _aggregateType = pX; -} - -unsigned int AggregateStatePdu::getFormation() const -{ - return _formation; -} - -void AggregateStatePdu::setFormation(unsigned int pX) -{ - _formation = pX; -} - -AggregateMarking& AggregateStatePdu::getAggregateMarking() -{ - return _aggregateMarking; -} - -const AggregateMarking& AggregateStatePdu::getAggregateMarking() const -{ - return _aggregateMarking; -} - -void AggregateStatePdu::setAggregateMarking(const AggregateMarking &pX) -{ - _aggregateMarking = pX; -} - -Vector3Float& AggregateStatePdu::getDimensions() -{ - return _dimensions; -} - -const Vector3Float& AggregateStatePdu::getDimensions() const -{ - return _dimensions; -} - -void AggregateStatePdu::setDimensions(const Vector3Float &pX) -{ - _dimensions = pX; -} - -Orientation& AggregateStatePdu::getOrientation() -{ - return _orientation; -} - -const Orientation& AggregateStatePdu::getOrientation() const -{ - return _orientation; -} - -void AggregateStatePdu::setOrientation(const Orientation &pX) -{ - _orientation = pX; -} - -Vector3Double& AggregateStatePdu::getCenterOfMass() -{ - return _centerOfMass; -} - -const Vector3Double& AggregateStatePdu::getCenterOfMass() const -{ - return _centerOfMass; -} - -void AggregateStatePdu::setCenterOfMass(const Vector3Double &pX) -{ - _centerOfMass = pX; -} - -Vector3Float& AggregateStatePdu::getVelocity() -{ - return _velocity; -} - -const Vector3Float& AggregateStatePdu::getVelocity() const -{ - return _velocity; -} - -void AggregateStatePdu::setVelocity(const Vector3Float &pX) -{ - _velocity = pX; -} - -unsigned short AggregateStatePdu::getNumberOfDisAggregates() const -{ - return _aggregateIDList.size(); -} - -unsigned short AggregateStatePdu::getNumberOfDisEntities() const -{ - return _entityIDList.size(); -} - -unsigned short AggregateStatePdu::getNumberOfSilentAggregateTypes() const -{ - return _silentAggregateSystemList.size(); -} - -unsigned short AggregateStatePdu::getNumberOfSilentEntityTypes() const -{ - return _silentEntitySystemList.size(); -} - -std::vector& AggregateStatePdu::getAggregateIDList() -{ - return _aggregateIDList; -} - -const std::vector& AggregateStatePdu::getAggregateIDList() const -{ - return _aggregateIDList; -} - -void AggregateStatePdu::setAggregateIDList(const std::vector& pX) -{ - _aggregateIDList = pX; -} - -std::vector& AggregateStatePdu::getEntityIDList() -{ - return _entityIDList; -} - -const std::vector& AggregateStatePdu::getEntityIDList() const -{ - return _entityIDList; -} - -void AggregateStatePdu::setEntityIDList(const std::vector& pX) -{ - _entityIDList = pX; -} - -unsigned char AggregateStatePdu::getPad2() const -{ - return _pad2; -} - -void AggregateStatePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -std::vector& AggregateStatePdu::getSilentAggregateSystemList() -{ - return _silentAggregateSystemList; -} - -const std::vector& AggregateStatePdu::getSilentAggregateSystemList() const -{ - return _silentAggregateSystemList; -} - -void AggregateStatePdu::setSilentAggregateSystemList(const std::vector& pX) -{ - _silentAggregateSystemList = pX; -} - -std::vector& AggregateStatePdu::getSilentEntitySystemList() -{ - return _silentEntitySystemList; -} - -const std::vector& AggregateStatePdu::getSilentEntitySystemList() const -{ - return _silentEntitySystemList; -} - -void AggregateStatePdu::setSilentEntitySystemList(const std::vector& pX) -{ - _silentEntitySystemList = pX; -} - -unsigned int AggregateStatePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumList.size(); -} - -std::vector& AggregateStatePdu::getVariableDatumList() -{ - return _variableDatumList; -} - -const std::vector& AggregateStatePdu::getVariableDatumList() const -{ - return _variableDatumList; -} - -void AggregateStatePdu::setVariableDatumList(const std::vector& pX) -{ - _variableDatumList = pX; -} - -void AggregateStatePdu::marshal(DataStream& dataStream) const -{ - EntityManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _aggregateID.marshal(dataStream); - dataStream << _forceID; - dataStream << _aggregateState; - _aggregateType.marshal(dataStream); - dataStream << _formation; - _aggregateMarking.marshal(dataStream); - _dimensions.marshal(dataStream); - _orientation.marshal(dataStream); - _centerOfMass.marshal(dataStream); - _velocity.marshal(dataStream); - dataStream << ( unsigned short )_aggregateIDList.size(); - dataStream << ( unsigned short )_entityIDList.size(); - dataStream << ( unsigned short )_silentAggregateSystemList.size(); - dataStream << ( unsigned short )_silentEntitySystemList.size(); - - for(size_t idx = 0; idx < _aggregateIDList.size(); idx++) - { - AggregateID x = _aggregateIDList[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _entityIDList.size(); idx++) - { - EntityID x = _entityIDList[idx]; - x.marshal(dataStream); - } - - dataStream << _pad2; - - for(size_t idx = 0; idx < _silentAggregateSystemList.size(); idx++) - { - EntityType x = _silentAggregateSystemList[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _silentEntitySystemList.size(); idx++) - { - EntityType x = _silentEntitySystemList[idx]; - x.marshal(dataStream); - } - - dataStream << ( unsigned int )_variableDatumList.size(); - - for(size_t idx = 0; idx < _variableDatumList.size(); idx++) - { - VariableDatum x = _variableDatumList[idx]; - x.marshal(dataStream); - } - -} - -void AggregateStatePdu::unmarshal(DataStream& dataStream) -{ - EntityManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _aggregateID.unmarshal(dataStream); - dataStream >> _forceID; - dataStream >> _aggregateState; - _aggregateType.unmarshal(dataStream); - dataStream >> _formation; - _aggregateMarking.unmarshal(dataStream); - _dimensions.unmarshal(dataStream); - _orientation.unmarshal(dataStream); - _centerOfMass.unmarshal(dataStream); - _velocity.unmarshal(dataStream); - dataStream >> _numberOfDisAggregates; - dataStream >> _numberOfDisEntities; - dataStream >> _numberOfSilentAggregateTypes; - dataStream >> _numberOfSilentEntityTypes; - - _aggregateIDList.clear(); - for(size_t idx = 0; idx < _numberOfDisAggregates; idx++) - { - AggregateID x; - x.unmarshal(dataStream); - _aggregateIDList.push_back(x); - } - - _entityIDList.clear(); - for(size_t idx = 0; idx < _numberOfDisEntities; idx++) - { - EntityID x; - x.unmarshal(dataStream); - _entityIDList.push_back(x); - } - dataStream >> _pad2; - - _silentAggregateSystemList.clear(); - for(size_t idx = 0; idx < _numberOfSilentAggregateTypes; idx++) - { - EntityType x; - x.unmarshal(dataStream); - _silentAggregateSystemList.push_back(x); - } - - _silentEntitySystemList.clear(); - for(size_t idx = 0; idx < _numberOfSilentEntityTypes; idx++) - { - EntityType x; - x.unmarshal(dataStream); - _silentEntitySystemList.push_back(x); - } - dataStream >> _numberOfVariableDatumRecords; - - _variableDatumList.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumList.push_back(x); - } -} - - -bool AggregateStatePdu::operator ==(const AggregateStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); - - if( ! (_aggregateID == rhs._aggregateID) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_aggregateState == rhs._aggregateState) ) ivarsEqual = false; - if( ! (_aggregateType == rhs._aggregateType) ) ivarsEqual = false; - if( ! (_formation == rhs._formation) ) ivarsEqual = false; - if( ! (_aggregateMarking == rhs._aggregateMarking) ) ivarsEqual = false; - if( ! (_dimensions == rhs._dimensions) ) ivarsEqual = false; - if( ! (_orientation == rhs._orientation) ) ivarsEqual = false; - if( ! (_centerOfMass == rhs._centerOfMass) ) ivarsEqual = false; - if( ! (_velocity == rhs._velocity) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _aggregateIDList.size(); idx++) - { - if( ! ( _aggregateIDList[idx] == rhs._aggregateIDList[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _entityIDList.size(); idx++) - { - if( ! ( _entityIDList[idx] == rhs._entityIDList[idx]) ) ivarsEqual = false; - } - - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _silentAggregateSystemList.size(); idx++) - { - if( ! ( _silentAggregateSystemList[idx] == rhs._silentAggregateSystemList[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _silentEntitySystemList.size(); idx++) - { - if( ! ( _silentEntitySystemList[idx] == rhs._silentEntitySystemList[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumList.size(); idx++) - { - if( ! ( _variableDatumList[idx] == rhs._variableDatumList[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int AggregateStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _aggregateID.getMarshalledSize(); // _aggregateID - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _aggregateState - marshalSize = marshalSize + _aggregateType.getMarshalledSize(); // _aggregateType - marshalSize = marshalSize + 4; // _formation - marshalSize = marshalSize + _aggregateMarking.getMarshalledSize(); // _aggregateMarking - marshalSize = marshalSize + _dimensions.getMarshalledSize(); // _dimensions - marshalSize = marshalSize + _orientation.getMarshalledSize(); // _orientation - marshalSize = marshalSize + _centerOfMass.getMarshalledSize(); // _centerOfMass - marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity - marshalSize = marshalSize + 2; // _numberOfDisAggregates - marshalSize = marshalSize + 2; // _numberOfDisEntities - marshalSize = marshalSize + 2; // _numberOfSilentAggregateTypes - marshalSize = marshalSize + 2; // _numberOfSilentEntityTypes - - for(unsigned long long idx=0; idx < _aggregateIDList.size(); idx++) - { - AggregateID listElement = _aggregateIDList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _entityIDList.size(); idx++) - { - EntityID listElement = _entityIDList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - marshalSize = marshalSize + 1; // _pad2 - - for(unsigned long long idx=0; idx < _silentAggregateSystemList.size(); idx++) - { - EntityType listElement = _silentAggregateSystemList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _silentEntitySystemList.size(); idx++) - { - EntityType listElement = _silentEntitySystemList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _variableDatumList.size(); idx++) - { - VariableDatum listElement = _variableDatumList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AggregateStatePdu.h b/src/dis6/AggregateStatePdu.h deleted file mode 100644 index 34f15878..00000000 --- a/src/dis6/AggregateStatePdu.h +++ /dev/null @@ -1,209 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.9.1 informationa bout aggregating entities anc communicating information about the aggregated entities. requires manual intervention to fix the padding between entityID lists and silent aggregate sysem lists--this padding is dependent on how many entityIDs there are, and needs to be on a 32 bit word boundary. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AggregateStatePdu : public EntityManagementFamilyPdu -{ -protected: - /** ID of aggregated entities */ - EntityID _aggregateID; - - /** force ID */ - unsigned char _forceID; - - /** state of aggregate */ - unsigned char _aggregateState; - - /** entity type of the aggregated entities */ - EntityType _aggregateType; - - /** formation of aggregated entities */ - unsigned int _formation; - - /** marking for aggregate; first char is charset type, rest is char data */ - AggregateMarking _aggregateMarking; - - /** dimensions of bounding box for the aggregated entities, origin at the center of mass */ - Vector3Float _dimensions; - - /** orientation of the bounding box */ - Orientation _orientation; - - /** center of mass of the aggregation */ - Vector3Double _centerOfMass; - - /** velocity of aggregation */ - Vector3Float _velocity; - - /** number of aggregates */ - unsigned short _numberOfDisAggregates; - - /** number of entities */ - unsigned short _numberOfDisEntities; - - /** number of silent aggregate types */ - unsigned short _numberOfSilentAggregateTypes; - - /** number of silent entity types */ - unsigned short _numberOfSilentEntityTypes; - - /** aggregates list */ - std::vector _aggregateIDList; - - /** entity ID list */ - std::vector _entityIDList; - - /** ^^^padding to put the start of the next list on a 32 bit boundary. This needs to be fixed */ - unsigned char _pad2; - - /** silent entity types */ - std::vector _silentAggregateSystemList; - - /** silent entity types */ - std::vector _silentEntitySystemList; - - /** number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variableDatums */ - std::vector _variableDatumList; - - - public: - AggregateStatePdu(); - virtual ~AggregateStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getAggregateID(); - const EntityID& getAggregateID() const; - void setAggregateID(const EntityID &pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getAggregateState() const; - void setAggregateState(unsigned char pX); - - EntityType& getAggregateType(); - const EntityType& getAggregateType() const; - void setAggregateType(const EntityType &pX); - - unsigned int getFormation() const; - void setFormation(unsigned int pX); - - AggregateMarking& getAggregateMarking(); - const AggregateMarking& getAggregateMarking() const; - void setAggregateMarking(const AggregateMarking &pX); - - Vector3Float& getDimensions(); - const Vector3Float& getDimensions() const; - void setDimensions(const Vector3Float &pX); - - Orientation& getOrientation(); - const Orientation& getOrientation() const; - void setOrientation(const Orientation &pX); - - Vector3Double& getCenterOfMass(); - const Vector3Double& getCenterOfMass() const; - void setCenterOfMass(const Vector3Double &pX); - - Vector3Float& getVelocity(); - const Vector3Float& getVelocity() const; - void setVelocity(const Vector3Float &pX); - - unsigned short getNumberOfDisAggregates() const; - - unsigned short getNumberOfDisEntities() const; - - unsigned short getNumberOfSilentAggregateTypes() const; - - unsigned short getNumberOfSilentEntityTypes() const; - - std::vector& getAggregateIDList(); - const std::vector& getAggregateIDList() const; - void setAggregateIDList(const std::vector& pX); - - std::vector& getEntityIDList(); - const std::vector& getEntityIDList() const; - void setEntityIDList(const std::vector& pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - std::vector& getSilentAggregateSystemList(); - const std::vector& getSilentAggregateSystemList() const; - void setSilentAggregateSystemList(const std::vector& pX); - - std::vector& getSilentEntitySystemList(); - const std::vector& getSilentEntitySystemList() const; - void setSilentEntitySystemList(const std::vector& pX); - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getVariableDatumList(); - const std::vector& getVariableDatumList() const; - void setVariableDatumList(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AggregateStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AggregateType.cpp b/src/dis6/AggregateType.cpp deleted file mode 100644 index 17729131..00000000 --- a/src/dis6/AggregateType.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -AggregateType::AggregateType(): - _aggregateKind(0), - _domain(0), - _country(0), - _category(0), - _subcategory(0), - _specific(0), - _extra(0) -{ -} - -AggregateType::~AggregateType() -{ -} - -unsigned char AggregateType::getAggregateKind() const -{ - return _aggregateKind; -} - -void AggregateType::setAggregateKind(unsigned char pX) -{ - _aggregateKind = pX; -} - -unsigned char AggregateType::getDomain() const -{ - return _domain; -} - -void AggregateType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short AggregateType::getCountry() const -{ - return _country; -} - -void AggregateType::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char AggregateType::getCategory() const -{ - return _category; -} - -void AggregateType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char AggregateType::getSubcategory() const -{ - return _subcategory; -} - -void AggregateType::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char AggregateType::getSpecific() const -{ - return _specific; -} - -void AggregateType::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -unsigned char AggregateType::getExtra() const -{ - return _extra; -} - -void AggregateType::setExtra(unsigned char pX) -{ - _extra = pX; -} - -void AggregateType::marshal(DataStream& dataStream) const -{ - dataStream << _aggregateKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; - dataStream << _extra; -} - -void AggregateType::unmarshal(DataStream& dataStream) -{ - dataStream >> _aggregateKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; - dataStream >> _extra; -} - - -bool AggregateType::operator ==(const AggregateType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_aggregateKind == rhs._aggregateKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - if( ! (_extra == rhs._extra) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AggregateType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _aggregateKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - marshalSize = marshalSize + 1; // _extra - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AggregateType.h b/src/dis6/AggregateType.h deleted file mode 100644 index 4563f78a..00000000 --- a/src/dis6/AggregateType.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.38. Identifies the type of aggregate including kind of entity, domain (surface, subsurface, air, etc) country, category, etc. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AggregateType -{ -protected: - /** Kind of entity */ - unsigned char _aggregateKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - /** specific info based on subcategory field */ - unsigned char _specific; - - unsigned char _extra; - - - public: - AggregateType(); - virtual ~AggregateType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getAggregateKind() const; - void setAggregateKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - unsigned char getExtra() const; - void setExtra(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AggregateType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AngularVelocityVector.cpp b/src/dis6/AngularVelocityVector.cpp deleted file mode 100644 index 47d33e75..00000000 --- a/src/dis6/AngularVelocityVector.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -AngularVelocityVector::AngularVelocityVector(): - _x(0), - _y(0), - _z(0) -{ -} - -AngularVelocityVector::~AngularVelocityVector() -{ -} - -float AngularVelocityVector::getX() const -{ - return _x; -} - -void AngularVelocityVector::setX(float pX) -{ - _x = pX; -} - -float AngularVelocityVector::getY() const -{ - return _y; -} - -void AngularVelocityVector::setY(float pX) -{ - _y = pX; -} - -float AngularVelocityVector::getZ() const -{ - return _z; -} - -void AngularVelocityVector::setZ(float pX) -{ - _z = pX; -} - -void AngularVelocityVector::marshal(DataStream& dataStream) const -{ - dataStream << _x; - dataStream << _y; - dataStream << _z; -} - -void AngularVelocityVector::unmarshal(DataStream& dataStream) -{ - dataStream >> _x; - dataStream >> _y; - dataStream >> _z; -} - - -bool AngularVelocityVector::operator ==(const AngularVelocityVector& rhs) const - { - bool ivarsEqual = true; - - if( ! (_x == rhs._x) ) ivarsEqual = false; - if( ! (_y == rhs._y) ) ivarsEqual = false; - if( ! (_z == rhs._z) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AngularVelocityVector::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _x - marshalSize = marshalSize + 4; // _y - marshalSize = marshalSize + 4; // _z - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AngularVelocityVector.h b/src/dis6/AngularVelocityVector.h deleted file mode 100644 index f9e36c04..00000000 --- a/src/dis6/AngularVelocityVector.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.2.2: angular velocity measured in radians per second out each of the entity's own coordinate axes. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AngularVelocityVector -{ -protected: - /** velocity about the x axis */ - float _x; - - /** velocity about the y axis */ - float _y; - - /** velocity about the zaxis */ - float _z; - - - public: - AngularVelocityVector(); - virtual ~AngularVelocityVector(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getX() const; - void setX(float pX); - - float getY() const; - void setY(float pX); - - float getZ() const; - void setZ(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AngularVelocityVector& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AntennaLocation.cpp b/src/dis6/AntennaLocation.cpp deleted file mode 100644 index 8d5425b2..00000000 --- a/src/dis6/AntennaLocation.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include - -using namespace DIS; - - -AntennaLocation::AntennaLocation(): - _antennaLocation(), - _relativeAntennaLocation() -{ -} - -AntennaLocation::~AntennaLocation() -{ -} - -Vector3Double& AntennaLocation::getAntennaLocation() -{ - return _antennaLocation; -} - -const Vector3Double& AntennaLocation::getAntennaLocation() const -{ - return _antennaLocation; -} - -void AntennaLocation::setAntennaLocation(const Vector3Double &pX) -{ - _antennaLocation = pX; -} - -Vector3Float& AntennaLocation::getRelativeAntennaLocation() -{ - return _relativeAntennaLocation; -} - -const Vector3Float& AntennaLocation::getRelativeAntennaLocation() const -{ - return _relativeAntennaLocation; -} - -void AntennaLocation::setRelativeAntennaLocation(const Vector3Float &pX) -{ - _relativeAntennaLocation = pX; -} - -void AntennaLocation::marshal(DataStream& dataStream) const -{ - _antennaLocation.marshal(dataStream); - _relativeAntennaLocation.marshal(dataStream); -} - -void AntennaLocation::unmarshal(DataStream& dataStream) -{ - _antennaLocation.unmarshal(dataStream); - _relativeAntennaLocation.unmarshal(dataStream); -} - - -bool AntennaLocation::operator ==(const AntennaLocation& rhs) const - { - bool ivarsEqual = true; - - if( ! (_antennaLocation == rhs._antennaLocation) ) ivarsEqual = false; - if( ! (_relativeAntennaLocation == rhs._relativeAntennaLocation) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AntennaLocation::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _antennaLocation.getMarshalledSize(); // _antennaLocation - marshalSize = marshalSize + _relativeAntennaLocation.getMarshalledSize(); // _relativeAntennaLocation - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/AntennaLocation.h b/src/dis6/AntennaLocation.h deleted file mode 100644 index 72685033..00000000 --- a/src/dis6/AntennaLocation.h +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// 5.2.3: location of the radiating portion of the antenna, specified in world coordinates and entity coordinates. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT AntennaLocation -{ -protected: - /** Location of the radiating portion of the antenna in world coordinates */ - Vector3Double _antennaLocation; - - /** Location of the radiating portion of the antenna in entity coordinates */ - Vector3Float _relativeAntennaLocation; - - - public: - AntennaLocation(); - virtual ~AntennaLocation(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - Vector3Double& getAntennaLocation(); - const Vector3Double& getAntennaLocation() const; - void setAntennaLocation(const Vector3Double &pX); - - Vector3Float& getRelativeAntennaLocation(); - const Vector3Float& getRelativeAntennaLocation() const; - void setRelativeAntennaLocation(const Vector3Float &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AntennaLocation& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ApaData.cpp b/src/dis6/ApaData.cpp deleted file mode 100644 index 64a83f33..00000000 --- a/src/dis6/ApaData.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -ApaData::ApaData(): - _parameterIndex(0), - _parameterValue(0) -{ -} - -ApaData::~ApaData() -{ -} - -unsigned short ApaData::getParameterIndex() const -{ - return _parameterIndex; -} - -void ApaData::setParameterIndex(unsigned short pX) -{ - _parameterIndex = pX; -} - -short ApaData::getParameterValue() const -{ - return _parameterValue; -} - -void ApaData::setParameterValue(short pX) -{ - _parameterValue = pX; -} - -void ApaData::marshal(DataStream& dataStream) const -{ - dataStream << _parameterIndex; - dataStream << _parameterValue; -} - -void ApaData::unmarshal(DataStream& dataStream) -{ - dataStream >> _parameterIndex; - dataStream >> _parameterValue; -} - - -bool ApaData::operator ==(const ApaData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_parameterIndex == rhs._parameterIndex) ) ivarsEqual = false; - if( ! (_parameterValue == rhs._parameterValue) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ApaData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _parameterIndex - marshalSize = marshalSize + 2; // _parameterValue - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ArealObjectStatePdu.cpp b/src/dis6/ArealObjectStatePdu.cpp deleted file mode 100644 index 6efab892..00000000 --- a/src/dis6/ArealObjectStatePdu.cpp +++ /dev/null @@ -1,291 +0,0 @@ -#include - -using namespace DIS; - - -ArealObjectStatePdu::ArealObjectStatePdu() : SyntheticEnvironmentFamilyPdu(), - _objectID(), - _referencedObjectID(), - _updateNumber(0), - _forceID(0), - _modifications(0), - _objectType(), - _objectAppearance(), - _numberOfPoints(0), - _requesterID(), - _receivingID() -{ - setPduType( 45 ); -} - -ArealObjectStatePdu::~ArealObjectStatePdu() -{ - _objectLocation.clear(); -} - -EntityID& ArealObjectStatePdu::getObjectID() -{ - return _objectID; -} - -const EntityID& ArealObjectStatePdu::getObjectID() const -{ - return _objectID; -} - -void ArealObjectStatePdu::setObjectID(const EntityID &pX) -{ - _objectID = pX; -} - -EntityID& ArealObjectStatePdu::getReferencedObjectID() -{ - return _referencedObjectID; -} - -const EntityID& ArealObjectStatePdu::getReferencedObjectID() const -{ - return _referencedObjectID; -} - -void ArealObjectStatePdu::setReferencedObjectID(const EntityID &pX) -{ - _referencedObjectID = pX; -} - -unsigned short ArealObjectStatePdu::getUpdateNumber() const -{ - return _updateNumber; -} - -void ArealObjectStatePdu::setUpdateNumber(unsigned short pX) -{ - _updateNumber = pX; -} - -unsigned char ArealObjectStatePdu::getForceID() const -{ - return _forceID; -} - -void ArealObjectStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char ArealObjectStatePdu::getModifications() const -{ - return _modifications; -} - -void ArealObjectStatePdu::setModifications(unsigned char pX) -{ - _modifications = pX; -} - -EntityType& ArealObjectStatePdu::getObjectType() -{ - return _objectType; -} - -const EntityType& ArealObjectStatePdu::getObjectType() const -{ - return _objectType; -} - -void ArealObjectStatePdu::setObjectType(const EntityType &pX) -{ - _objectType = pX; -} - -SixByteChunk& ArealObjectStatePdu::getObjectAppearance() -{ - return _objectAppearance; -} - -const SixByteChunk& ArealObjectStatePdu::getObjectAppearance() const -{ - return _objectAppearance; -} - -void ArealObjectStatePdu::setObjectAppearance(const SixByteChunk &pX) -{ - _objectAppearance = pX; -} - -unsigned short ArealObjectStatePdu::getNumberOfPoints() const -{ - return _objectLocation.size(); -} - -SimulationAddress& ArealObjectStatePdu::getRequesterID() -{ - return _requesterID; -} - -const SimulationAddress& ArealObjectStatePdu::getRequesterID() const -{ - return _requesterID; -} - -void ArealObjectStatePdu::setRequesterID(const SimulationAddress &pX) -{ - _requesterID = pX; -} - -SimulationAddress& ArealObjectStatePdu::getReceivingID() -{ - return _receivingID; -} - -const SimulationAddress& ArealObjectStatePdu::getReceivingID() const -{ - return _receivingID; -} - -void ArealObjectStatePdu::setReceivingID(const SimulationAddress &pX) -{ - _receivingID = pX; -} - -std::vector& ArealObjectStatePdu::getObjectLocation() -{ - return _objectLocation; -} - -const std::vector& ArealObjectStatePdu::getObjectLocation() const -{ - return _objectLocation; -} - -void ArealObjectStatePdu::setObjectLocation(const std::vector& pX) -{ - _objectLocation = pX; -} - -void ArealObjectStatePdu::marshal(DataStream& dataStream) const -{ - SyntheticEnvironmentFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _objectID.marshal(dataStream); - _referencedObjectID.marshal(dataStream); - dataStream << _updateNumber; - dataStream << _forceID; - dataStream << _modifications; - _objectType.marshal(dataStream); - _objectAppearance.marshal(dataStream); - dataStream << ( unsigned short )_objectLocation.size(); - _requesterID.marshal(dataStream); - _receivingID.marshal(dataStream); - - for(size_t idx = 0; idx < _objectLocation.size(); idx++) - { - Vector3Double x = _objectLocation[idx]; - x.marshal(dataStream); - } - -} - -void ArealObjectStatePdu::unmarshal(DataStream& dataStream) -{ - SyntheticEnvironmentFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _objectID.unmarshal(dataStream); - _referencedObjectID.unmarshal(dataStream); - dataStream >> _updateNumber; - dataStream >> _forceID; - dataStream >> _modifications; - _objectType.unmarshal(dataStream); - _objectAppearance.unmarshal(dataStream); - dataStream >> _numberOfPoints; - _requesterID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - - _objectLocation.clear(); - for(size_t idx = 0; idx < _numberOfPoints; idx++) - { - Vector3Double x; - x.unmarshal(dataStream); - _objectLocation.push_back(x); - } -} - - -bool ArealObjectStatePdu::operator ==(const ArealObjectStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); - - if( ! (_objectID == rhs._objectID) ) ivarsEqual = false; - if( ! (_referencedObjectID == rhs._referencedObjectID) ) ivarsEqual = false; - if( ! (_updateNumber == rhs._updateNumber) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_modifications == rhs._modifications) ) ivarsEqual = false; - if( ! (_objectType == rhs._objectType) ) ivarsEqual = false; - if( ! (_objectAppearance == rhs._objectAppearance) ) ivarsEqual = false; - if( ! (_requesterID == rhs._requesterID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _objectLocation.size(); idx++) - { - if( ! ( _objectLocation[idx] == rhs._objectLocation[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ArealObjectStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID - marshalSize = marshalSize + _referencedObjectID.getMarshalledSize(); // _referencedObjectID - marshalSize = marshalSize + 2; // _updateNumber - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _modifications - marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType - marshalSize = marshalSize + _objectAppearance.getMarshalledSize(); // _objectAppearance - marshalSize = marshalSize + 2; // _numberOfPoints - marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - - for(unsigned long long idx=0; idx < _objectLocation.size(); idx++) - { - Vector3Double listElement = _objectLocation[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ArealObjectStatePdu.h b/src/dis6/ArealObjectStatePdu.h deleted file mode 100644 index 2c8c5952..00000000 --- a/src/dis6/ArealObjectStatePdu.h +++ /dev/null @@ -1,143 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.11.5: Information about the addition/modification of an oobject that is geometrically achored to the terrain with a set of three or more points that come to a closure. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ArealObjectStatePdu : public SyntheticEnvironmentFamilyPdu -{ -protected: - /** Object in synthetic environment */ - EntityID _objectID; - - /** Object with which this point object is associated */ - EntityID _referencedObjectID; - - /** unique update number of each state transition of an object */ - unsigned short _updateNumber; - - /** force ID */ - unsigned char _forceID; - - /** modifications enumeration */ - unsigned char _modifications; - - /** Object type */ - EntityType _objectType; - - /** Object appearance */ - SixByteChunk _objectAppearance; - - /** Number of points */ - unsigned short _numberOfPoints; - - /** requesterID */ - SimulationAddress _requesterID; - - /** receiver ID */ - SimulationAddress _receivingID; - - /** location of object */ - std::vector _objectLocation; - - - public: - ArealObjectStatePdu(); - virtual ~ArealObjectStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getObjectID(); - const EntityID& getObjectID() const; - void setObjectID(const EntityID &pX); - - EntityID& getReferencedObjectID(); - const EntityID& getReferencedObjectID() const; - void setReferencedObjectID(const EntityID &pX); - - unsigned short getUpdateNumber() const; - void setUpdateNumber(unsigned short pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getModifications() const; - void setModifications(unsigned char pX); - - EntityType& getObjectType(); - const EntityType& getObjectType() const; - void setObjectType(const EntityType &pX); - - SixByteChunk& getObjectAppearance(); - const SixByteChunk& getObjectAppearance() const; - void setObjectAppearance(const SixByteChunk &pX); - - unsigned short getNumberOfPoints() const; - - SimulationAddress& getRequesterID(); - const SimulationAddress& getRequesterID() const; - void setRequesterID(const SimulationAddress &pX); - - SimulationAddress& getReceivingID(); - const SimulationAddress& getReceivingID() const; - void setReceivingID(const SimulationAddress &pX); - - std::vector& getObjectLocation(); - const std::vector& getObjectLocation() const; - void setObjectLocation(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ArealObjectStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ArticulationParameter.cpp b/src/dis6/ArticulationParameter.cpp deleted file mode 100644 index 47575301..00000000 --- a/src/dis6/ArticulationParameter.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -ArticulationParameter::ArticulationParameter(): - _parameterTypeDesignator(0), - _changeIndicator(0), - _partAttachedTo(0), - _parameterType(0), - _parameterValue(0.0) -{ -} - -ArticulationParameter::~ArticulationParameter() -{ -} - -unsigned char ArticulationParameter::getParameterTypeDesignator() const -{ - return _parameterTypeDesignator; -} - -void ArticulationParameter::setParameterTypeDesignator(unsigned char pX) -{ - _parameterTypeDesignator = pX; -} - -unsigned char ArticulationParameter::getChangeIndicator() const -{ - return _changeIndicator; -} - -void ArticulationParameter::setChangeIndicator(unsigned char pX) -{ - _changeIndicator = pX; -} - -unsigned short ArticulationParameter::getPartAttachedTo() const -{ - return _partAttachedTo; -} - -void ArticulationParameter::setPartAttachedTo(unsigned short pX) -{ - _partAttachedTo = pX; -} - -int ArticulationParameter::getParameterType() const -{ - return _parameterType; -} - -void ArticulationParameter::setParameterType(int pX) -{ - _parameterType = pX; -} - -double ArticulationParameter::getParameterValue() const -{ - return _parameterValue; -} - -void ArticulationParameter::setParameterValue(double pX) -{ - _parameterValue = pX; -} - -void ArticulationParameter::marshal(DataStream& dataStream) const -{ - dataStream << _parameterTypeDesignator; - dataStream << _changeIndicator; - dataStream << _partAttachedTo; - dataStream << _parameterType; - dataStream << _parameterValue; -} - -void ArticulationParameter::unmarshal(DataStream& dataStream) -{ - dataStream >> _parameterTypeDesignator; - dataStream >> _changeIndicator; - dataStream >> _partAttachedTo; - dataStream >> _parameterType; - dataStream >> _parameterValue; -} - - -bool ArticulationParameter::operator ==(const ArticulationParameter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_parameterTypeDesignator == rhs._parameterTypeDesignator) ) ivarsEqual = false; - if( ! (_changeIndicator == rhs._changeIndicator) ) ivarsEqual = false; - if( ! (_partAttachedTo == rhs._partAttachedTo) ) ivarsEqual = false; - if( ! (_parameterType == rhs._parameterType) ) ivarsEqual = false; - if( ! (_parameterValue == rhs._parameterValue) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ArticulationParameter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _parameterTypeDesignator - marshalSize = marshalSize + 1; // _changeIndicator - marshalSize = marshalSize + 2; // _partAttachedTo - marshalSize = marshalSize + 4; // _parameterType - marshalSize = marshalSize + 8; // _parameterValue - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ArticulationParameter.h b/src/dis6/ArticulationParameter.h deleted file mode 100644 index ad7c0432..00000000 --- a/src/dis6/ArticulationParameter.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.5. Articulation parameters for movable parts and attached parts of an entity. Specifes wether or not a change has occured, the part identifcation of the articulated part to which it is attached, and the type and value of each parameter. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ArticulationParameter -{ -protected: - unsigned char _parameterTypeDesignator; - - unsigned char _changeIndicator; - - unsigned short _partAttachedTo; - - int _parameterType; - - double _parameterValue; - - - public: - ArticulationParameter(); - virtual ~ArticulationParameter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getParameterTypeDesignator() const; - void setParameterTypeDesignator(unsigned char pX); - - unsigned char getChangeIndicator() const; - void setChangeIndicator(unsigned char pX); - - unsigned short getPartAttachedTo() const; - void setPartAttachedTo(unsigned short pX); - - int getParameterType() const; - void setParameterType(int pX); - - double getParameterValue() const; - void setParameterValue(double pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ArticulationParameter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/BeamAntennaPattern.cpp b/src/dis6/BeamAntennaPattern.cpp deleted file mode 100644 index 61822cb5..00000000 --- a/src/dis6/BeamAntennaPattern.cpp +++ /dev/null @@ -1,192 +0,0 @@ -#include - -using namespace DIS; - - -BeamAntennaPattern::BeamAntennaPattern(): - _beamDirection(), - _azimuthBeamwidth(0), - _referenceSystem(0), - _padding1(0), - _padding2(0), - _ez(0.0), - _ex(0.0), - _phase(0.0) -{ -} - -BeamAntennaPattern::~BeamAntennaPattern() -{ -} - -Orientation& BeamAntennaPattern::getBeamDirection() -{ - return _beamDirection; -} - -const Orientation& BeamAntennaPattern::getBeamDirection() const -{ - return _beamDirection; -} - -void BeamAntennaPattern::setBeamDirection(const Orientation &pX) -{ - _beamDirection = pX; -} - -float BeamAntennaPattern::getAzimuthBeamwidth() const -{ - return _azimuthBeamwidth; -} - -void BeamAntennaPattern::setAzimuthBeamwidth(float pX) -{ - _azimuthBeamwidth = pX; -} - -float BeamAntennaPattern::getReferenceSystem() const -{ - return _referenceSystem; -} - -void BeamAntennaPattern::setReferenceSystem(float pX) -{ - _referenceSystem = pX; -} - -short BeamAntennaPattern::getPadding1() const -{ - return _padding1; -} - -void BeamAntennaPattern::setPadding1(short pX) -{ - _padding1 = pX; -} - -char BeamAntennaPattern::getPadding2() const -{ - return _padding2; -} - -void BeamAntennaPattern::setPadding2(char pX) -{ - _padding2 = pX; -} - -float BeamAntennaPattern::getEz() const -{ - return _ez; -} - -void BeamAntennaPattern::setEz(float pX) -{ - _ez = pX; -} - -float BeamAntennaPattern::getEx() const -{ - return _ex; -} - -void BeamAntennaPattern::setEx(float pX) -{ - _ex = pX; -} - -float BeamAntennaPattern::getPhase() const -{ - return _phase; -} - -void BeamAntennaPattern::setPhase(float pX) -{ - _phase = pX; -} - -void BeamAntennaPattern::marshal(DataStream& dataStream) const -{ - _beamDirection.marshal(dataStream); - dataStream << _azimuthBeamwidth; - dataStream << _referenceSystem; - dataStream << _padding1; - dataStream << _padding2; - dataStream << _ez; - dataStream << _ex; - dataStream << _phase; -} - -void BeamAntennaPattern::unmarshal(DataStream& dataStream) -{ - _beamDirection.unmarshal(dataStream); - dataStream >> _azimuthBeamwidth; - dataStream >> _referenceSystem; - dataStream >> _padding1; - dataStream >> _padding2; - dataStream >> _ez; - dataStream >> _ex; - dataStream >> _phase; -} - - -bool BeamAntennaPattern::operator ==(const BeamAntennaPattern& rhs) const - { - bool ivarsEqual = true; - - if( ! (_beamDirection == rhs._beamDirection) ) ivarsEqual = false; - if( ! (_azimuthBeamwidth == rhs._azimuthBeamwidth) ) ivarsEqual = false; - if( ! (_referenceSystem == rhs._referenceSystem) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_ez == rhs._ez) ) ivarsEqual = false; - if( ! (_ex == rhs._ex) ) ivarsEqual = false; - if( ! (_phase == rhs._phase) ) ivarsEqual = false; - - return ivarsEqual; - } - -int BeamAntennaPattern::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _beamDirection.getMarshalledSize(); // _beamDirection - marshalSize = marshalSize + 4; // _azimuthBeamwidth - marshalSize = marshalSize + 4; // _referenceSystem - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - marshalSize = marshalSize + 4; // _ez - marshalSize = marshalSize + 4; // _ex - marshalSize = marshalSize + 4; // _phase - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/BeamAntennaPattern.h b/src/dis6/BeamAntennaPattern.h deleted file mode 100644 index f424fbf9..00000000 --- a/src/dis6/BeamAntennaPattern.h +++ /dev/null @@ -1,108 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.2.4.2. Used when the antenna pattern type field has a value of 1. Specifies the direction, patter, and polarization of radiation from an antenna. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT BeamAntennaPattern -{ -protected: - /** The rotation that transformst he reference coordinate sytem into the beam coordinate system. Either world coordinates or entity coordinates may be used as the reference coordinate system, as specified by teh reference system field of the antenna pattern record. */ - Orientation _beamDirection; - - float _azimuthBeamwidth; - - float _referenceSystem; - - short _padding1; - - char _padding2; - - /** Magnigute of the z-component in beam coordinates at some arbitrary single point in the mainbeam and in the far field of the antenna. */ - float _ez; - - /** Magnigute of the x-component in beam coordinates at some arbitrary single point in the mainbeam and in the far field of the antenna. */ - float _ex; - - /** THe phase angle between Ez and Ex in radians. */ - float _phase; - - - public: - BeamAntennaPattern(); - virtual ~BeamAntennaPattern(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - Orientation& getBeamDirection(); - const Orientation& getBeamDirection() const; - void setBeamDirection(const Orientation &pX); - - float getAzimuthBeamwidth() const; - void setAzimuthBeamwidth(float pX); - - float getReferenceSystem() const; - void setReferenceSystem(float pX); - - short getPadding1() const; - void setPadding1(short pX); - - char getPadding2() const; - void setPadding2(char pX); - - float getEz() const; - void setEz(float pX); - - float getEx() const; - void setEx(float pX); - - float getPhase() const; - void setPhase(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const BeamAntennaPattern& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/BeamData.cpp b/src/dis6/BeamData.cpp deleted file mode 100644 index 578933a6..00000000 --- a/src/dis6/BeamData.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -BeamData::BeamData(): - _beamAzimuthCenter(0.0), - _beamAzimuthSweep(0.0), - _beamElevationCenter(0.0), - _beamElevationSweep(0.0), - _beamSweepSync(0.0) -{ -} - -BeamData::~BeamData() -{ -} - -float BeamData::getBeamAzimuthCenter() const -{ - return _beamAzimuthCenter; -} - -void BeamData::setBeamAzimuthCenter(float pX) -{ - _beamAzimuthCenter = pX; -} - -float BeamData::getBeamAzimuthSweep() const -{ - return _beamAzimuthSweep; -} - -void BeamData::setBeamAzimuthSweep(float pX) -{ - _beamAzimuthSweep = pX; -} - -float BeamData::getBeamElevationCenter() const -{ - return _beamElevationCenter; -} - -void BeamData::setBeamElevationCenter(float pX) -{ - _beamElevationCenter = pX; -} - -float BeamData::getBeamElevationSweep() const -{ - return _beamElevationSweep; -} - -void BeamData::setBeamElevationSweep(float pX) -{ - _beamElevationSweep = pX; -} - -float BeamData::getBeamSweepSync() const -{ - return _beamSweepSync; -} - -void BeamData::setBeamSweepSync(float pX) -{ - _beamSweepSync = pX; -} - -void BeamData::marshal(DataStream& dataStream) const -{ - dataStream << _beamAzimuthCenter; - dataStream << _beamAzimuthSweep; - dataStream << _beamElevationCenter; - dataStream << _beamElevationSweep; - dataStream << _beamSweepSync; -} - -void BeamData::unmarshal(DataStream& dataStream) -{ - dataStream >> _beamAzimuthCenter; - dataStream >> _beamAzimuthSweep; - dataStream >> _beamElevationCenter; - dataStream >> _beamElevationSweep; - dataStream >> _beamSweepSync; -} - - -bool BeamData::operator ==(const BeamData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_beamAzimuthCenter == rhs._beamAzimuthCenter) ) ivarsEqual = false; - if( ! (_beamAzimuthSweep == rhs._beamAzimuthSweep) ) ivarsEqual = false; - if( ! (_beamElevationCenter == rhs._beamElevationCenter) ) ivarsEqual = false; - if( ! (_beamElevationSweep == rhs._beamElevationSweep) ) ivarsEqual = false; - if( ! (_beamSweepSync == rhs._beamSweepSync) ) ivarsEqual = false; - - return ivarsEqual; - } - -int BeamData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _beamAzimuthCenter - marshalSize = marshalSize + 4; // _beamAzimuthSweep - marshalSize = marshalSize + 4; // _beamElevationCenter - marshalSize = marshalSize + 4; // _beamElevationSweep - marshalSize = marshalSize + 4; // _beamSweepSync - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/BeamData.h b/src/dis6/BeamData.h deleted file mode 100644 index 46623b39..00000000 --- a/src/dis6/BeamData.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.39. Specification of the data necessary to describe the scan volume of an emitter. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT BeamData -{ -protected: - /** Specifies the beam azimuth an elevation centers and corresponding half-angles to describe the scan volume */ - float _beamAzimuthCenter; - - /** Specifies the beam azimuth sweep to determine scan volume */ - float _beamAzimuthSweep; - - /** Specifies the beam elevation center to determine scan volume */ - float _beamElevationCenter; - - /** Specifies the beam elevation sweep to determine scan volume */ - float _beamElevationSweep; - - /** allows receiver to synchronize its regenerated scan pattern to that of the emmitter. Specifies the percentage of time a scan is through its pattern from its origion. */ - float _beamSweepSync; - - - public: - BeamData(); - virtual ~BeamData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getBeamAzimuthCenter() const; - void setBeamAzimuthCenter(float pX); - - float getBeamAzimuthSweep() const; - void setBeamAzimuthSweep(float pX); - - float getBeamElevationCenter() const; - void setBeamElevationCenter(float pX); - - float getBeamElevationSweep() const; - void setBeamElevationSweep(float pX); - - float getBeamSweepSync() const; - void setBeamSweepSync(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const BeamData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/BurstDescriptor.cpp b/src/dis6/BurstDescriptor.cpp deleted file mode 100644 index f6ba40fd..00000000 --- a/src/dis6/BurstDescriptor.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include - -using namespace DIS; - - -BurstDescriptor::BurstDescriptor(): - _munition(), - _warhead(0), - _fuse(0), - _quantity(0), - _rate(0) -{ -} - -BurstDescriptor::~BurstDescriptor() -{ -} - -EntityType& BurstDescriptor::getMunition() -{ - return _munition; -} - -const EntityType& BurstDescriptor::getMunition() const -{ - return _munition; -} - -void BurstDescriptor::setMunition(const EntityType &pX) -{ - _munition = pX; -} - -unsigned short BurstDescriptor::getWarhead() const -{ - return _warhead; -} - -void BurstDescriptor::setWarhead(unsigned short pX) -{ - _warhead = pX; -} - -unsigned short BurstDescriptor::getFuse() const -{ - return _fuse; -} - -void BurstDescriptor::setFuse(unsigned short pX) -{ - _fuse = pX; -} - -unsigned short BurstDescriptor::getQuantity() const -{ - return _quantity; -} - -void BurstDescriptor::setQuantity(unsigned short pX) -{ - _quantity = pX; -} - -unsigned short BurstDescriptor::getRate() const -{ - return _rate; -} - -void BurstDescriptor::setRate(unsigned short pX) -{ - _rate = pX; -} - -void BurstDescriptor::marshal(DataStream& dataStream) const -{ - _munition.marshal(dataStream); - dataStream << _warhead; - dataStream << _fuse; - dataStream << _quantity; - dataStream << _rate; -} - -void BurstDescriptor::unmarshal(DataStream& dataStream) -{ - _munition.unmarshal(dataStream); - dataStream >> _warhead; - dataStream >> _fuse; - dataStream >> _quantity; - dataStream >> _rate; -} - - -bool BurstDescriptor::operator ==(const BurstDescriptor& rhs) const - { - bool ivarsEqual = true; - - if( ! (_munition == rhs._munition) ) ivarsEqual = false; - if( ! (_warhead == rhs._warhead) ) ivarsEqual = false; - if( ! (_fuse == rhs._fuse) ) ivarsEqual = false; - if( ! (_quantity == rhs._quantity) ) ivarsEqual = false; - if( ! (_rate == rhs._rate) ) ivarsEqual = false; - - return ivarsEqual; - } - -int BurstDescriptor::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _munition.getMarshalledSize(); // _munition - marshalSize = marshalSize + 2; // _warhead - marshalSize = marshalSize + 2; // _fuse - marshalSize = marshalSize + 2; // _quantity - marshalSize = marshalSize + 2; // _rate - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/BurstDescriptor.h b/src/dis6/BurstDescriptor.h deleted file mode 100644 index ad3bb22d..00000000 --- a/src/dis6/BurstDescriptor.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.2.7. Specifies the type of muntion fired, the type of warhead, the type of fuse, the number of rounds fired, and the rate at which the roudns are fired in rounds per minute. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT BurstDescriptor -{ -protected: - /** What munition was used in the burst */ - EntityType _munition; - - /** type of warhead */ - unsigned short _warhead; - - /** type of fuse used */ - unsigned short _fuse; - - /** how many of the munition were fired */ - unsigned short _quantity; - - /** rate at which the munition was fired */ - unsigned short _rate; - - - public: - BurstDescriptor(); - virtual ~BurstDescriptor(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getMunition(); - const EntityType& getMunition() const; - void setMunition(const EntityType &pX); - - unsigned short getWarhead() const; - void setWarhead(unsigned short pX); - - unsigned short getFuse() const; - void setFuse(unsigned short pX); - - unsigned short getQuantity() const; - void setQuantity(unsigned short pX); - - unsigned short getRate() const; - void setRate(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const BurstDescriptor& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CMakeLists.txt b/src/dis6/CMakeLists.txt index a0e391eb..2fc0a8f1 100644 --- a/src/dis6/CMakeLists.txt +++ b/src/dis6/CMakeLists.txt @@ -1,297 +1,11 @@ add_subdirectory(utils) - -# Create list of all headers -set(dis6_hdr - AcknowledgePdu.h - AcknowledgeReliablePdu.h - AcousticBeamData.h - AcousticBeamFundamentalParameter.h - AcousticEmitter.h - AcousticEmitterSystemData.h - AcousticEmitterSystem.h - ActionRequestPdu.h - ActionRequestReliablePdu.h - ActionResponsePdu.h - ActionResponseReliablePdu.h - AggregateID.h - AggregateMarking.h - AggregateStatePdu.h - AggregateType.h - AngularVelocityVector.h - AntennaLocation.h - ApaData.h - ArealObjectStatePdu.h - ArticulationParameter.h - BeamAntennaPattern.h - BeamData.h - BurstDescriptor.h - ClockTime.h - CollisionElasticPdu.h - CollisionPdu.h - CommentPdu.h - CommentReliablePdu.h - CreateEntityPdu.h - CreateEntityReliablePdu.h - DataPdu.h - DataQueryPdu.h - DataQueryReliablePdu.h - DataReliablePdu.h - DeadReckoningParameter.h - DesignatorPdu.h - DetonationPdu.h - DistributedEmissionsFamilyPdu.h - EightByteChunk.h - ElectromagneticEmissionBeamData.h - ElectromagneticEmissionsPdu.h - ElectromagneticEmissionSystemData.h - EmitterSystem.h - EntityID.h - EntityInformationFamilyPdu.h - EntityManagementFamilyPdu.h - EntityStatePdu.h - EntityStateUpdatePdu.h - EntityType.h - EnvironmentalProcessPdu.h - Environment.h - EventID.h - EventReportPdu.h - EventReportReliablePdu.h - FastEntityStatePdu.h - FirePdu.h - FixedDatum.h - FourByteChunk.h - FundamentalParameterData.h - FundamentalParameterDataIff.h - GridAxisRecord.h - GridAxisRecordRepresentation0.h - GridAxisRecordRepresentation1.h - GridAxisRecordRepresentation2.h - GriddedDataPdu.h - IffAtcNavAidsLayer1Pdu.h - IffAtcNavAidsLayer2Pdu.h - IffFundamentalData.h - IntercomCommunicationsParameters.h - IntercomControlPdu.h - IntercomSignalPdu.h - IsGroupOfPdu.h - IsPartOfPdu.h - LayerHeader.h - LinearObjectStatePdu.h - LinearSegmentParameter.h - LogisticsFamilyPdu.h - LogisticsPdu.h - Marking.h - MinefieldDataPdu.h - MinefieldFamilyPdu.h - MinefieldPduFamily.h - MinefieldQueryPdu.h - MinefieldResponseNackPdu.h - MinefieldStatePdu.h - ModulationType.h - NamedLocation.h - ObjectType.h - Orientation.h - PduContainer.h - Pdu.h - Point.h - PointObjectStatePdu.h - PropulsionSystemData.h - RadioCommunicationsFamilyPdu.h - RadioEntityType.h - ReceiverPdu.h - RecordQueryReliablePdu.h - RecordSet.h - Relationship.h - RemoveEntityPdu.h - RemoveEntityReliablePdu.h - RepairCompletePdu.h - RepairResponsePdu.h - ResupplyCancelPdu.h - ResupplyOfferPdu.h - ResupplyReceivedPdu.h - SeesPdu.h - ServiceRequestPdu.h - SetDataPdu.h - SetDataReliablePdu.h - SetRecordReliablePdu.h - ShaftRPMs.h - SignalPdu.h - SimulationAddress.h - SimulationManagementFamilyPdu.h - SimulationManagementWithReliabilityFamilyPdu.h - SixByteChunk.h - SphericalHarmonicAntennaPattern.h - StartResumePdu.h - StartResumeReliablePdu.h - StopFreezePdu.h - StopFreezeReliablePdu.h - SupplyQuantity.h - symbolic_names.h - SyntheticEnvironmentFamilyPdu.h - SystemID.h - TrackJamTarget.h - TransferControlRequestPdu.h - TransmitterPdu.h - TwoByteChunk.h - UaPdu.h - VariableDatum.h - Vector3Double.h - Vector3Float.h - VectoringNozzleSystemData.h - WarfareFamilyPdu.h -) - -# Create list of all source files -set(dis6_src - AcknowledgePdu.cpp - AcknowledgeReliablePdu.cpp - AcousticBeamData.cpp - AcousticBeamFundamentalParameter.cpp - AcousticEmitter.cpp - AcousticEmitterSystem.cpp - AcousticEmitterSystemData.cpp - ActionRequestPdu.cpp - ActionRequestReliablePdu.cpp - ActionResponsePdu.cpp - ActionResponseReliablePdu.cpp - AggregateID.cpp - AggregateMarking.cpp - AggregateStatePdu.cpp - AggregateType.cpp - AngularVelocityVector.cpp - AntennaLocation.cpp - ApaData.cpp - ArealObjectStatePdu.cpp - ArticulationParameter.cpp - BeamAntennaPattern.cpp - BeamData.cpp - BurstDescriptor.cpp - ClockTime.cpp - CollisionElasticPdu.cpp - CollisionPdu.cpp - CommentPdu.cpp - CommentReliablePdu.cpp - CreateEntityPdu.cpp - CreateEntityReliablePdu.cpp - DataPdu.cpp - DataQueryPdu.cpp - DataQueryReliablePdu.cpp - DataReliablePdu.cpp - DeadReckoningParameter.cpp - DesignatorPdu.cpp - DetonationPdu.cpp - DistributedEmissionsFamilyPdu.cpp - EightByteChunk.cpp - ElectromagneticEmissionBeamData.cpp - ElectromagneticEmissionsPdu.cpp - ElectromagneticEmissionSystemData.cpp - EmitterSystem.cpp - EntityID.cpp - EntityInformationFamilyPdu.cpp - EntityManagementFamilyPdu.cpp - EntityStatePdu.cpp - EntityStateUpdatePdu.cpp - EntityType.cpp - EnvironmentalProcessPdu.cpp - Environment.cpp - EventID.cpp - EventReportPdu.cpp - EventReportReliablePdu.cpp - FastEntityStatePdu.cpp - FirePdu.cpp - FixedDatum.cpp - FourByteChunk.cpp - FundamentalParameterData.cpp - FundamentalParameterDataIff.cpp - GridAxisRecord.cpp - GridAxisRecordRepresentation0.cpp - GridAxisRecordRepresentation1.cpp - GridAxisRecordRepresentation2.cpp - GriddedDataPdu.cpp - IffAtcNavAidsLayer1Pdu.cpp - IffAtcNavAidsLayer2Pdu.cpp - IffFundamentalData.cpp - IntercomCommunicationsParameters.cpp - IntercomControlPdu.cpp - IntercomSignalPdu.cpp - IsGroupOfPdu.cpp - IsPartOfPdu.cpp - LayerHeader.cpp - LinearObjectStatePdu.cpp - LinearSegmentParameter.cpp - LogisticsFamilyPdu.cpp - LogisticsPdu.cpp - Marking.cpp - MinefieldDataPdu.cpp - MinefieldFamilyPdu.cpp - MinefieldPduFamily.cpp - MinefieldQueryPdu.cpp - MinefieldResponseNackPdu.cpp - MinefieldStatePdu.cpp - ModulationType.cpp - NamedLocation.cpp - ObjectType.cpp - Orientation.cpp - PduContainer.cpp - Pdu.cpp - Point.cpp - PointObjectStatePdu.cpp - PropulsionSystemData.cpp - RadioCommunicationsFamilyPdu.cpp - RadioEntityType.cpp - ReceiverPdu.cpp - RecordQueryReliablePdu.cpp - RecordSet.cpp - Relationship.cpp - RemoveEntityPdu.cpp - RemoveEntityReliablePdu.cpp - RepairCompletePdu.cpp - RepairResponsePdu.cpp - ResupplyCancelPdu.cpp - ResupplyOfferPdu.cpp - ResupplyReceivedPdu.cpp - SeesPdu.cpp - ServiceRequestPdu.cpp - SetDataPdu.cpp - SetDataReliablePdu.cpp - SetRecordReliablePdu.cpp - ShaftRPMs.cpp - SignalPdu.cpp - SimulationAddress.cpp - SimulationManagementFamilyPdu.cpp - SimulationManagementWithReliabilityFamilyPdu.cpp - SixByteChunk.cpp - SphericalHarmonicAntennaPattern.cpp - StartResumePdu.cpp - StartResumeReliablePdu.cpp - StopFreezePdu.cpp - StopFreezeReliablePdu.cpp - SupplyQuantity.cpp - SyntheticEnvironmentFamilyPdu.cpp - SystemID.cpp - TrackJamTarget.cpp - TransferControlRequestPdu.cpp - TransmitterPdu.cpp - TwoByteChunk.cpp - UaPdu.cpp - VariableDatum.cpp - Vector3Double.cpp - Vector3Float.cpp - VectoringNozzleSystemData.cpp - WarfareFamilyPdu.cpp -) - -# CMake < 3.16 requires target_sources to be specified as -# absolute paths if not in the same directory as the target -# definition. If cmake_minimum_required is ever changed to -# be >= 16, this line can be removed. -list(TRANSFORM dis6_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") - -include(GenerateExportHeader) -generate_export_header(OpenDIS6) -list(APPEND dis6_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") - -target_sources(OpenDIS6 PRIVATE ${dis6_src}) - -install(FILES ${dis6_hdr} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6) +add_subdirectory(distributed_emissions) +add_subdirectory(entity_information) +add_subdirectory(entity_management) +add_subdirectory(logistics) +add_subdirectory(minefield) +add_subdirectory(radio_communications) +add_subdirectory(simulation_management) +add_subdirectory(simulation_management_with_reliability) +add_subdirectory(synthetic_environment) +add_subdirectory(warfare) diff --git a/src/dis6/ClockTime.cpp b/src/dis6/ClockTime.cpp deleted file mode 100644 index 4ff70909..00000000 --- a/src/dis6/ClockTime.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -ClockTime::ClockTime(): - _hour(0), - _timePastHour(0) -{ -} - -ClockTime::~ClockTime() -{ -} - -int ClockTime::getHour() const -{ - return _hour; -} - -void ClockTime::setHour(int pX) -{ - _hour = pX; -} - -unsigned int ClockTime::getTimePastHour() const -{ - return _timePastHour; -} - -void ClockTime::setTimePastHour(unsigned int pX) -{ - _timePastHour = pX; -} - -void ClockTime::marshal(DataStream& dataStream) const -{ - dataStream << _hour; - dataStream << _timePastHour; -} - -void ClockTime::unmarshal(DataStream& dataStream) -{ - dataStream >> _hour; - dataStream >> _timePastHour; -} - - -bool ClockTime::operator ==(const ClockTime& rhs) const - { - bool ivarsEqual = true; - - if( ! (_hour == rhs._hour) ) ivarsEqual = false; - if( ! (_timePastHour == rhs._timePastHour) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ClockTime::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _hour - marshalSize = marshalSize + 4; // _timePastHour - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ClockTime.h b/src/dis6/ClockTime.h deleted file mode 100644 index d574058c..00000000 --- a/src/dis6/ClockTime.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.8. Time measurements that exceed one hour. Hours is the number of hours since January 1, 1970, UTC - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ClockTime -{ -protected: - /** Hours in UTC */ - int _hour; - - /** Time past the hour */ - unsigned int _timePastHour; - - - public: - ClockTime(); - virtual ~ClockTime(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - int getHour() const; - void setHour(int pX); - - unsigned int getTimePastHour() const; - void setTimePastHour(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ClockTime& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CollisionElasticPdu.cpp b/src/dis6/CollisionElasticPdu.cpp deleted file mode 100644 index c23c1165..00000000 --- a/src/dis6/CollisionElasticPdu.cpp +++ /dev/null @@ -1,329 +0,0 @@ -#include - -using namespace DIS; - - -CollisionElasticPdu::CollisionElasticPdu() : EntityInformationFamilyPdu(), - _issuingEntityID(), - _collidingEntityID(), - _collisionEventID(), - _pad(0), - _contactVelocity(), - _mass(0.0), - _location(), - _collisionResultXX(0.0), - _collisionResultXY(0.0), - _collisionResultXZ(0.0), - _collisionResultYY(0.0), - _collisionResultYZ(0.0), - _collisionResultZZ(0.0), - _unitSurfaceNormal(), - _coefficientOfRestitution(0.0) -{ - setPduType( 66 ); - setProtocolFamily( 1 ); -} - -CollisionElasticPdu::~CollisionElasticPdu() -{ -} - -EntityID& CollisionElasticPdu::getIssuingEntityID() -{ - return _issuingEntityID; -} - -const EntityID& CollisionElasticPdu::getIssuingEntityID() const -{ - return _issuingEntityID; -} - -void CollisionElasticPdu::setIssuingEntityID(const EntityID &pX) -{ - _issuingEntityID = pX; -} - -EntityID& CollisionElasticPdu::getCollidingEntityID() -{ - return _collidingEntityID; -} - -const EntityID& CollisionElasticPdu::getCollidingEntityID() const -{ - return _collidingEntityID; -} - -void CollisionElasticPdu::setCollidingEntityID(const EntityID &pX) -{ - _collidingEntityID = pX; -} - -EventID& CollisionElasticPdu::getCollisionEventID() -{ - return _collisionEventID; -} - -const EventID& CollisionElasticPdu::getCollisionEventID() const -{ - return _collisionEventID; -} - -void CollisionElasticPdu::setCollisionEventID(const EventID &pX) -{ - _collisionEventID = pX; -} - -short CollisionElasticPdu::getPad() const -{ - return _pad; -} - -void CollisionElasticPdu::setPad(short pX) -{ - _pad = pX; -} - -Vector3Float& CollisionElasticPdu::getContactVelocity() -{ - return _contactVelocity; -} - -const Vector3Float& CollisionElasticPdu::getContactVelocity() const -{ - return _contactVelocity; -} - -void CollisionElasticPdu::setContactVelocity(const Vector3Float &pX) -{ - _contactVelocity = pX; -} - -float CollisionElasticPdu::getMass() const -{ - return _mass; -} - -void CollisionElasticPdu::setMass(float pX) -{ - _mass = pX; -} - -Vector3Float& CollisionElasticPdu::getLocation() -{ - return _location; -} - -const Vector3Float& CollisionElasticPdu::getLocation() const -{ - return _location; -} - -void CollisionElasticPdu::setLocation(const Vector3Float &pX) -{ - _location = pX; -} - -float CollisionElasticPdu::getCollisionResultXX() const -{ - return _collisionResultXX; -} - -void CollisionElasticPdu::setCollisionResultXX(float pX) -{ - _collisionResultXX = pX; -} - -float CollisionElasticPdu::getCollisionResultXY() const -{ - return _collisionResultXY; -} - -void CollisionElasticPdu::setCollisionResultXY(float pX) -{ - _collisionResultXY = pX; -} - -float CollisionElasticPdu::getCollisionResultXZ() const -{ - return _collisionResultXZ; -} - -void CollisionElasticPdu::setCollisionResultXZ(float pX) -{ - _collisionResultXZ = pX; -} - -float CollisionElasticPdu::getCollisionResultYY() const -{ - return _collisionResultYY; -} - -void CollisionElasticPdu::setCollisionResultYY(float pX) -{ - _collisionResultYY = pX; -} - -float CollisionElasticPdu::getCollisionResultYZ() const -{ - return _collisionResultYZ; -} - -void CollisionElasticPdu::setCollisionResultYZ(float pX) -{ - _collisionResultYZ = pX; -} - -float CollisionElasticPdu::getCollisionResultZZ() const -{ - return _collisionResultZZ; -} - -void CollisionElasticPdu::setCollisionResultZZ(float pX) -{ - _collisionResultZZ = pX; -} - -Vector3Float& CollisionElasticPdu::getUnitSurfaceNormal() -{ - return _unitSurfaceNormal; -} - -const Vector3Float& CollisionElasticPdu::getUnitSurfaceNormal() const -{ - return _unitSurfaceNormal; -} - -void CollisionElasticPdu::setUnitSurfaceNormal(const Vector3Float &pX) -{ - _unitSurfaceNormal = pX; -} - -float CollisionElasticPdu::getCoefficientOfRestitution() const -{ - return _coefficientOfRestitution; -} - -void CollisionElasticPdu::setCoefficientOfRestitution(float pX) -{ - _coefficientOfRestitution = pX; -} - -void CollisionElasticPdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _issuingEntityID.marshal(dataStream); - _collidingEntityID.marshal(dataStream); - _collisionEventID.marshal(dataStream); - dataStream << _pad; - _contactVelocity.marshal(dataStream); - dataStream << _mass; - _location.marshal(dataStream); - dataStream << _collisionResultXX; - dataStream << _collisionResultXY; - dataStream << _collisionResultXZ; - dataStream << _collisionResultYY; - dataStream << _collisionResultYZ; - dataStream << _collisionResultZZ; - _unitSurfaceNormal.marshal(dataStream); - dataStream << _coefficientOfRestitution; -} - -void CollisionElasticPdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _issuingEntityID.unmarshal(dataStream); - _collidingEntityID.unmarshal(dataStream); - _collisionEventID.unmarshal(dataStream); - dataStream >> _pad; - _contactVelocity.unmarshal(dataStream); - dataStream >> _mass; - _location.unmarshal(dataStream); - dataStream >> _collisionResultXX; - dataStream >> _collisionResultXY; - dataStream >> _collisionResultXZ; - dataStream >> _collisionResultYY; - dataStream >> _collisionResultYZ; - dataStream >> _collisionResultZZ; - _unitSurfaceNormal.unmarshal(dataStream); - dataStream >> _coefficientOfRestitution; -} - - -bool CollisionElasticPdu::operator ==(const CollisionElasticPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_issuingEntityID == rhs._issuingEntityID) ) ivarsEqual = false; - if( ! (_collidingEntityID == rhs._collidingEntityID) ) ivarsEqual = false; - if( ! (_collisionEventID == rhs._collisionEventID) ) ivarsEqual = false; - if( ! (_pad == rhs._pad) ) ivarsEqual = false; - if( ! (_contactVelocity == rhs._contactVelocity) ) ivarsEqual = false; - if( ! (_mass == rhs._mass) ) ivarsEqual = false; - if( ! (_location == rhs._location) ) ivarsEqual = false; - if( ! (_collisionResultXX == rhs._collisionResultXX) ) ivarsEqual = false; - if( ! (_collisionResultXY == rhs._collisionResultXY) ) ivarsEqual = false; - if( ! (_collisionResultXZ == rhs._collisionResultXZ) ) ivarsEqual = false; - if( ! (_collisionResultYY == rhs._collisionResultYY) ) ivarsEqual = false; - if( ! (_collisionResultYZ == rhs._collisionResultYZ) ) ivarsEqual = false; - if( ! (_collisionResultZZ == rhs._collisionResultZZ) ) ivarsEqual = false; - if( ! (_unitSurfaceNormal == rhs._unitSurfaceNormal) ) ivarsEqual = false; - if( ! (_coefficientOfRestitution == rhs._coefficientOfRestitution) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CollisionElasticPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _issuingEntityID.getMarshalledSize(); // _issuingEntityID - marshalSize = marshalSize + _collidingEntityID.getMarshalledSize(); // _collidingEntityID - marshalSize = marshalSize + _collisionEventID.getMarshalledSize(); // _collisionEventID - marshalSize = marshalSize + 2; // _pad - marshalSize = marshalSize + _contactVelocity.getMarshalledSize(); // _contactVelocity - marshalSize = marshalSize + 4; // _mass - marshalSize = marshalSize + _location.getMarshalledSize(); // _location - marshalSize = marshalSize + 4; // _collisionResultXX - marshalSize = marshalSize + 4; // _collisionResultXY - marshalSize = marshalSize + 4; // _collisionResultXZ - marshalSize = marshalSize + 4; // _collisionResultYY - marshalSize = marshalSize + 4; // _collisionResultYZ - marshalSize = marshalSize + 4; // _collisionResultZZ - marshalSize = marshalSize + _unitSurfaceNormal.getMarshalledSize(); // _unitSurfaceNormal - marshalSize = marshalSize + 4; // _coefficientOfRestitution - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CollisionElasticPdu.h b/src/dis6/CollisionElasticPdu.h deleted file mode 100644 index 20f1eea3..00000000 --- a/src/dis6/CollisionElasticPdu.h +++ /dev/null @@ -1,165 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// 5.3.3.3. Information about elastic collisions in a DIS exercise shall be communicated using a Collision-Elastic PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT CollisionElasticPdu : public EntityInformationFamilyPdu -{ -protected: - /** ID of the entity that issued the collision PDU */ - EntityID _issuingEntityID; - - /** ID of entity that has collided with the issuing entity ID */ - EntityID _collidingEntityID; - - /** ID of event */ - EventID _collisionEventID; - - /** some padding */ - short _pad; - - /** velocity at collision */ - Vector3Float _contactVelocity; - - /** mass of issuing entity */ - float _mass; - - /** Location with respect to entity the issuing entity collided with */ - Vector3Float _location; - - /** tensor values */ - float _collisionResultXX; - - /** tensor values */ - float _collisionResultXY; - - /** tensor values */ - float _collisionResultXZ; - - /** tensor values */ - float _collisionResultYY; - - /** tensor values */ - float _collisionResultYZ; - - /** tensor values */ - float _collisionResultZZ; - - /** This record shall represent the normal vector to the surface at the point of collision detection. The surface normal shall be represented in world coordinates. */ - Vector3Float _unitSurfaceNormal; - - /** This field shall represent the degree to which energy is conserved in a collision */ - float _coefficientOfRestitution; - - - public: - CollisionElasticPdu(); - virtual ~CollisionElasticPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getIssuingEntityID(); - const EntityID& getIssuingEntityID() const; - void setIssuingEntityID(const EntityID &pX); - - EntityID& getCollidingEntityID(); - const EntityID& getCollidingEntityID() const; - void setCollidingEntityID(const EntityID &pX); - - EventID& getCollisionEventID(); - const EventID& getCollisionEventID() const; - void setCollisionEventID(const EventID &pX); - - short getPad() const; - void setPad(short pX); - - Vector3Float& getContactVelocity(); - const Vector3Float& getContactVelocity() const; - void setContactVelocity(const Vector3Float &pX); - - float getMass() const; - void setMass(float pX); - - Vector3Float& getLocation(); - const Vector3Float& getLocation() const; - void setLocation(const Vector3Float &pX); - - float getCollisionResultXX() const; - void setCollisionResultXX(float pX); - - float getCollisionResultXY() const; - void setCollisionResultXY(float pX); - - float getCollisionResultXZ() const; - void setCollisionResultXZ(float pX); - - float getCollisionResultYY() const; - void setCollisionResultYY(float pX); - - float getCollisionResultYZ() const; - void setCollisionResultYZ(float pX); - - float getCollisionResultZZ() const; - void setCollisionResultZZ(float pX); - - Vector3Float& getUnitSurfaceNormal(); - const Vector3Float& getUnitSurfaceNormal() const; - void setUnitSurfaceNormal(const Vector3Float &pX); - - float getCoefficientOfRestitution() const; - void setCoefficientOfRestitution(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CollisionElasticPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CollisionPdu.cpp b/src/dis6/CollisionPdu.cpp deleted file mode 100644 index ad42ed13..00000000 --- a/src/dis6/CollisionPdu.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include - -using namespace DIS; - - -CollisionPdu::CollisionPdu() : EntityInformationFamilyPdu(), - _issuingEntityID(), - _collidingEntityID(), - _eventID(), - _collisionType(0), - _pad(0), - _velocity(), - _mass(0.0), - _location() -{ - setPduType( 4 ); - setProtocolFamily( 1 ); -} - -CollisionPdu::~CollisionPdu() -{ -} - -EntityID& CollisionPdu::getIssuingEntityID() -{ - return _issuingEntityID; -} - -const EntityID& CollisionPdu::getIssuingEntityID() const -{ - return _issuingEntityID; -} - -void CollisionPdu::setIssuingEntityID(const EntityID &pX) -{ - _issuingEntityID = pX; -} - -EntityID& CollisionPdu::getCollidingEntityID() -{ - return _collidingEntityID; -} - -const EntityID& CollisionPdu::getCollidingEntityID() const -{ - return _collidingEntityID; -} - -void CollisionPdu::setCollidingEntityID(const EntityID &pX) -{ - _collidingEntityID = pX; -} - -EventID& CollisionPdu::getEventID() -{ - return _eventID; -} - -const EventID& CollisionPdu::getEventID() const -{ - return _eventID; -} - -void CollisionPdu::setEventID(const EventID &pX) -{ - _eventID = pX; -} - -unsigned char CollisionPdu::getCollisionType() const -{ - return _collisionType; -} - -void CollisionPdu::setCollisionType(unsigned char pX) -{ - _collisionType = pX; -} - -char CollisionPdu::getPad() const -{ - return _pad; -} - -void CollisionPdu::setPad(char pX) -{ - _pad = pX; -} - -Vector3Float& CollisionPdu::getVelocity() -{ - return _velocity; -} - -const Vector3Float& CollisionPdu::getVelocity() const -{ - return _velocity; -} - -void CollisionPdu::setVelocity(const Vector3Float &pX) -{ - _velocity = pX; -} - -float CollisionPdu::getMass() const -{ - return _mass; -} - -void CollisionPdu::setMass(float pX) -{ - _mass = pX; -} - -Vector3Float& CollisionPdu::getLocation() -{ - return _location; -} - -const Vector3Float& CollisionPdu::getLocation() const -{ - return _location; -} - -void CollisionPdu::setLocation(const Vector3Float &pX) -{ - _location = pX; -} - -void CollisionPdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _issuingEntityID.marshal(dataStream); - _collidingEntityID.marshal(dataStream); - _eventID.marshal(dataStream); - dataStream << _collisionType; - dataStream << _pad; - _velocity.marshal(dataStream); - dataStream << _mass; - _location.marshal(dataStream); -} - -void CollisionPdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _issuingEntityID.unmarshal(dataStream); - _collidingEntityID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - dataStream >> _collisionType; - dataStream >> _pad; - _velocity.unmarshal(dataStream); - dataStream >> _mass; - _location.unmarshal(dataStream); -} - - -bool CollisionPdu::operator ==(const CollisionPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_issuingEntityID == rhs._issuingEntityID) ) ivarsEqual = false; - if( ! (_collidingEntityID == rhs._collidingEntityID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_collisionType == rhs._collisionType) ) ivarsEqual = false; - if( ! (_pad == rhs._pad) ) ivarsEqual = false; - if( ! (_velocity == rhs._velocity) ) ivarsEqual = false; - if( ! (_mass == rhs._mass) ) ivarsEqual = false; - if( ! (_location == rhs._location) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CollisionPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _issuingEntityID.getMarshalledSize(); // _issuingEntityID - marshalSize = marshalSize + _collidingEntityID.getMarshalledSize(); // _collidingEntityID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + 1; // _collisionType - marshalSize = marshalSize + 1; // _pad - marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity - marshalSize = marshalSize + 4; // _mass - marshalSize = marshalSize + _location.getMarshalledSize(); // _location - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CollisionPdu.h b/src/dis6/CollisionPdu.h deleted file mode 100644 index fbcf91e1..00000000 --- a/src/dis6/CollisionPdu.h +++ /dev/null @@ -1,121 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.3.2. Information about a collision. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT CollisionPdu : public EntityInformationFamilyPdu -{ -protected: - /** ID of the entity that issued the collision PDU */ - EntityID _issuingEntityID; - - /** ID of entity that has collided with the issuing entity ID */ - EntityID _collidingEntityID; - - /** ID of event */ - EventID _eventID; - - /** ID of event */ - unsigned char _collisionType; - - /** some padding */ - char _pad; - - /** velocity at collision */ - Vector3Float _velocity; - - /** mass of issuing entity */ - float _mass; - - /** Location with respect to entity the issuing entity collided with */ - Vector3Float _location; - - - public: - CollisionPdu(); - virtual ~CollisionPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getIssuingEntityID(); - const EntityID& getIssuingEntityID() const; - void setIssuingEntityID(const EntityID &pX); - - EntityID& getCollidingEntityID(); - const EntityID& getCollidingEntityID() const; - void setCollidingEntityID(const EntityID &pX); - - EventID& getEventID(); - const EventID& getEventID() const; - void setEventID(const EventID &pX); - - unsigned char getCollisionType() const; - void setCollisionType(unsigned char pX); - - char getPad() const; - void setPad(char pX); - - Vector3Float& getVelocity(); - const Vector3Float& getVelocity() const; - void setVelocity(const Vector3Float &pX); - - float getMass() const; - void setMass(float pX); - - Vector3Float& getLocation(); - const Vector3Float& getLocation() const; - void setLocation(const Vector3Float &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CollisionPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CommentPdu.cpp b/src/dis6/CommentPdu.cpp deleted file mode 100644 index c2b65de7..00000000 --- a/src/dis6/CommentPdu.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include - -using namespace DIS; - - -CommentPdu::CommentPdu() : SimulationManagementFamilyPdu(), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 22 ); -} - -CommentPdu::~CommentPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int CommentPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int CommentPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& CommentPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& CommentPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void CommentPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& CommentPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& CommentPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void CommentPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void CommentPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void CommentPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool CommentPdu::operator ==(const CommentPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int CommentPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CommentPdu.h b/src/dis6/CommentPdu.h deleted file mode 100644 index 88a71323..00000000 --- a/src/dis6/CommentPdu.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.12. Arbitrary messages can be entered into the data stream via use of this PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT CommentPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - CommentPdu(); - virtual ~CommentPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CommentPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CommentReliablePdu.cpp b/src/dis6/CommentReliablePdu.cpp deleted file mode 100644 index 9ac41cae..00000000 --- a/src/dis6/CommentReliablePdu.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include - -using namespace DIS; - - -CommentReliablePdu::CommentReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 62 ); -} - -CommentReliablePdu::~CommentReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned int CommentReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int CommentReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& CommentReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& CommentReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void CommentReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& CommentReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& CommentReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void CommentReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void CommentReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void CommentReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool CommentReliablePdu::operator ==(const CommentReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int CommentReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CommentReliablePdu.h b/src/dis6/CommentReliablePdu.h deleted file mode 100644 index 99f9dd95..00000000 --- a/src/dis6/CommentReliablePdu.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.12: Arbitrary messages. Only reliable this time. Neds manual intervention to fix padding in variable datums. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT CommentReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - CommentReliablePdu(); - virtual ~CommentReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CommentReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CreateEntityPdu.cpp b/src/dis6/CreateEntityPdu.cpp deleted file mode 100644 index e93f9193..00000000 --- a/src/dis6/CreateEntityPdu.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include - -using namespace DIS; - - -CreateEntityPdu::CreateEntityPdu() : SimulationManagementFamilyPdu(), - _requestID(0) -{ - setPduType( 11 ); -} - -CreateEntityPdu::~CreateEntityPdu() -{ -} - -unsigned int CreateEntityPdu::getRequestID() const -{ - return _requestID; -} - -void CreateEntityPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void CreateEntityPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; -} - -void CreateEntityPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; -} - - -bool CreateEntityPdu::operator ==(const CreateEntityPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CreateEntityPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CreateEntityPdu.h b/src/dis6/CreateEntityPdu.h deleted file mode 100644 index 5b9d1bb7..00000000 --- a/src/dis6/CreateEntityPdu.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.1. Create a new entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT CreateEntityPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for the request */ - unsigned int _requestID; - - - public: - CreateEntityPdu(); - virtual ~CreateEntityPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CreateEntityPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CreateEntityReliablePdu.cpp b/src/dis6/CreateEntityReliablePdu.cpp deleted file mode 100644 index 59f97e84..00000000 --- a/src/dis6/CreateEntityReliablePdu.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include - -using namespace DIS; - - -CreateEntityReliablePdu::CreateEntityReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0) -{ - setPduType( 51 ); -} - -CreateEntityReliablePdu::~CreateEntityReliablePdu() -{ -} - -unsigned char CreateEntityReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void CreateEntityReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short CreateEntityReliablePdu::getPad1() const -{ - return _pad1; -} - -void CreateEntityReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char CreateEntityReliablePdu::getPad2() const -{ - return _pad2; -} - -void CreateEntityReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int CreateEntityReliablePdu::getRequestID() const -{ - return _requestID; -} - -void CreateEntityReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void CreateEntityReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; -} - -void CreateEntityReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; -} - - -bool CreateEntityReliablePdu::operator ==(const CreateEntityReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CreateEntityReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/CreateEntityReliablePdu.h b/src/dis6/CreateEntityReliablePdu.h deleted file mode 100644 index fc10141d..00000000 --- a/src/dis6/CreateEntityReliablePdu.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.1: creation of an entity , reliable. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT CreateEntityReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Request ID */ - unsigned int _requestID; - - - public: - CreateEntityReliablePdu(); - virtual ~CreateEntityReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CreateEntityReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DataPdu.cpp b/src/dis6/DataPdu.cpp deleted file mode 100644 index a4660e12..00000000 --- a/src/dis6/DataPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -DataPdu::DataPdu() : SimulationManagementFamilyPdu(), - _requestID(0), - _padding1(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 20 ); -} - -DataPdu::~DataPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int DataPdu::getRequestID() const -{ - return _requestID; -} - -void DataPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int DataPdu::getPadding1() const -{ - return _padding1; -} - -void DataPdu::setPadding1(unsigned int pX) -{ - _padding1 = pX; -} - -unsigned int DataPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int DataPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& DataPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& DataPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void DataPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& DataPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& DataPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void DataPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void DataPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _padding1; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void DataPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _padding1; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool DataPdu::operator ==(const DataPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _padding1 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DataPdu.h b/src/dis6/DataPdu.h deleted file mode 100644 index f9496f93..00000000 --- a/src/dis6/DataPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.10. Information issued in response to a data query pdu or a set data pdu is communicated using a data pdu. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT DataPdu : public SimulationManagementFamilyPdu -{ -protected: - /** ID of request */ - unsigned int _requestID; - - /** padding */ - unsigned int _padding1; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - DataPdu(); - virtual ~DataPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getPadding1() const; - void setPadding1(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DataQueryPdu.cpp b/src/dis6/DataQueryPdu.cpp deleted file mode 100644 index 1e9494f1..00000000 --- a/src/dis6/DataQueryPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -DataQueryPdu::DataQueryPdu() : SimulationManagementFamilyPdu(), - _requestID(0), - _timeInterval(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 18 ); -} - -DataQueryPdu::~DataQueryPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int DataQueryPdu::getRequestID() const -{ - return _requestID; -} - -void DataQueryPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int DataQueryPdu::getTimeInterval() const -{ - return _timeInterval; -} - -void DataQueryPdu::setTimeInterval(unsigned int pX) -{ - _timeInterval = pX; -} - -unsigned int DataQueryPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int DataQueryPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& DataQueryPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& DataQueryPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void DataQueryPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& DataQueryPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& DataQueryPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void DataQueryPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void DataQueryPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _timeInterval; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void DataQueryPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _timeInterval; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool DataQueryPdu::operator ==(const DataQueryPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_timeInterval == rhs._timeInterval) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataQueryPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _timeInterval - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DataQueryPdu.h b/src/dis6/DataQueryPdu.h deleted file mode 100644 index 766953c4..00000000 --- a/src/dis6/DataQueryPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.8. Request for data from an entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT DataQueryPdu : public SimulationManagementFamilyPdu -{ -protected: - /** ID of request */ - unsigned int _requestID; - - /** time issues between issues of Data PDUs. Zero means send once only. */ - unsigned int _timeInterval; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - DataQueryPdu(); - virtual ~DataQueryPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getTimeInterval() const; - void setTimeInterval(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataQueryPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DataQueryReliablePdu.cpp b/src/dis6/DataQueryReliablePdu.cpp deleted file mode 100644 index a83aa79b..00000000 --- a/src/dis6/DataQueryReliablePdu.cpp +++ /dev/null @@ -1,254 +0,0 @@ -#include - -using namespace DIS; - - -DataQueryReliablePdu::DataQueryReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0), - _timeInterval(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 58 ); -} - -DataQueryReliablePdu::~DataQueryReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned char DataQueryReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void DataQueryReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short DataQueryReliablePdu::getPad1() const -{ - return _pad1; -} - -void DataQueryReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char DataQueryReliablePdu::getPad2() const -{ - return _pad2; -} - -void DataQueryReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int DataQueryReliablePdu::getRequestID() const -{ - return _requestID; -} - -void DataQueryReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int DataQueryReliablePdu::getTimeInterval() const -{ - return _timeInterval; -} - -void DataQueryReliablePdu::setTimeInterval(unsigned int pX) -{ - _timeInterval = pX; -} - -unsigned int DataQueryReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int DataQueryReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& DataQueryReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& DataQueryReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void DataQueryReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& DataQueryReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& DataQueryReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void DataQueryReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void DataQueryReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; - dataStream << _timeInterval; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void DataQueryReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; - dataStream >> _timeInterval; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool DataQueryReliablePdu::operator ==(const DataQueryReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_timeInterval == rhs._timeInterval) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataQueryReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _timeInterval - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DataQueryReliablePdu.h b/src/dis6/DataQueryReliablePdu.h deleted file mode 100644 index d58623f4..00000000 --- a/src/dis6/DataQueryReliablePdu.h +++ /dev/null @@ -1,120 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.8: request for data from an entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT DataQueryReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** request ID */ - unsigned int _requestID; - - /** time interval between issuing data query PDUs */ - unsigned int _timeInterval; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - DataQueryReliablePdu(); - virtual ~DataQueryReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getTimeInterval() const; - void setTimeInterval(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataQueryReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DataReliablePdu.cpp b/src/dis6/DataReliablePdu.cpp deleted file mode 100644 index 06dbc00e..00000000 --- a/src/dis6/DataReliablePdu.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include - -using namespace DIS; - - -DataReliablePdu::DataReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requestID(0), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 60 ); -} - -DataReliablePdu::~DataReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned int DataReliablePdu::getRequestID() const -{ - return _requestID; -} - -void DataReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned char DataReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void DataReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short DataReliablePdu::getPad1() const -{ - return _pad1; -} - -void DataReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char DataReliablePdu::getPad2() const -{ - return _pad2; -} - -void DataReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int DataReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int DataReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& DataReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& DataReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void DataReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& DataReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& DataReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void DataReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void DataReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void DataReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool DataReliablePdu::operator ==(const DataReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DataReliablePdu.h b/src/dis6/DataReliablePdu.h deleted file mode 100644 index e0787314..00000000 --- a/src/dis6/DataReliablePdu.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.10: issued in response to a data query R or set dataR pdu. Needs manual intervention to fix padding on variable datums. UNFINSIHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT DataReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** Request ID */ - unsigned int _requestID; - - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - DataReliablePdu(); - virtual ~DataReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DeadReckoningParameter.cpp b/src/dis6/DeadReckoningParameter.cpp deleted file mode 100644 index fbf89020..00000000 --- a/src/dis6/DeadReckoningParameter.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include - -using namespace DIS; - - -DeadReckoningParameter::DeadReckoningParameter(): - _deadReckoningAlgorithm(0), - _entityLinearAcceleration(), - _entityAngularVelocity() -{ - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 15; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - -} - -DeadReckoningParameter::~DeadReckoningParameter() -{ -} - -unsigned char DeadReckoningParameter::getDeadReckoningAlgorithm() const -{ - return _deadReckoningAlgorithm; -} - -void DeadReckoningParameter::setDeadReckoningAlgorithm(unsigned char pX) -{ - _deadReckoningAlgorithm = pX; -} - -char* DeadReckoningParameter::getOtherParameters() -{ - return _otherParameters; -} - -const char* DeadReckoningParameter::getOtherParameters() const -{ - return _otherParameters; -} - -void DeadReckoningParameter::setOtherParameters(const char* x) -{ - for(int i = 0; i < 15; i++) - { - _otherParameters[i] = x[i]; - } -} - -Vector3Float& DeadReckoningParameter::getEntityLinearAcceleration() -{ - return _entityLinearAcceleration; -} - -const Vector3Float& DeadReckoningParameter::getEntityLinearAcceleration() const -{ - return _entityLinearAcceleration; -} - -void DeadReckoningParameter::setEntityLinearAcceleration(const Vector3Float &pX) -{ - _entityLinearAcceleration = pX; -} - -Vector3Float& DeadReckoningParameter::getEntityAngularVelocity() -{ - return _entityAngularVelocity; -} - -const Vector3Float& DeadReckoningParameter::getEntityAngularVelocity() const -{ - return _entityAngularVelocity; -} - -void DeadReckoningParameter::setEntityAngularVelocity(const Vector3Float &pX) -{ - _entityAngularVelocity = pX; -} - -void DeadReckoningParameter::marshal(DataStream& dataStream) const -{ - dataStream << _deadReckoningAlgorithm; - - for(size_t idx = 0; idx < 15; idx++) - { - dataStream << _otherParameters[idx]; - } - - _entityLinearAcceleration.marshal(dataStream); - _entityAngularVelocity.marshal(dataStream); -} - -void DeadReckoningParameter::unmarshal(DataStream& dataStream) -{ - dataStream >> _deadReckoningAlgorithm; - - for(size_t idx = 0; idx < 15; idx++) - { - dataStream >> _otherParameters[idx]; - } - - _entityLinearAcceleration.unmarshal(dataStream); - _entityAngularVelocity.unmarshal(dataStream); -} - - -bool DeadReckoningParameter::operator ==(const DeadReckoningParameter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 15; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - if( ! (_entityLinearAcceleration == rhs._entityLinearAcceleration) ) ivarsEqual = false; - if( ! (_entityAngularVelocity == rhs._entityAngularVelocity) ) ivarsEqual = false; - - return ivarsEqual; - } - -int DeadReckoningParameter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _deadReckoningAlgorithm - marshalSize = marshalSize + 15 * 1; // _otherParameters - marshalSize = marshalSize + _entityLinearAcceleration.getMarshalledSize(); // _entityLinearAcceleration - marshalSize = marshalSize + _entityAngularVelocity.getMarshalledSize(); // _entityAngularVelocity - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DeadReckoningParameter.h b/src/dis6/DeadReckoningParameter.h deleted file mode 100644 index 379d4462..00000000 --- a/src/dis6/DeadReckoningParameter.h +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// represents values used in dead reckoning algorithms - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT DeadReckoningParameter -{ -protected: - /** enumeration of what dead reckoning algorighm to use */ - unsigned char _deadReckoningAlgorithm; - - /** other parameters to use in the dead reckoning algorithm */ - char _otherParameters[15]; - - /** Linear acceleration of the entity */ - Vector3Float _entityLinearAcceleration; - - /** angular velocity of the entity */ - Vector3Float _entityAngularVelocity; - - - public: - DeadReckoningParameter(); - virtual ~DeadReckoningParameter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getDeadReckoningAlgorithm() const; - void setDeadReckoningAlgorithm(unsigned char pX); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - Vector3Float& getEntityLinearAcceleration(); - const Vector3Float& getEntityLinearAcceleration() const; - void setEntityLinearAcceleration(const Vector3Float &pX); - - Vector3Float& getEntityAngularVelocity(); - const Vector3Float& getEntityAngularVelocity() const; - void setEntityAngularVelocity(const Vector3Float &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DeadReckoningParameter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DesignatorPdu.cpp b/src/dis6/DesignatorPdu.cpp deleted file mode 100644 index 07d2d667..00000000 --- a/src/dis6/DesignatorPdu.cpp +++ /dev/null @@ -1,278 +0,0 @@ -#include - -using namespace DIS; - - -DesignatorPdu::DesignatorPdu() : DistributedEmissionsFamilyPdu(), - _designatingEntityID(), - _codeName(0), - _designatedEntityID(), - _designatorCode(0), - _designatorPower(0.0), - _designatorWavelength(0.0), - _designatorSpotWrtDesignated(), - _designatorSpotLocation(), - _deadReckoningAlgorithm(0), - _padding1(0), - _padding2(0), - _entityLinearAcceleration() -{ - setPduType( 24 ); -} - -DesignatorPdu::~DesignatorPdu() -{ -} - -EntityID& DesignatorPdu::getDesignatingEntityID() -{ - return _designatingEntityID; -} - -const EntityID& DesignatorPdu::getDesignatingEntityID() const -{ - return _designatingEntityID; -} - -void DesignatorPdu::setDesignatingEntityID(const EntityID &pX) -{ - _designatingEntityID = pX; -} - -unsigned short DesignatorPdu::getCodeName() const -{ - return _codeName; -} - -void DesignatorPdu::setCodeName(unsigned short pX) -{ - _codeName = pX; -} - -EntityID& DesignatorPdu::getDesignatedEntityID() -{ - return _designatedEntityID; -} - -const EntityID& DesignatorPdu::getDesignatedEntityID() const -{ - return _designatedEntityID; -} - -void DesignatorPdu::setDesignatedEntityID(const EntityID &pX) -{ - _designatedEntityID = pX; -} - -unsigned short DesignatorPdu::getDesignatorCode() const -{ - return _designatorCode; -} - -void DesignatorPdu::setDesignatorCode(unsigned short pX) -{ - _designatorCode = pX; -} - -float DesignatorPdu::getDesignatorPower() const -{ - return _designatorPower; -} - -void DesignatorPdu::setDesignatorPower(float pX) -{ - _designatorPower = pX; -} - -float DesignatorPdu::getDesignatorWavelength() const -{ - return _designatorWavelength; -} - -void DesignatorPdu::setDesignatorWavelength(float pX) -{ - _designatorWavelength = pX; -} - -Vector3Float& DesignatorPdu::getDesignatorSpotWrtDesignated() -{ - return _designatorSpotWrtDesignated; -} - -const Vector3Float& DesignatorPdu::getDesignatorSpotWrtDesignated() const -{ - return _designatorSpotWrtDesignated; -} - -void DesignatorPdu::setDesignatorSpotWrtDesignated(const Vector3Float &pX) -{ - _designatorSpotWrtDesignated = pX; -} - -Vector3Double& DesignatorPdu::getDesignatorSpotLocation() -{ - return _designatorSpotLocation; -} - -const Vector3Double& DesignatorPdu::getDesignatorSpotLocation() const -{ - return _designatorSpotLocation; -} - -void DesignatorPdu::setDesignatorSpotLocation(const Vector3Double &pX) -{ - _designatorSpotLocation = pX; -} - -char DesignatorPdu::getDeadReckoningAlgorithm() const -{ - return _deadReckoningAlgorithm; -} - -void DesignatorPdu::setDeadReckoningAlgorithm(char pX) -{ - _deadReckoningAlgorithm = pX; -} - -unsigned short DesignatorPdu::getPadding1() const -{ - return _padding1; -} - -void DesignatorPdu::setPadding1(unsigned short pX) -{ - _padding1 = pX; -} - -char DesignatorPdu::getPadding2() const -{ - return _padding2; -} - -void DesignatorPdu::setPadding2(char pX) -{ - _padding2 = pX; -} - -Vector3Float& DesignatorPdu::getEntityLinearAcceleration() -{ - return _entityLinearAcceleration; -} - -const Vector3Float& DesignatorPdu::getEntityLinearAcceleration() const -{ - return _entityLinearAcceleration; -} - -void DesignatorPdu::setEntityLinearAcceleration(const Vector3Float &pX) -{ - _entityLinearAcceleration = pX; -} - -void DesignatorPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _designatingEntityID.marshal(dataStream); - dataStream << _codeName; - _designatedEntityID.marshal(dataStream); - dataStream << _designatorCode; - dataStream << _designatorPower; - dataStream << _designatorWavelength; - _designatorSpotWrtDesignated.marshal(dataStream); - _designatorSpotLocation.marshal(dataStream); - dataStream << _deadReckoningAlgorithm; - dataStream << _padding1; - dataStream << _padding2; - _entityLinearAcceleration.marshal(dataStream); -} - -void DesignatorPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _designatingEntityID.unmarshal(dataStream); - dataStream >> _codeName; - _designatedEntityID.unmarshal(dataStream); - dataStream >> _designatorCode; - dataStream >> _designatorPower; - dataStream >> _designatorWavelength; - _designatorSpotWrtDesignated.unmarshal(dataStream); - _designatorSpotLocation.unmarshal(dataStream); - dataStream >> _deadReckoningAlgorithm; - dataStream >> _padding1; - dataStream >> _padding2; - _entityLinearAcceleration.unmarshal(dataStream); -} - - -bool DesignatorPdu::operator ==(const DesignatorPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_designatingEntityID == rhs._designatingEntityID) ) ivarsEqual = false; - if( ! (_codeName == rhs._codeName) ) ivarsEqual = false; - if( ! (_designatedEntityID == rhs._designatedEntityID) ) ivarsEqual = false; - if( ! (_designatorCode == rhs._designatorCode) ) ivarsEqual = false; - if( ! (_designatorPower == rhs._designatorPower) ) ivarsEqual = false; - if( ! (_designatorWavelength == rhs._designatorWavelength) ) ivarsEqual = false; - if( ! (_designatorSpotWrtDesignated == rhs._designatorSpotWrtDesignated) ) ivarsEqual = false; - if( ! (_designatorSpotLocation == rhs._designatorSpotLocation) ) ivarsEqual = false; - if( ! (_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_entityLinearAcceleration == rhs._entityLinearAcceleration) ) ivarsEqual = false; - - return ivarsEqual; - } - -int DesignatorPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _designatingEntityID.getMarshalledSize(); // _designatingEntityID - marshalSize = marshalSize + 2; // _codeName - marshalSize = marshalSize + _designatedEntityID.getMarshalledSize(); // _designatedEntityID - marshalSize = marshalSize + 2; // _designatorCode - marshalSize = marshalSize + 4; // _designatorPower - marshalSize = marshalSize + 4; // _designatorWavelength - marshalSize = marshalSize + _designatorSpotWrtDesignated.getMarshalledSize(); // _designatorSpotWrtDesignated - marshalSize = marshalSize + _designatorSpotLocation.getMarshalledSize(); // _designatorSpotLocation - marshalSize = marshalSize + 1; // _deadReckoningAlgorithm - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - marshalSize = marshalSize + _entityLinearAcceleration.getMarshalledSize(); // _entityLinearAcceleration - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DesignatorPdu.h b/src/dis6/DesignatorPdu.h deleted file mode 100644 index b421773b..00000000 --- a/src/dis6/DesignatorPdu.h +++ /dev/null @@ -1,145 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7.2. Handles designating operations. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT DesignatorPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** ID of the entity designating */ - EntityID _designatingEntityID; - - /** This field shall specify a unique emitter database number assigned to differentiate between otherwise similar or identical emitter beams within an emitter system. */ - unsigned short _codeName; - - /** ID of the entity being designated */ - EntityID _designatedEntityID; - - /** This field shall identify the designator code being used by the designating entity */ - unsigned short _designatorCode; - - /** This field shall identify the designator output power in watts */ - float _designatorPower; - - /** This field shall identify the designator wavelength in units of microns */ - float _designatorWavelength; - - /** designtor spot wrt the designated entity */ - Vector3Float _designatorSpotWrtDesignated; - - /** designtor spot wrt the designated entity */ - Vector3Double _designatorSpotLocation; - - /** Dead reckoning algorithm */ - char _deadReckoningAlgorithm; - - /** padding */ - unsigned short _padding1; - - /** padding */ - char _padding2; - - /** linear accelleration of entity */ - Vector3Float _entityLinearAcceleration; - - - public: - DesignatorPdu(); - virtual ~DesignatorPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getDesignatingEntityID(); - const EntityID& getDesignatingEntityID() const; - void setDesignatingEntityID(const EntityID &pX); - - unsigned short getCodeName() const; - void setCodeName(unsigned short pX); - - EntityID& getDesignatedEntityID(); - const EntityID& getDesignatedEntityID() const; - void setDesignatedEntityID(const EntityID &pX); - - unsigned short getDesignatorCode() const; - void setDesignatorCode(unsigned short pX); - - float getDesignatorPower() const; - void setDesignatorPower(float pX); - - float getDesignatorWavelength() const; - void setDesignatorWavelength(float pX); - - Vector3Float& getDesignatorSpotWrtDesignated(); - const Vector3Float& getDesignatorSpotWrtDesignated() const; - void setDesignatorSpotWrtDesignated(const Vector3Float &pX); - - Vector3Double& getDesignatorSpotLocation(); - const Vector3Double& getDesignatorSpotLocation() const; - void setDesignatorSpotLocation(const Vector3Double &pX); - - char getDeadReckoningAlgorithm() const; - void setDeadReckoningAlgorithm(char pX); - - unsigned short getPadding1() const; - void setPadding1(unsigned short pX); - - char getPadding2() const; - void setPadding2(char pX); - - Vector3Float& getEntityLinearAcceleration(); - const Vector3Float& getEntityLinearAcceleration() const; - void setEntityLinearAcceleration(const Vector3Float &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DesignatorPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DetonationPdu.cpp b/src/dis6/DetonationPdu.cpp deleted file mode 100644 index 12d25f41..00000000 --- a/src/dis6/DetonationPdu.cpp +++ /dev/null @@ -1,276 +0,0 @@ -#include - -using namespace DIS; - - -DetonationPdu::DetonationPdu() : WarfareFamilyPdu(), - _munitionID(), - _eventID(), - _velocity(), - _locationInWorldCoordinates(), - _burstDescriptor(), - _locationInEntityCoordinates(), - _detonationResult(0), - _numberOfArticulationParameters(0), - _pad(0) -{ - setPduType( 3 ); -} - -DetonationPdu::~DetonationPdu() -{ - _articulationParameters.clear(); -} - -EntityID& DetonationPdu::getMunitionID() -{ - return _munitionID; -} - -const EntityID& DetonationPdu::getMunitionID() const -{ - return _munitionID; -} - -void DetonationPdu::setMunitionID(const EntityID &pX) -{ - _munitionID = pX; -} - -EventID& DetonationPdu::getEventID() -{ - return _eventID; -} - -const EventID& DetonationPdu::getEventID() const -{ - return _eventID; -} - -void DetonationPdu::setEventID(const EventID &pX) -{ - _eventID = pX; -} - -Vector3Float& DetonationPdu::getVelocity() -{ - return _velocity; -} - -const Vector3Float& DetonationPdu::getVelocity() const -{ - return _velocity; -} - -void DetonationPdu::setVelocity(const Vector3Float &pX) -{ - _velocity = pX; -} - -Vector3Double& DetonationPdu::getLocationInWorldCoordinates() -{ - return _locationInWorldCoordinates; -} - -const Vector3Double& DetonationPdu::getLocationInWorldCoordinates() const -{ - return _locationInWorldCoordinates; -} - -void DetonationPdu::setLocationInWorldCoordinates(const Vector3Double &pX) -{ - _locationInWorldCoordinates = pX; -} - -BurstDescriptor& DetonationPdu::getBurstDescriptor() -{ - return _burstDescriptor; -} - -const BurstDescriptor& DetonationPdu::getBurstDescriptor() const -{ - return _burstDescriptor; -} - -void DetonationPdu::setBurstDescriptor(const BurstDescriptor &pX) -{ - _burstDescriptor = pX; -} - -Vector3Float& DetonationPdu::getLocationInEntityCoordinates() -{ - return _locationInEntityCoordinates; -} - -const Vector3Float& DetonationPdu::getLocationInEntityCoordinates() const -{ - return _locationInEntityCoordinates; -} - -void DetonationPdu::setLocationInEntityCoordinates(const Vector3Float &pX) -{ - _locationInEntityCoordinates = pX; -} - -unsigned char DetonationPdu::getDetonationResult() const -{ - return _detonationResult; -} - -void DetonationPdu::setDetonationResult(unsigned char pX) -{ - _detonationResult = pX; -} - -unsigned char DetonationPdu::getNumberOfArticulationParameters() const -{ - return _articulationParameters.size(); -} - -short DetonationPdu::getPad() const -{ - return _pad; -} - -void DetonationPdu::setPad(short pX) -{ - _pad = pX; -} - -std::vector& DetonationPdu::getArticulationParameters() -{ - return _articulationParameters; -} - -const std::vector& DetonationPdu::getArticulationParameters() const -{ - return _articulationParameters; -} - -void DetonationPdu::setArticulationParameters(const std::vector& pX) -{ - _articulationParameters = pX; -} - -void DetonationPdu::marshal(DataStream& dataStream) const -{ - WarfareFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _munitionID.marshal(dataStream); - _eventID.marshal(dataStream); - _velocity.marshal(dataStream); - _locationInWorldCoordinates.marshal(dataStream); - _burstDescriptor.marshal(dataStream); - _locationInEntityCoordinates.marshal(dataStream); - dataStream << _detonationResult; - dataStream << ( unsigned char )_articulationParameters.size(); - dataStream << _pad; - - for(size_t idx = 0; idx < _articulationParameters.size(); idx++) - { - ArticulationParameter x = _articulationParameters[idx]; - x.marshal(dataStream); - } - -} - -void DetonationPdu::unmarshal(DataStream& dataStream) -{ - WarfareFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _munitionID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - _velocity.unmarshal(dataStream); - _locationInWorldCoordinates.unmarshal(dataStream); - _burstDescriptor.unmarshal(dataStream); - _locationInEntityCoordinates.unmarshal(dataStream); - dataStream >> _detonationResult; - dataStream >> _numberOfArticulationParameters; - dataStream >> _pad; - - _articulationParameters.clear(); - for(size_t idx = 0; idx < _numberOfArticulationParameters; idx++) - { - ArticulationParameter x; - x.unmarshal(dataStream); - _articulationParameters.push_back(x); - } -} - - -bool DetonationPdu::operator ==(const DetonationPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = WarfareFamilyPdu::operator==(rhs); - - if( ! (_munitionID == rhs._munitionID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_velocity == rhs._velocity) ) ivarsEqual = false; - if( ! (_locationInWorldCoordinates == rhs._locationInWorldCoordinates) ) ivarsEqual = false; - if( ! (_burstDescriptor == rhs._burstDescriptor) ) ivarsEqual = false; - if( ! (_locationInEntityCoordinates == rhs._locationInEntityCoordinates) ) ivarsEqual = false; - if( ! (_detonationResult == rhs._detonationResult) ) ivarsEqual = false; - if( ! (_pad == rhs._pad) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _articulationParameters.size(); idx++) - { - if( ! ( _articulationParameters[idx] == rhs._articulationParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DetonationPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = WarfareFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _munitionID.getMarshalledSize(); // _munitionID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity - marshalSize = marshalSize + _locationInWorldCoordinates.getMarshalledSize(); // _locationInWorldCoordinates - marshalSize = marshalSize + _burstDescriptor.getMarshalledSize(); // _burstDescriptor - marshalSize = marshalSize + _locationInEntityCoordinates.getMarshalledSize(); // _locationInEntityCoordinates - marshalSize = marshalSize + 1; // _detonationResult - marshalSize = marshalSize + 1; // _numberOfArticulationParameters - marshalSize = marshalSize + 2; // _pad - - for(unsigned long long idx=0; idx < _articulationParameters.size(); idx++) - { - ArticulationParameter listElement = _articulationParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DetonationPdu.h b/src/dis6/DetonationPdu.h deleted file mode 100644 index d22282e9..00000000 --- a/src/dis6/DetonationPdu.h +++ /dev/null @@ -1,136 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.4.2. Information about stuff exploding. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT DetonationPdu : public WarfareFamilyPdu -{ -protected: - /** ID of muntion that was fired */ - EntityID _munitionID; - - /** ID firing event */ - EventID _eventID; - - /** ID firing event */ - Vector3Float _velocity; - - /** where the detonation is, in world coordinates */ - Vector3Double _locationInWorldCoordinates; - - /** Describes munition used */ - BurstDescriptor _burstDescriptor; - - /** location of the detonation or impact in the target entity's coordinate system. This information should be used for damage assessment. */ - Vector3Float _locationInEntityCoordinates; - - /** result of the explosion */ - unsigned char _detonationResult; - - /** How many articulation parameters we have */ - unsigned char _numberOfArticulationParameters; - - /** padding */ - short _pad; - - std::vector _articulationParameters; - - - public: - DetonationPdu(); - virtual ~DetonationPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getMunitionID(); - const EntityID& getMunitionID() const; - void setMunitionID(const EntityID &pX); - - EventID& getEventID(); - const EventID& getEventID() const; - void setEventID(const EventID &pX); - - Vector3Float& getVelocity(); - const Vector3Float& getVelocity() const; - void setVelocity(const Vector3Float &pX); - - Vector3Double& getLocationInWorldCoordinates(); - const Vector3Double& getLocationInWorldCoordinates() const; - void setLocationInWorldCoordinates(const Vector3Double &pX); - - BurstDescriptor& getBurstDescriptor(); - const BurstDescriptor& getBurstDescriptor() const; - void setBurstDescriptor(const BurstDescriptor &pX); - - Vector3Float& getLocationInEntityCoordinates(); - const Vector3Float& getLocationInEntityCoordinates() const; - void setLocationInEntityCoordinates(const Vector3Float &pX); - - unsigned char getDetonationResult() const; - void setDetonationResult(unsigned char pX); - - unsigned char getNumberOfArticulationParameters() const; - - short getPad() const; - void setPad(short pX); - - std::vector& getArticulationParameters(); - const std::vector& getArticulationParameters() const; - void setArticulationParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DetonationPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DistributedEmissionsFamilyPdu.cpp b/src/dis6/DistributedEmissionsFamilyPdu.cpp deleted file mode 100644 index bc52fd59..00000000 --- a/src/dis6/DistributedEmissionsFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -DistributedEmissionsFamilyPdu::DistributedEmissionsFamilyPdu() : Pdu() - -{ - setProtocolFamily( 6 ); -} - -DistributedEmissionsFamilyPdu::~DistributedEmissionsFamilyPdu() -{ -} - -void DistributedEmissionsFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void DistributedEmissionsFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool DistributedEmissionsFamilyPdu::operator ==(const DistributedEmissionsFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int DistributedEmissionsFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/DistributedEmissionsFamilyPdu.h b/src/dis6/DistributedEmissionsFamilyPdu.h deleted file mode 100644 index ac7de425..00000000 --- a/src/dis6/DistributedEmissionsFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7. Electromagnetic Emissions. Abstract superclass for distirubted emissions PDU - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT DistributedEmissionsFamilyPdu : public Pdu -{ -protected: - - public: - DistributedEmissionsFamilyPdu(); - virtual ~DistributedEmissionsFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DistributedEmissionsFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EightByteChunk.cpp b/src/dis6/EightByteChunk.cpp deleted file mode 100644 index 88aaaf0c..00000000 --- a/src/dis6/EightByteChunk.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -using namespace DIS; - - -EightByteChunk::EightByteChunk() -{ - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 8; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - -} - -EightByteChunk::~EightByteChunk() -{ -} - -char* EightByteChunk::getOtherParameters() -{ - return _otherParameters; -} - -const char* EightByteChunk::getOtherParameters() const -{ - return _otherParameters; -} - -void EightByteChunk::setOtherParameters(const char* x) -{ - for(int i = 0; i < 8; i++) - { - _otherParameters[i] = x[i]; - } -} - -void EightByteChunk::marshal(DataStream& dataStream) const -{ - - for(size_t idx = 0; idx < 8; idx++) - { - dataStream << _otherParameters[idx]; - } - -} - -void EightByteChunk::unmarshal(DataStream& dataStream) -{ - - for(size_t idx = 0; idx < 8; idx++) - { - dataStream >> _otherParameters[idx]; - } - -} - - -bool EightByteChunk::operator ==(const EightByteChunk& rhs) const - { - bool ivarsEqual = true; - - - for(unsigned char idx = 0; idx < 8; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EightByteChunk::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 8 * 1; // _otherParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EightByteChunk.h b/src/dis6/EightByteChunk.h deleted file mode 100644 index 1dc3e9d2..00000000 --- a/src/dis6/EightByteChunk.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 64 bit piece of data - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EightByteChunk -{ -protected: - /** Eight bytes of arbitrary data */ - char _otherParameters[8]; - - - public: - EightByteChunk(); - virtual ~EightByteChunk(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EightByteChunk& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ElectromagneticEmissionBeamData.cpp b/src/dis6/ElectromagneticEmissionBeamData.cpp deleted file mode 100644 index ff870f8f..00000000 --- a/src/dis6/ElectromagneticEmissionBeamData.cpp +++ /dev/null @@ -1,245 +0,0 @@ -#include - -using namespace DIS; - - -ElectromagneticEmissionBeamData::ElectromagneticEmissionBeamData(): - _beamDataLength(0), - _beamIDNumber(0), - _beamParameterIndex(0), - _fundamentalParameterData(), - _beamFunction(0), - _numberOfTrackJamTargets(0), - _highDensityTrackJam(0), - _pad4(0), - _jammingModeSequence(0) -{ -} - -ElectromagneticEmissionBeamData::~ElectromagneticEmissionBeamData() -{ - _trackJamTargets.clear(); -} - -unsigned char ElectromagneticEmissionBeamData::getBeamDataLength() const -{ - return _beamDataLength; -} - -void ElectromagneticEmissionBeamData::setBeamDataLength(unsigned char pX) -{ - _beamDataLength = pX; -} - -unsigned char ElectromagneticEmissionBeamData::getBeamIDNumber() const -{ - return _beamIDNumber; -} - -void ElectromagneticEmissionBeamData::setBeamIDNumber(unsigned char pX) -{ - _beamIDNumber = pX; -} - -unsigned short ElectromagneticEmissionBeamData::getBeamParameterIndex() const -{ - return _beamParameterIndex; -} - -void ElectromagneticEmissionBeamData::setBeamParameterIndex(unsigned short pX) -{ - _beamParameterIndex = pX; -} - -FundamentalParameterData& ElectromagneticEmissionBeamData::getFundamentalParameterData() -{ - return _fundamentalParameterData; -} - -const FundamentalParameterData& ElectromagneticEmissionBeamData::getFundamentalParameterData() const -{ - return _fundamentalParameterData; -} - -void ElectromagneticEmissionBeamData::setFundamentalParameterData(const FundamentalParameterData &pX) -{ - _fundamentalParameterData = pX; -} - -unsigned char ElectromagneticEmissionBeamData::getBeamFunction() const -{ - return _beamFunction; -} - -void ElectromagneticEmissionBeamData::setBeamFunction(unsigned char pX) -{ - _beamFunction = pX; -} - -unsigned char ElectromagneticEmissionBeamData::getNumberOfTrackJamTargets() const -{ - return _trackJamTargets.size(); -} - -unsigned char ElectromagneticEmissionBeamData::getHighDensityTrackJam() const -{ - return _highDensityTrackJam; -} - -void ElectromagneticEmissionBeamData::setHighDensityTrackJam(unsigned char pX) -{ - _highDensityTrackJam = pX; -} - -unsigned char ElectromagneticEmissionBeamData::getPad4() const -{ - return _pad4; -} - -void ElectromagneticEmissionBeamData::setPad4(unsigned char pX) -{ - _pad4 = pX; -} - -unsigned int ElectromagneticEmissionBeamData::getJammingModeSequence() const -{ - return _jammingModeSequence; -} - -void ElectromagneticEmissionBeamData::setJammingModeSequence(unsigned int pX) -{ - _jammingModeSequence = pX; -} - -std::vector& ElectromagneticEmissionBeamData::getTrackJamTargets() -{ - return _trackJamTargets; -} - -const std::vector& ElectromagneticEmissionBeamData::getTrackJamTargets() const -{ - return _trackJamTargets; -} - -void ElectromagneticEmissionBeamData::setTrackJamTargets(const std::vector& pX) -{ - _trackJamTargets = pX; -} - -void ElectromagneticEmissionBeamData::marshal(DataStream& dataStream) const -{ - dataStream << _beamDataLength; - dataStream << _beamIDNumber; - dataStream << _beamParameterIndex; - _fundamentalParameterData.marshal(dataStream); - dataStream << _beamFunction; - dataStream << ( unsigned char )_trackJamTargets.size(); - dataStream << _highDensityTrackJam; - dataStream << _pad4; - dataStream << _jammingModeSequence; - - for(size_t idx = 0; idx < _trackJamTargets.size(); idx++) - { - TrackJamTarget x = _trackJamTargets[idx]; - x.marshal(dataStream); - } - -} - -void ElectromagneticEmissionBeamData::unmarshal(DataStream& dataStream) -{ - dataStream >> _beamDataLength; - dataStream >> _beamIDNumber; - dataStream >> _beamParameterIndex; - _fundamentalParameterData.unmarshal(dataStream); - dataStream >> _beamFunction; - dataStream >> _numberOfTrackJamTargets; - dataStream >> _highDensityTrackJam; - dataStream >> _pad4; - dataStream >> _jammingModeSequence; - - _trackJamTargets.clear(); - for(size_t idx = 0; idx < _numberOfTrackJamTargets; idx++) - { - TrackJamTarget x; - x.unmarshal(dataStream); - _trackJamTargets.push_back(x); - } -} - - -bool ElectromagneticEmissionBeamData::operator ==(const ElectromagneticEmissionBeamData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_beamDataLength == rhs._beamDataLength) ) ivarsEqual = false; - if( ! (_beamIDNumber == rhs._beamIDNumber) ) ivarsEqual = false; - if( ! (_beamParameterIndex == rhs._beamParameterIndex) ) ivarsEqual = false; - if( ! (_fundamentalParameterData == rhs._fundamentalParameterData) ) ivarsEqual = false; - if( ! (_beamFunction == rhs._beamFunction) ) ivarsEqual = false; - if( ! (_highDensityTrackJam == rhs._highDensityTrackJam) ) ivarsEqual = false; - if( ! (_pad4 == rhs._pad4) ) ivarsEqual = false; - if( ! (_jammingModeSequence == rhs._jammingModeSequence) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _trackJamTargets.size(); idx++) - { - if( ! ( _trackJamTargets[idx] == rhs._trackJamTargets[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ElectromagneticEmissionBeamData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _beamDataLength - marshalSize = marshalSize + 1; // _beamIDNumber - marshalSize = marshalSize + 2; // _beamParameterIndex - marshalSize = marshalSize + _fundamentalParameterData.getMarshalledSize(); // _fundamentalParameterData - marshalSize = marshalSize + 1; // _beamFunction - marshalSize = marshalSize + 1; // _numberOfTrackJamTargets - marshalSize = marshalSize + 1; // _highDensityTrackJam - marshalSize = marshalSize + 1; // _pad4 - marshalSize = marshalSize + 4; // _jammingModeSequence - - for(unsigned long long idx=0; idx < _trackJamTargets.size(); idx++) - { - TrackJamTarget listElement = _trackJamTargets[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ElectromagneticEmissionBeamData.h b/src/dis6/ElectromagneticEmissionBeamData.h deleted file mode 100644 index 3f42cb2c..00000000 --- a/src/dis6/ElectromagneticEmissionBeamData.h +++ /dev/null @@ -1,126 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Description of one electronic emission beam - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ElectromagneticEmissionBeamData -{ -protected: - /** This field shall specify the length of this beams data in 32 bit words */ - unsigned char _beamDataLength; - - /** This field shall specify a unique emitter database number assigned to differentiate between otherwise similar or identical emitter beams within an emitter system. */ - unsigned char _beamIDNumber; - - /** This field shall specify a Beam Parameter Index number that shall be used by receiving entities in conjunction with the Emitter Name field to provide a pointer to the stored database parameters required to regenerate the beam. */ - unsigned short _beamParameterIndex; - - /** Fundamental parameter data such as frequency range, beam sweep, etc. */ - FundamentalParameterData _fundamentalParameterData; - - /** beam function of a particular beam */ - unsigned char _beamFunction; - - /** Number of track/jam targets */ - unsigned char _numberOfTrackJamTargets; - - /** wheher or not the receiving simulation apps can assume all the targets in the scan pattern are being tracked/jammed */ - unsigned char _highDensityTrackJam; - - /** padding */ - unsigned char _pad4; - - /** identify jamming techniques used */ - unsigned int _jammingModeSequence; - - /** variable length list of track/jam targets */ - std::vector _trackJamTargets; - - - public: - ElectromagneticEmissionBeamData(); - virtual ~ElectromagneticEmissionBeamData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getBeamDataLength() const; - void setBeamDataLength(unsigned char pX); - - unsigned char getBeamIDNumber() const; - void setBeamIDNumber(unsigned char pX); - - unsigned short getBeamParameterIndex() const; - void setBeamParameterIndex(unsigned short pX); - - FundamentalParameterData& getFundamentalParameterData(); - const FundamentalParameterData& getFundamentalParameterData() const; - void setFundamentalParameterData(const FundamentalParameterData &pX); - - unsigned char getBeamFunction() const; - void setBeamFunction(unsigned char pX); - - unsigned char getNumberOfTrackJamTargets() const; - - unsigned char getHighDensityTrackJam() const; - void setHighDensityTrackJam(unsigned char pX); - - unsigned char getPad4() const; - void setPad4(unsigned char pX); - - unsigned int getJammingModeSequence() const; - void setJammingModeSequence(unsigned int pX); - - std::vector& getTrackJamTargets(); - const std::vector& getTrackJamTargets() const; - void setTrackJamTargets(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ElectromagneticEmissionBeamData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ElectromagneticEmissionSystemData.cpp b/src/dis6/ElectromagneticEmissionSystemData.cpp deleted file mode 100644 index 95880231..00000000 --- a/src/dis6/ElectromagneticEmissionSystemData.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include - -using namespace DIS; - - -ElectromagneticEmissionSystemData::ElectromagneticEmissionSystemData(): - _systemDataLength(0), - _numberOfBeams(0), - _emissionsPadding2(0), - _emitterSystem(), - _location() -{ -} - -ElectromagneticEmissionSystemData::~ElectromagneticEmissionSystemData() -{ - _beamDataRecords.clear(); -} - -unsigned char ElectromagneticEmissionSystemData::getSystemDataLength() const -{ - return _systemDataLength; -} - -void ElectromagneticEmissionSystemData::setSystemDataLength(unsigned char pX) -{ - _systemDataLength = pX; -} - -unsigned char ElectromagneticEmissionSystemData::getNumberOfBeams() const -{ - return _beamDataRecords.size(); -} - -unsigned short ElectromagneticEmissionSystemData::getEmissionsPadding2() const -{ - return _emissionsPadding2; -} - -void ElectromagneticEmissionSystemData::setEmissionsPadding2(unsigned short pX) -{ - _emissionsPadding2 = pX; -} - -EmitterSystem& ElectromagneticEmissionSystemData::getEmitterSystem() -{ - return _emitterSystem; -} - -const EmitterSystem& ElectromagneticEmissionSystemData::getEmitterSystem() const -{ - return _emitterSystem; -} - -void ElectromagneticEmissionSystemData::setEmitterSystem(const EmitterSystem &pX) -{ - _emitterSystem = pX; -} - -Vector3Float& ElectromagneticEmissionSystemData::getLocation() -{ - return _location; -} - -const Vector3Float& ElectromagneticEmissionSystemData::getLocation() const -{ - return _location; -} - -void ElectromagneticEmissionSystemData::setLocation(const Vector3Float &pX) -{ - _location = pX; -} - -std::vector& ElectromagneticEmissionSystemData::getBeamDataRecords() -{ - return _beamDataRecords; -} - -const std::vector& ElectromagneticEmissionSystemData::getBeamDataRecords() const -{ - return _beamDataRecords; -} - -void ElectromagneticEmissionSystemData::setBeamDataRecords(const std::vector& pX) -{ - _beamDataRecords = pX; -} - -void ElectromagneticEmissionSystemData::marshal(DataStream& dataStream) const -{ - dataStream << _systemDataLength; - dataStream << ( unsigned char )_beamDataRecords.size(); - dataStream << _emissionsPadding2; - _emitterSystem.marshal(dataStream); - _location.marshal(dataStream); - - for(size_t idx = 0; idx < _beamDataRecords.size(); idx++) - { - ElectromagneticEmissionBeamData x = _beamDataRecords[idx]; - x.marshal(dataStream); - } - -} - -void ElectromagneticEmissionSystemData::unmarshal(DataStream& dataStream) -{ - dataStream >> _systemDataLength; - dataStream >> _numberOfBeams; - dataStream >> _emissionsPadding2; - _emitterSystem.unmarshal(dataStream); - _location.unmarshal(dataStream); - - _beamDataRecords.clear(); - for(size_t idx = 0; idx < _numberOfBeams; idx++) - { - ElectromagneticEmissionBeamData x; - x.unmarshal(dataStream); - _beamDataRecords.push_back(x); - } -} - - -bool ElectromagneticEmissionSystemData::operator ==(const ElectromagneticEmissionSystemData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_systemDataLength == rhs._systemDataLength) ) ivarsEqual = false; - if( ! (_emissionsPadding2 == rhs._emissionsPadding2) ) ivarsEqual = false; - if( ! (_emitterSystem == rhs._emitterSystem) ) ivarsEqual = false; - if( ! (_location == rhs._location) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _beamDataRecords.size(); idx++) - { - if( ! ( _beamDataRecords[idx] == rhs._beamDataRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ElectromagneticEmissionSystemData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _systemDataLength - marshalSize = marshalSize + 1; // _numberOfBeams - marshalSize = marshalSize + 2; // _emissionsPadding2 - marshalSize = marshalSize + _emitterSystem.getMarshalledSize(); // _emitterSystem - marshalSize = marshalSize + _location.getMarshalledSize(); // _location - - for(unsigned long long idx=0; idx < _beamDataRecords.size(); idx++) - { - ElectromagneticEmissionBeamData listElement = _beamDataRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ElectromagneticEmissionSystemData.h b/src/dis6/ElectromagneticEmissionSystemData.h deleted file mode 100644 index 353c827b..00000000 --- a/src/dis6/ElectromagneticEmissionSystemData.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Data about one electronic system - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ElectromagneticEmissionSystemData -{ -protected: - /** This field shall specify the length of this emitter system�s data (including beam data and its track/jam information) in 32-bit words. The length shall include the System Data Length field. */ - unsigned char _systemDataLength; - - /** This field shall specify the number of beams being described in the current PDU for the system being described. */ - unsigned char _numberOfBeams; - - /** padding. */ - unsigned short _emissionsPadding2; - - /** This field shall specify information about a particular emitter system */ - EmitterSystem _emitterSystem; - - /** Location with respect to the entity */ - Vector3Float _location; - - /** variable length list of beam data records */ - std::vector _beamDataRecords; - - - public: - ElectromagneticEmissionSystemData(); - virtual ~ElectromagneticEmissionSystemData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getSystemDataLength() const; - void setSystemDataLength(unsigned char pX); - - unsigned char getNumberOfBeams() const; - - unsigned short getEmissionsPadding2() const; - void setEmissionsPadding2(unsigned short pX); - - EmitterSystem& getEmitterSystem(); - const EmitterSystem& getEmitterSystem() const; - void setEmitterSystem(const EmitterSystem &pX); - - Vector3Float& getLocation(); - const Vector3Float& getLocation() const; - void setLocation(const Vector3Float &pX); - - std::vector& getBeamDataRecords(); - const std::vector& getBeamDataRecords() const; - void setBeamDataRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ElectromagneticEmissionSystemData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ElectromagneticEmissionsPdu.cpp b/src/dis6/ElectromagneticEmissionsPdu.cpp deleted file mode 100644 index 9178a40d..00000000 --- a/src/dis6/ElectromagneticEmissionsPdu.cpp +++ /dev/null @@ -1,197 +0,0 @@ -#include - -using namespace DIS; - - -ElectromagneticEmissionsPdu::ElectromagneticEmissionsPdu() : DistributedEmissionsFamilyPdu(), - _emittingEntityID(), - _eventID(), - _stateUpdateIndicator(0), - _numberOfSystems(0), - _paddingForEmissionsPdu(0) -{ - setPduType( 23 ); - setPaddingForEmissionsPdu( 0 ); -} - -ElectromagneticEmissionsPdu::~ElectromagneticEmissionsPdu() -{ - _systems.clear(); -} - -EntityID& ElectromagneticEmissionsPdu::getEmittingEntityID() -{ - return _emittingEntityID; -} - -const EntityID& ElectromagneticEmissionsPdu::getEmittingEntityID() const -{ - return _emittingEntityID; -} - -void ElectromagneticEmissionsPdu::setEmittingEntityID(const EntityID &pX) -{ - _emittingEntityID = pX; -} - -EventID& ElectromagneticEmissionsPdu::getEventID() -{ - return _eventID; -} - -const EventID& ElectromagneticEmissionsPdu::getEventID() const -{ - return _eventID; -} - -void ElectromagneticEmissionsPdu::setEventID(const EventID &pX) -{ - _eventID = pX; -} - -unsigned char ElectromagneticEmissionsPdu::getStateUpdateIndicator() const -{ - return _stateUpdateIndicator; -} - -void ElectromagneticEmissionsPdu::setStateUpdateIndicator(unsigned char pX) -{ - _stateUpdateIndicator = pX; -} - -unsigned char ElectromagneticEmissionsPdu::getNumberOfSystems() const -{ - return _systems.size(); -} - -unsigned short ElectromagneticEmissionsPdu::getPaddingForEmissionsPdu() const -{ - return _paddingForEmissionsPdu; -} - -void ElectromagneticEmissionsPdu::setPaddingForEmissionsPdu(unsigned short pX) -{ - _paddingForEmissionsPdu = pX; -} - -std::vector& ElectromagneticEmissionsPdu::getSystems() -{ - return _systems; -} - -const std::vector& ElectromagneticEmissionsPdu::getSystems() const -{ - return _systems; -} - -void ElectromagneticEmissionsPdu::setSystems(const std::vector& pX) -{ - _systems = pX; -} - -void ElectromagneticEmissionsPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _emittingEntityID.marshal(dataStream); - _eventID.marshal(dataStream); - dataStream << _stateUpdateIndicator; - dataStream << ( unsigned char )_systems.size(); - dataStream << _paddingForEmissionsPdu; - - for(size_t idx = 0; idx < _systems.size(); idx++) - { - ElectromagneticEmissionSystemData x = _systems[idx]; - x.marshal(dataStream); - } - -} - -void ElectromagneticEmissionsPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _emittingEntityID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - dataStream >> _stateUpdateIndicator; - dataStream >> _numberOfSystems; - dataStream >> _paddingForEmissionsPdu; - - _systems.clear(); - for(size_t idx = 0; idx < _numberOfSystems; idx++) - { - ElectromagneticEmissionSystemData x; - x.unmarshal(dataStream); - _systems.push_back(x); - } -} - - -bool ElectromagneticEmissionsPdu::operator ==(const ElectromagneticEmissionsPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_emittingEntityID == rhs._emittingEntityID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_stateUpdateIndicator == rhs._stateUpdateIndicator) ) ivarsEqual = false; - if( ! (_paddingForEmissionsPdu == rhs._paddingForEmissionsPdu) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _systems.size(); idx++) - { - if( ! ( _systems[idx] == rhs._systems[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ElectromagneticEmissionsPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + 1; // _stateUpdateIndicator - marshalSize = marshalSize + 1; // _numberOfSystems - marshalSize = marshalSize + 2; // _paddingForEmissionsPdu - - for(unsigned long long idx=0; idx < _systems.size(); idx++) - { - ElectromagneticEmissionSystemData listElement = _systems[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ElectromagneticEmissionsPdu.h b/src/dis6/ElectromagneticEmissionsPdu.h deleted file mode 100644 index 3b891cef..00000000 --- a/src/dis6/ElectromagneticEmissionsPdu.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7.1. Information about active electronic warfare (EW) emissions and active EW countermeasures shall be communicated using an Electromagnetic Emission PDU. COMPLETE (I think) - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ElectromagneticEmissionsPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** ID of the entity emitting */ - EntityID _emittingEntityID; - - /** ID of event */ - EventID _eventID; - - /** This field shall be used to indicate if the data in the PDU represents a state update or just data that has changed since issuance of the last Electromagnetic Emission PDU [relative to the identified entity and emission system(s)]. */ - unsigned char _stateUpdateIndicator; - - /** This field shall specify the number of emission systems being described in the current PDU. */ - unsigned char _numberOfSystems; - - /** padding */ - unsigned short _paddingForEmissionsPdu; - - /** Electromagnetic emmissions systems */ - std::vector _systems; - - - public: - ElectromagneticEmissionsPdu(); - virtual ~ElectromagneticEmissionsPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEmittingEntityID(); - const EntityID& getEmittingEntityID() const; - void setEmittingEntityID(const EntityID &pX); - - EventID& getEventID(); - const EventID& getEventID() const; - void setEventID(const EventID &pX); - - unsigned char getStateUpdateIndicator() const; - void setStateUpdateIndicator(unsigned char pX); - - unsigned char getNumberOfSystems() const; - - unsigned short getPaddingForEmissionsPdu() const; - void setPaddingForEmissionsPdu(unsigned short pX); - - std::vector& getSystems(); - const std::vector& getSystems() const; - void setSystems(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ElectromagneticEmissionsPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EmitterSystem.cpp b/src/dis6/EmitterSystem.cpp deleted file mode 100644 index d3b16f26..00000000 --- a/src/dis6/EmitterSystem.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -EmitterSystem::EmitterSystem(): - _emitterName(0), - _function(0), - _emitterIdNumber(0) -{ -} - -EmitterSystem::~EmitterSystem() -{ -} - -unsigned short EmitterSystem::getEmitterName() const -{ - return _emitterName; -} - -void EmitterSystem::setEmitterName(unsigned short pX) -{ - _emitterName = pX; -} - -unsigned char EmitterSystem::getFunction() const -{ - return _function; -} - -void EmitterSystem::setFunction(unsigned char pX) -{ - _function = pX; -} - -unsigned char EmitterSystem::getEmitterIdNumber() const -{ - return _emitterIdNumber; -} - -void EmitterSystem::setEmitterIdNumber(unsigned char pX) -{ - _emitterIdNumber = pX; -} - -void EmitterSystem::marshal(DataStream& dataStream) const -{ - dataStream << _emitterName; - dataStream << _function; - dataStream << _emitterIdNumber; -} - -void EmitterSystem::unmarshal(DataStream& dataStream) -{ - dataStream >> _emitterName; - dataStream >> _function; - dataStream >> _emitterIdNumber; -} - - -bool EmitterSystem::operator ==(const EmitterSystem& rhs) const - { - bool ivarsEqual = true; - - if( ! (_emitterName == rhs._emitterName) ) ivarsEqual = false; - if( ! (_function == rhs._function) ) ivarsEqual = false; - if( ! (_emitterIdNumber == rhs._emitterIdNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EmitterSystem::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _emitterName - marshalSize = marshalSize + 1; // _function - marshalSize = marshalSize + 1; // _emitterIdNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EmitterSystem.h b/src/dis6/EmitterSystem.h deleted file mode 100644 index ef3838a9..00000000 --- a/src/dis6/EmitterSystem.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.11. This field shall specify information about a particular emitter system - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EmitterSystem -{ -protected: - /** Name of the emitter, 16 bit enumeration */ - unsigned short _emitterName; - - /** function of the emitter, 8 bit enumeration */ - unsigned char _function; - - /** emitter ID, 8 bit enumeration */ - unsigned char _emitterIdNumber; - - - public: - EmitterSystem(); - virtual ~EmitterSystem(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getEmitterName() const; - void setEmitterName(unsigned short pX); - - unsigned char getFunction() const; - void setFunction(unsigned char pX); - - unsigned char getEmitterIdNumber() const; - void setEmitterIdNumber(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EmitterSystem& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityID.cpp b/src/dis6/EntityID.cpp deleted file mode 100644 index d94a0e4a..00000000 --- a/src/dis6/EntityID.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -EntityID::EntityID(): - _site(0), - _application(0), - _entity(0) -{ -} - -EntityID::~EntityID() -{ -} - -unsigned short EntityID::getSite() const -{ - return _site; -} - -void EntityID::setSite(unsigned short pX) -{ - _site = pX; -} - -unsigned short EntityID::getApplication() const -{ - return _application; -} - -void EntityID::setApplication(unsigned short pX) -{ - _application = pX; -} - -unsigned short EntityID::getEntity() const -{ - return _entity; -} - -void EntityID::setEntity(unsigned short pX) -{ - _entity = pX; -} - -void EntityID::marshal(DataStream& dataStream) const -{ - dataStream << _site; - dataStream << _application; - dataStream << _entity; -} - -void EntityID::unmarshal(DataStream& dataStream) -{ - dataStream >> _site; - dataStream >> _application; - dataStream >> _entity; -} - - -bool EntityID::operator ==(const EntityID& rhs) const - { - bool ivarsEqual = true; - - if( ! (_site == rhs._site) ) ivarsEqual = false; - if( ! (_application == rhs._application) ) ivarsEqual = false; - if( ! (_entity == rhs._entity) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EntityID::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _site - marshalSize = marshalSize + 2; // _application - marshalSize = marshalSize + 2; // _entity - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityID.h b/src/dis6/EntityID.h deleted file mode 100644 index 8891936e..00000000 --- a/src/dis6/EntityID.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Each entity in a given DIS simulation application shall be given an entity identifier number unique to all other entities in that application. This identifier number is valid for the duration of the exercise; however, entity identifier numbers may be reused when all possible numbers have been exhausted. No entity shall have an entity identifier number of NO_ENTITY, ALL_ENTITIES, or RQST_ASSIGN_ID. The entity iden- tifier number need not be registered or retained for future exercises. The entity identifier number shall be specified by a 16-bit unsigned integer. An entity identifier number equal to zero with valid site and application identification shall address a simulation application. An entity identifier number equal to ALL_ENTITIES shall mean all entities within the specified site and application. An entity identifier number equal to RQST_ASSIGN_ID allows the receiver of the create entity to define the entity identifier number of the new entity. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EntityID -{ -protected: - /** The site ID */ - unsigned short _site; - - /** The application ID */ - unsigned short _application; - - /** the entity ID */ - unsigned short _entity; - - - public: - EntityID(); - virtual ~EntityID(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSite() const; - void setSite(unsigned short pX); - - unsigned short getApplication() const; - void setApplication(unsigned short pX); - - unsigned short getEntity() const; - void setEntity(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityID& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityInformationFamilyPdu.cpp b/src/dis6/EntityInformationFamilyPdu.cpp deleted file mode 100644 index 4ab2591d..00000000 --- a/src/dis6/EntityInformationFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -EntityInformationFamilyPdu::EntityInformationFamilyPdu() : Pdu() - -{ - setProtocolFamily( 1 ); -} - -EntityInformationFamilyPdu::~EntityInformationFamilyPdu() -{ -} - -void EntityInformationFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void EntityInformationFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool EntityInformationFamilyPdu::operator ==(const EntityInformationFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int EntityInformationFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityInformationFamilyPdu.h b/src/dis6/EntityInformationFamilyPdu.h deleted file mode 100644 index a0edd496..00000000 --- a/src/dis6/EntityInformationFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.3. Common superclass for EntityState, Collision, collision-elastic, and entity state update PDUs. This should be abstract. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EntityInformationFamilyPdu : public Pdu -{ -protected: - - public: - EntityInformationFamilyPdu(); - virtual ~EntityInformationFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityInformationFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityManagementFamilyPdu.cpp b/src/dis6/EntityManagementFamilyPdu.cpp deleted file mode 100644 index 32686f27..00000000 --- a/src/dis6/EntityManagementFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -EntityManagementFamilyPdu::EntityManagementFamilyPdu() : Pdu() - -{ - setProtocolFamily( 7 ); -} - -EntityManagementFamilyPdu::~EntityManagementFamilyPdu() -{ -} - -void EntityManagementFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void EntityManagementFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool EntityManagementFamilyPdu::operator ==(const EntityManagementFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int EntityManagementFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityManagementFamilyPdu.h b/src/dis6/EntityManagementFamilyPdu.h deleted file mode 100644 index baa8641e..00000000 --- a/src/dis6/EntityManagementFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.9. Common superclass for EntityManagment PDUs, including aggregate state, isGroupOf, TransferControLRequest, and isPartOf - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EntityManagementFamilyPdu : public Pdu -{ -protected: - - public: - EntityManagementFamilyPdu(); - virtual ~EntityManagementFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityManagementFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityStatePdu.cpp b/src/dis6/EntityStatePdu.cpp deleted file mode 100644 index 7ae48961..00000000 --- a/src/dis6/EntityStatePdu.cpp +++ /dev/null @@ -1,331 +0,0 @@ -#include - -using namespace DIS; - - -EntityStatePdu::EntityStatePdu() : EntityInformationFamilyPdu(), - _entityID(), - _forceId(0), - _numberOfArticulationParameters(0), - _entityType(), - _alternativeEntityType(), - _entityLinearVelocity(), - _entityLocation(), - _entityOrientation(), - _entityAppearance(0), - _deadReckoningParameters(), - _marking(), - _capabilities(0) -{ - setPduType( 1 ); -} - -EntityStatePdu::~EntityStatePdu() -{ - _articulationParameters.clear(); -} - -EntityID& EntityStatePdu::getEntityID() -{ - return _entityID; -} - -const EntityID& EntityStatePdu::getEntityID() const -{ - return _entityID; -} - -void EntityStatePdu::setEntityID(const EntityID &pX) -{ - _entityID = pX; -} - -unsigned char EntityStatePdu::getForceId() const -{ - return _forceId; -} - -void EntityStatePdu::setForceId(unsigned char pX) -{ - _forceId = pX; -} - -char EntityStatePdu::getNumberOfArticulationParameters() const -{ - return _articulationParameters.size(); -} - -EntityType& EntityStatePdu::getEntityType() -{ - return _entityType; -} - -const EntityType& EntityStatePdu::getEntityType() const -{ - return _entityType; -} - -void EntityStatePdu::setEntityType(const EntityType &pX) -{ - _entityType = pX; -} - -EntityType& EntityStatePdu::getAlternativeEntityType() -{ - return _alternativeEntityType; -} - -const EntityType& EntityStatePdu::getAlternativeEntityType() const -{ - return _alternativeEntityType; -} - -void EntityStatePdu::setAlternativeEntityType(const EntityType &pX) -{ - _alternativeEntityType = pX; -} - -Vector3Float& EntityStatePdu::getEntityLinearVelocity() -{ - return _entityLinearVelocity; -} - -const Vector3Float& EntityStatePdu::getEntityLinearVelocity() const -{ - return _entityLinearVelocity; -} - -void EntityStatePdu::setEntityLinearVelocity(const Vector3Float &pX) -{ - _entityLinearVelocity = pX; -} - -Vector3Double& EntityStatePdu::getEntityLocation() -{ - return _entityLocation; -} - -const Vector3Double& EntityStatePdu::getEntityLocation() const -{ - return _entityLocation; -} - -void EntityStatePdu::setEntityLocation(const Vector3Double &pX) -{ - _entityLocation = pX; -} - -Orientation& EntityStatePdu::getEntityOrientation() -{ - return _entityOrientation; -} - -const Orientation& EntityStatePdu::getEntityOrientation() const -{ - return _entityOrientation; -} - -void EntityStatePdu::setEntityOrientation(const Orientation &pX) -{ - _entityOrientation = pX; -} - -int EntityStatePdu::getEntityAppearance() const -{ - return _entityAppearance; -} - -void EntityStatePdu::setEntityAppearance(int pX) -{ - _entityAppearance = pX; -} - -DeadReckoningParameter& EntityStatePdu::getDeadReckoningParameters() -{ - return _deadReckoningParameters; -} - -const DeadReckoningParameter& EntityStatePdu::getDeadReckoningParameters() const -{ - return _deadReckoningParameters; -} - -void EntityStatePdu::setDeadReckoningParameters(const DeadReckoningParameter &pX) -{ - _deadReckoningParameters = pX; -} - -Marking& EntityStatePdu::getMarking() -{ - return _marking; -} - -const Marking& EntityStatePdu::getMarking() const -{ - return _marking; -} - -void EntityStatePdu::setMarking(const Marking &pX) -{ - _marking = pX; -} - -int EntityStatePdu::getCapabilities() const -{ - return _capabilities; -} - -void EntityStatePdu::setCapabilities(int pX) -{ - _capabilities = pX; -} - -std::vector& EntityStatePdu::getArticulationParameters() -{ - return _articulationParameters; -} - -const std::vector& EntityStatePdu::getArticulationParameters() const -{ - return _articulationParameters; -} - -void EntityStatePdu::setArticulationParameters(const std::vector& pX) -{ - _articulationParameters = pX; -} - -void EntityStatePdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _entityID.marshal(dataStream); - dataStream << _forceId; - dataStream << ( char )_articulationParameters.size(); - _entityType.marshal(dataStream); - _alternativeEntityType.marshal(dataStream); - _entityLinearVelocity.marshal(dataStream); - _entityLocation.marshal(dataStream); - _entityOrientation.marshal(dataStream); - dataStream << _entityAppearance; - _deadReckoningParameters.marshal(dataStream); - _marking.marshal(dataStream); - dataStream << _capabilities; - - for(size_t idx = 0; idx < _articulationParameters.size(); idx++) - { - ArticulationParameter x = _articulationParameters[idx]; - x.marshal(dataStream); - } - -} - -void EntityStatePdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _entityID.unmarshal(dataStream); - dataStream >> _forceId; - dataStream >> _numberOfArticulationParameters; - _entityType.unmarshal(dataStream); - _alternativeEntityType.unmarshal(dataStream); - _entityLinearVelocity.unmarshal(dataStream); - _entityLocation.unmarshal(dataStream); - _entityOrientation.unmarshal(dataStream); - dataStream >> _entityAppearance; - _deadReckoningParameters.unmarshal(dataStream); - _marking.unmarshal(dataStream); - dataStream >> _capabilities; - - _articulationParameters.clear(); - for(char idx = 0; idx < _numberOfArticulationParameters; idx++) - { - ArticulationParameter x; - x.unmarshal(dataStream); - _articulationParameters.push_back(x); - } -} - - -bool EntityStatePdu::operator ==(const EntityStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_entityID == rhs._entityID) ) ivarsEqual = false; - if( ! (_forceId == rhs._forceId) ) ivarsEqual = false; - if( ! (_entityType == rhs._entityType) ) ivarsEqual = false; - if( ! (_alternativeEntityType == rhs._alternativeEntityType) ) ivarsEqual = false; - if( ! (_entityLinearVelocity == rhs._entityLinearVelocity) ) ivarsEqual = false; - if( ! (_entityLocation == rhs._entityLocation) ) ivarsEqual = false; - if( ! (_entityOrientation == rhs._entityOrientation) ) ivarsEqual = false; - if( ! (_entityAppearance == rhs._entityAppearance) ) ivarsEqual = false; - if( ! (_deadReckoningParameters == rhs._deadReckoningParameters) ) ivarsEqual = false; - if( ! (_marking == rhs._marking) ) ivarsEqual = false; - if( ! (_capabilities == rhs._capabilities) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _articulationParameters.size(); idx++) - { - if( ! ( _articulationParameters[idx] == rhs._articulationParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EntityStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID - marshalSize = marshalSize + 1; // _forceId - marshalSize = marshalSize + 1; // _numberOfArticulationParameters - marshalSize = marshalSize + _entityType.getMarshalledSize(); // _entityType - marshalSize = marshalSize + _alternativeEntityType.getMarshalledSize(); // _alternativeEntityType - marshalSize = marshalSize + _entityLinearVelocity.getMarshalledSize(); // _entityLinearVelocity - marshalSize = marshalSize + _entityLocation.getMarshalledSize(); // _entityLocation - marshalSize = marshalSize + _entityOrientation.getMarshalledSize(); // _entityOrientation - marshalSize = marshalSize + 4; // _entityAppearance - marshalSize = marshalSize + _deadReckoningParameters.getMarshalledSize(); // _deadReckoningParameters - marshalSize = marshalSize + _marking.getMarshalledSize(); // _marking - marshalSize = marshalSize + 4; // _capabilities - - for(unsigned long long idx=0; idx < _articulationParameters.size(); idx++) - { - ArticulationParameter listElement = _articulationParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityStatePdu.h b/src/dis6/EntityStatePdu.h deleted file mode 100644 index 2bd62157..00000000 --- a/src/dis6/EntityStatePdu.h +++ /dev/null @@ -1,158 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.3.1. Represents the postion and state of one entity in the world. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EntityStatePdu : public EntityInformationFamilyPdu -{ -protected: - /** Unique ID for an entity that is tied to this state information */ - EntityID _entityID; - - /** What force this entity is affiliated with, eg red, blue, neutral, etc */ - unsigned char _forceId; - - /** How many articulation parameters are in the variable length list */ - char _numberOfArticulationParameters; - - /** Describes the type of entity in the world */ - EntityType _entityType; - - EntityType _alternativeEntityType; - - /** Describes the speed of the entity in the world */ - Vector3Float _entityLinearVelocity; - - /** describes the location of the entity in the world */ - Vector3Double _entityLocation; - - /** describes the orientation of the entity, in euler angles */ - Orientation _entityOrientation; - - /** a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. */ - int _entityAppearance; - - /** parameters used for dead reckoning */ - DeadReckoningParameter _deadReckoningParameters; - - /** characters that can be used for debugging, or to draw unique strings on the side of entities in the world */ - Marking _marking; - - /** a series of bit flags */ - int _capabilities; - - /** variable length list of articulation parameters */ - std::vector _articulationParameters; - - - public: - EntityStatePdu(); - virtual ~EntityStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityID(); - const EntityID& getEntityID() const; - void setEntityID(const EntityID &pX); - - unsigned char getForceId() const; - void setForceId(unsigned char pX); - - char getNumberOfArticulationParameters() const; - - EntityType& getEntityType(); - const EntityType& getEntityType() const; - void setEntityType(const EntityType &pX); - - EntityType& getAlternativeEntityType(); - const EntityType& getAlternativeEntityType() const; - void setAlternativeEntityType(const EntityType &pX); - - Vector3Float& getEntityLinearVelocity(); - const Vector3Float& getEntityLinearVelocity() const; - void setEntityLinearVelocity(const Vector3Float &pX); - - Vector3Double& getEntityLocation(); - const Vector3Double& getEntityLocation() const; - void setEntityLocation(const Vector3Double &pX); - - Orientation& getEntityOrientation(); - const Orientation& getEntityOrientation() const; - void setEntityOrientation(const Orientation &pX); - - int getEntityAppearance() const; - void setEntityAppearance(int pX); - - DeadReckoningParameter& getDeadReckoningParameters(); - const DeadReckoningParameter& getDeadReckoningParameters() const; - void setDeadReckoningParameters(const DeadReckoningParameter &pX); - - Marking& getMarking(); - const Marking& getMarking() const; - void setMarking(const Marking &pX); - - int getCapabilities() const; - void setCapabilities(int pX); - - std::vector& getArticulationParameters(); - const std::vector& getArticulationParameters() const; - void setArticulationParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityStateUpdatePdu.cpp b/src/dis6/EntityStateUpdatePdu.cpp deleted file mode 100644 index fb486146..00000000 --- a/src/dis6/EntityStateUpdatePdu.cpp +++ /dev/null @@ -1,237 +0,0 @@ -#include - -using namespace DIS; - - -EntityStateUpdatePdu::EntityStateUpdatePdu() : EntityInformationFamilyPdu(), - _entityID(), - _padding1(0), - _numberOfArticulationParameters(0), - _entityLinearVelocity(), - _entityLocation(), - _entityOrientation(), - _entityAppearance(0) -{ - setPduType( 67 ); - setProtocolFamily( 1 ); -} - -EntityStateUpdatePdu::~EntityStateUpdatePdu() -{ - _articulationParameters.clear(); -} - -EntityID& EntityStateUpdatePdu::getEntityID() -{ - return _entityID; -} - -const EntityID& EntityStateUpdatePdu::getEntityID() const -{ - return _entityID; -} - -void EntityStateUpdatePdu::setEntityID(const EntityID &pX) -{ - _entityID = pX; -} - -char EntityStateUpdatePdu::getPadding1() const -{ - return _padding1; -} - -void EntityStateUpdatePdu::setPadding1(char pX) -{ - _padding1 = pX; -} - -unsigned char EntityStateUpdatePdu::getNumberOfArticulationParameters() const -{ - return _articulationParameters.size(); -} - -Vector3Float& EntityStateUpdatePdu::getEntityLinearVelocity() -{ - return _entityLinearVelocity; -} - -const Vector3Float& EntityStateUpdatePdu::getEntityLinearVelocity() const -{ - return _entityLinearVelocity; -} - -void EntityStateUpdatePdu::setEntityLinearVelocity(const Vector3Float &pX) -{ - _entityLinearVelocity = pX; -} - -Vector3Double& EntityStateUpdatePdu::getEntityLocation() -{ - return _entityLocation; -} - -const Vector3Double& EntityStateUpdatePdu::getEntityLocation() const -{ - return _entityLocation; -} - -void EntityStateUpdatePdu::setEntityLocation(const Vector3Double &pX) -{ - _entityLocation = pX; -} - -Orientation& EntityStateUpdatePdu::getEntityOrientation() -{ - return _entityOrientation; -} - -const Orientation& EntityStateUpdatePdu::getEntityOrientation() const -{ - return _entityOrientation; -} - -void EntityStateUpdatePdu::setEntityOrientation(const Orientation &pX) -{ - _entityOrientation = pX; -} - -int EntityStateUpdatePdu::getEntityAppearance() const -{ - return _entityAppearance; -} - -void EntityStateUpdatePdu::setEntityAppearance(int pX) -{ - _entityAppearance = pX; -} - -std::vector& EntityStateUpdatePdu::getArticulationParameters() -{ - return _articulationParameters; -} - -const std::vector& EntityStateUpdatePdu::getArticulationParameters() const -{ - return _articulationParameters; -} - -void EntityStateUpdatePdu::setArticulationParameters(const std::vector& pX) -{ - _articulationParameters = pX; -} - -void EntityStateUpdatePdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _entityID.marshal(dataStream); - dataStream << _padding1; - dataStream << ( unsigned char )_articulationParameters.size(); - _entityLinearVelocity.marshal(dataStream); - _entityLocation.marshal(dataStream); - _entityOrientation.marshal(dataStream); - dataStream << _entityAppearance; - - for(size_t idx = 0; idx < _articulationParameters.size(); idx++) - { - ArticulationParameter x = _articulationParameters[idx]; - x.marshal(dataStream); - } - -} - -void EntityStateUpdatePdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _entityID.unmarshal(dataStream); - dataStream >> _padding1; - dataStream >> _numberOfArticulationParameters; - _entityLinearVelocity.unmarshal(dataStream); - _entityLocation.unmarshal(dataStream); - _entityOrientation.unmarshal(dataStream); - dataStream >> _entityAppearance; - - _articulationParameters.clear(); - for(size_t idx = 0; idx < _numberOfArticulationParameters; idx++) - { - ArticulationParameter x; - x.unmarshal(dataStream); - _articulationParameters.push_back(x); - } -} - - -bool EntityStateUpdatePdu::operator ==(const EntityStateUpdatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_entityID == rhs._entityID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_entityLinearVelocity == rhs._entityLinearVelocity) ) ivarsEqual = false; - if( ! (_entityLocation == rhs._entityLocation) ) ivarsEqual = false; - if( ! (_entityOrientation == rhs._entityOrientation) ) ivarsEqual = false; - if( ! (_entityAppearance == rhs._entityAppearance) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _articulationParameters.size(); idx++) - { - if( ! ( _articulationParameters[idx] == rhs._articulationParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EntityStateUpdatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID - marshalSize = marshalSize + 1; // _padding1 - marshalSize = marshalSize + 1; // _numberOfArticulationParameters - marshalSize = marshalSize + _entityLinearVelocity.getMarshalledSize(); // _entityLinearVelocity - marshalSize = marshalSize + _entityLocation.getMarshalledSize(); // _entityLocation - marshalSize = marshalSize + _entityOrientation.getMarshalledSize(); // _entityOrientation - marshalSize = marshalSize + 4; // _entityAppearance - - for(unsigned long long idx=0; idx < _articulationParameters.size(); idx++) - { - ArticulationParameter listElement = _articulationParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityStateUpdatePdu.h b/src/dis6/EntityStateUpdatePdu.h deleted file mode 100644 index c498bbb9..00000000 --- a/src/dis6/EntityStateUpdatePdu.h +++ /dev/null @@ -1,120 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// 5.3.3.4. Nonstatic information about a particular entity may be communicated by issuing an Entity State Update PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EntityStateUpdatePdu : public EntityInformationFamilyPdu -{ -protected: - /** This field shall identify the entity issuing the PDU */ - EntityID _entityID; - - /** Padding */ - char _padding1; - - /** How many articulation parameters are in the variable length list */ - unsigned char _numberOfArticulationParameters; - - /** Describes the speed of the entity in the world */ - Vector3Float _entityLinearVelocity; - - /** describes the location of the entity in the world */ - Vector3Double _entityLocation; - - /** describes the orientation of the entity, in euler angles */ - Orientation _entityOrientation; - - /** a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. */ - int _entityAppearance; - - std::vector _articulationParameters; - - - public: - EntityStateUpdatePdu(); - virtual ~EntityStateUpdatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityID(); - const EntityID& getEntityID() const; - void setEntityID(const EntityID &pX); - - char getPadding1() const; - void setPadding1(char pX); - - unsigned char getNumberOfArticulationParameters() const; - - Vector3Float& getEntityLinearVelocity(); - const Vector3Float& getEntityLinearVelocity() const; - void setEntityLinearVelocity(const Vector3Float &pX); - - Vector3Double& getEntityLocation(); - const Vector3Double& getEntityLocation() const; - void setEntityLocation(const Vector3Double &pX); - - Orientation& getEntityOrientation(); - const Orientation& getEntityOrientation() const; - void setEntityOrientation(const Orientation &pX); - - int getEntityAppearance() const; - void setEntityAppearance(int pX); - - std::vector& getArticulationParameters(); - const std::vector& getArticulationParameters() const; - void setArticulationParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityStateUpdatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityType.cpp b/src/dis6/EntityType.cpp deleted file mode 100644 index a8d86743..00000000 --- a/src/dis6/EntityType.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -EntityType::EntityType(): - _entityKind(0), - _domain(0), - _country(0), - _category(0), - _subcategory(0), - _specific(0), - _extra(0) -{ -} - -EntityType::~EntityType() -{ -} - -unsigned char EntityType::getEntityKind() const -{ - return _entityKind; -} - -void EntityType::setEntityKind(unsigned char pX) -{ - _entityKind = pX; -} - -unsigned char EntityType::getDomain() const -{ - return _domain; -} - -void EntityType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short EntityType::getCountry() const -{ - return _country; -} - -void EntityType::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char EntityType::getCategory() const -{ - return _category; -} - -void EntityType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char EntityType::getSubcategory() const -{ - return _subcategory; -} - -void EntityType::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char EntityType::getSpecific() const -{ - return _specific; -} - -void EntityType::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -unsigned char EntityType::getExtra() const -{ - return _extra; -} - -void EntityType::setExtra(unsigned char pX) -{ - _extra = pX; -} - -void EntityType::marshal(DataStream& dataStream) const -{ - dataStream << _entityKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; - dataStream << _extra; -} - -void EntityType::unmarshal(DataStream& dataStream) -{ - dataStream >> _entityKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; - dataStream >> _extra; -} - - -bool EntityType::operator ==(const EntityType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityKind == rhs._entityKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - if( ! (_extra == rhs._extra) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EntityType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _entityKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - marshalSize = marshalSize + 1; // _extra - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EntityType.h b/src/dis6/EntityType.h deleted file mode 100644 index a5d25e63..00000000 --- a/src/dis6/EntityType.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.16. Identifies the type of entity, including kind of entity, domain (surface, subsurface, air, etc) country, category, etc. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EntityType -{ -protected: - /** Kind of entity */ - unsigned char _entityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - /** specific info based on subcategory field */ - unsigned char _specific; - - unsigned char _extra; - - - public: - EntityType(); - virtual ~EntityType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getEntityKind() const; - void setEntityKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - unsigned char getExtra() const; - void setExtra(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Environment.cpp b/src/dis6/Environment.cpp deleted file mode 100644 index 26b1a571..00000000 --- a/src/dis6/Environment.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -Environment::Environment(): - _environmentType(0), - _length(0), - _index(0), - _padding1(0), - _geometry(0), - _padding2(0) -{ -} - -Environment::~Environment() -{ -} - -unsigned int Environment::getEnvironmentType() const -{ - return _environmentType; -} - -void Environment::setEnvironmentType(unsigned int pX) -{ - _environmentType = pX; -} - -unsigned char Environment::getLength() const -{ - return _length; -} - -void Environment::setLength(unsigned char pX) -{ - _length = pX; -} - -unsigned char Environment::getIndex() const -{ - return _index; -} - -void Environment::setIndex(unsigned char pX) -{ - _index = pX; -} - -unsigned char Environment::getPadding1() const -{ - return _padding1; -} - -void Environment::setPadding1(unsigned char pX) -{ - _padding1 = pX; -} - -unsigned char Environment::getGeometry() const -{ - return _geometry; -} - -void Environment::setGeometry(unsigned char pX) -{ - _geometry = pX; -} - -unsigned char Environment::getPadding2() const -{ - return _padding2; -} - -void Environment::setPadding2(unsigned char pX) -{ - _padding2 = pX; -} - -void Environment::marshal(DataStream& dataStream) const -{ - dataStream << _environmentType; - dataStream << _length; - dataStream << _index; - dataStream << _padding1; - dataStream << _geometry; - dataStream << _padding2; -} - -void Environment::unmarshal(DataStream& dataStream) -{ - dataStream >> _environmentType; - dataStream >> _length; - dataStream >> _index; - dataStream >> _padding1; - dataStream >> _geometry; - dataStream >> _padding2; -} - - -bool Environment::operator ==(const Environment& rhs) const - { - bool ivarsEqual = true; - - if( ! (_environmentType == rhs._environmentType) ) ivarsEqual = false; - if( ! (_length == rhs._length) ) ivarsEqual = false; - if( ! (_index == rhs._index) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_geometry == rhs._geometry) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Environment::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _environmentType - marshalSize = marshalSize + 1; // _length - marshalSize = marshalSize + 1; // _index - marshalSize = marshalSize + 1; // _padding1 - marshalSize = marshalSize + 1; // _geometry - marshalSize = marshalSize + 1; // _padding2 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Environment.h b/src/dis6/Environment.h deleted file mode 100644 index 5a306d14..00000000 --- a/src/dis6/Environment.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.40. Information about a geometry, a state associated with a geometry, a bounding volume, or an associated entity ID. NOTE: this class requires hand coding. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT Environment -{ -protected: - /** Record type */ - unsigned int _environmentType; - - /** length, in bits */ - unsigned char _length; - - /** Identify the sequentially numbered record index */ - unsigned char _index; - - /** padding */ - unsigned char _padding1; - - /** Geometry or state record */ - unsigned char _geometry; - - /** padding to bring the total size up to a 64 bit boundry */ - unsigned char _padding2; - - - public: - Environment(); - virtual ~Environment(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getEnvironmentType() const; - void setEnvironmentType(unsigned int pX); - - unsigned char getLength() const; - void setLength(unsigned char pX); - - unsigned char getIndex() const; - void setIndex(unsigned char pX); - - unsigned char getPadding1() const; - void setPadding1(unsigned char pX); - - unsigned char getGeometry() const; - void setGeometry(unsigned char pX); - - unsigned char getPadding2() const; - void setPadding2(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Environment& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EnvironmentalProcessPdu.cpp b/src/dis6/EnvironmentalProcessPdu.cpp deleted file mode 100644 index cd9e2fc8..00000000 --- a/src/dis6/EnvironmentalProcessPdu.cpp +++ /dev/null @@ -1,211 +0,0 @@ -#include - -using namespace DIS; - - -EnvironmentalProcessPdu::EnvironmentalProcessPdu() : SyntheticEnvironmentFamilyPdu(), - _environementalProcessID(), - _environmentType(), - _modelType(0), - _environmentStatus(0), - _numberOfEnvironmentRecords(0), - _sequenceNumber(0) -{ - setPduType( 41 ); -} - -EnvironmentalProcessPdu::~EnvironmentalProcessPdu() -{ - _environmentRecords.clear(); -} - -EntityID& EnvironmentalProcessPdu::getEnvironementalProcessID() -{ - return _environementalProcessID; -} - -const EntityID& EnvironmentalProcessPdu::getEnvironementalProcessID() const -{ - return _environementalProcessID; -} - -void EnvironmentalProcessPdu::setEnvironementalProcessID(const EntityID &pX) -{ - _environementalProcessID = pX; -} - -EntityType& EnvironmentalProcessPdu::getEnvironmentType() -{ - return _environmentType; -} - -const EntityType& EnvironmentalProcessPdu::getEnvironmentType() const -{ - return _environmentType; -} - -void EnvironmentalProcessPdu::setEnvironmentType(const EntityType &pX) -{ - _environmentType = pX; -} - -unsigned char EnvironmentalProcessPdu::getModelType() const -{ - return _modelType; -} - -void EnvironmentalProcessPdu::setModelType(unsigned char pX) -{ - _modelType = pX; -} - -unsigned char EnvironmentalProcessPdu::getEnvironmentStatus() const -{ - return _environmentStatus; -} - -void EnvironmentalProcessPdu::setEnvironmentStatus(unsigned char pX) -{ - _environmentStatus = pX; -} - -unsigned char EnvironmentalProcessPdu::getNumberOfEnvironmentRecords() const -{ - return _environmentRecords.size(); -} - -unsigned short EnvironmentalProcessPdu::getSequenceNumber() const -{ - return _sequenceNumber; -} - -void EnvironmentalProcessPdu::setSequenceNumber(unsigned short pX) -{ - _sequenceNumber = pX; -} - -std::vector& EnvironmentalProcessPdu::getEnvironmentRecords() -{ - return _environmentRecords; -} - -const std::vector& EnvironmentalProcessPdu::getEnvironmentRecords() const -{ - return _environmentRecords; -} - -void EnvironmentalProcessPdu::setEnvironmentRecords(const std::vector& pX) -{ - _environmentRecords = pX; -} - -void EnvironmentalProcessPdu::marshal(DataStream& dataStream) const -{ - SyntheticEnvironmentFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _environementalProcessID.marshal(dataStream); - _environmentType.marshal(dataStream); - dataStream << _modelType; - dataStream << _environmentStatus; - dataStream << ( unsigned char )_environmentRecords.size(); - dataStream << _sequenceNumber; - - for(size_t idx = 0; idx < _environmentRecords.size(); idx++) - { - Environment x = _environmentRecords[idx]; - x.marshal(dataStream); - } - -} - -void EnvironmentalProcessPdu::unmarshal(DataStream& dataStream) -{ - SyntheticEnvironmentFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _environementalProcessID.unmarshal(dataStream); - _environmentType.unmarshal(dataStream); - dataStream >> _modelType; - dataStream >> _environmentStatus; - dataStream >> _numberOfEnvironmentRecords; - dataStream >> _sequenceNumber; - - _environmentRecords.clear(); - for(size_t idx = 0; idx < _numberOfEnvironmentRecords; idx++) - { - Environment x; - x.unmarshal(dataStream); - _environmentRecords.push_back(x); - } -} - - -bool EnvironmentalProcessPdu::operator ==(const EnvironmentalProcessPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); - - if( ! (_environementalProcessID == rhs._environementalProcessID) ) ivarsEqual = false; - if( ! (_environmentType == rhs._environmentType) ) ivarsEqual = false; - if( ! (_modelType == rhs._modelType) ) ivarsEqual = false; - if( ! (_environmentStatus == rhs._environmentStatus) ) ivarsEqual = false; - if( ! (_sequenceNumber == rhs._sequenceNumber) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _environmentRecords.size(); idx++) - { - if( ! ( _environmentRecords[idx] == rhs._environmentRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EnvironmentalProcessPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _environementalProcessID.getMarshalledSize(); // _environementalProcessID - marshalSize = marshalSize + _environmentType.getMarshalledSize(); // _environmentType - marshalSize = marshalSize + 1; // _modelType - marshalSize = marshalSize + 1; // _environmentStatus - marshalSize = marshalSize + 1; // _numberOfEnvironmentRecords - marshalSize = marshalSize + 2; // _sequenceNumber - - for(unsigned long long idx=0; idx < _environmentRecords.size(); idx++) - { - Environment listElement = _environmentRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EnvironmentalProcessPdu.h b/src/dis6/EnvironmentalProcessPdu.h deleted file mode 100644 index 401792c4..00000000 --- a/src/dis6/EnvironmentalProcessPdu.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.11.1: Information about environmental effects and processes. This requires manual cleanup. the environmental record is variable, as is the padding. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EnvironmentalProcessPdu : public SyntheticEnvironmentFamilyPdu -{ -protected: - /** Environmental process ID */ - EntityID _environementalProcessID; - - /** Environment type */ - EntityType _environmentType; - - /** model type */ - unsigned char _modelType; - - /** Environment status */ - unsigned char _environmentStatus; - - /** number of environment records */ - unsigned char _numberOfEnvironmentRecords; - - /** PDU sequence number for the environmentla process if pdu sequencing required */ - unsigned short _sequenceNumber; - - /** environemt records */ - std::vector _environmentRecords; - - - public: - EnvironmentalProcessPdu(); - virtual ~EnvironmentalProcessPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEnvironementalProcessID(); - const EntityID& getEnvironementalProcessID() const; - void setEnvironementalProcessID(const EntityID &pX); - - EntityType& getEnvironmentType(); - const EntityType& getEnvironmentType() const; - void setEnvironmentType(const EntityType &pX); - - unsigned char getModelType() const; - void setModelType(unsigned char pX); - - unsigned char getEnvironmentStatus() const; - void setEnvironmentStatus(unsigned char pX); - - unsigned char getNumberOfEnvironmentRecords() const; - - unsigned short getSequenceNumber() const; - void setSequenceNumber(unsigned short pX); - - std::vector& getEnvironmentRecords(); - const std::vector& getEnvironmentRecords() const; - void setEnvironmentRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EnvironmentalProcessPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EventID.cpp b/src/dis6/EventID.cpp deleted file mode 100644 index db198458..00000000 --- a/src/dis6/EventID.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -EventID::EventID(): - _site(0), - _application(0), - _eventNumber(0) -{ -} - -EventID::~EventID() -{ -} - -unsigned short EventID::getSite() const -{ - return _site; -} - -void EventID::setSite(unsigned short pX) -{ - _site = pX; -} - -unsigned short EventID::getApplication() const -{ - return _application; -} - -void EventID::setApplication(unsigned short pX) -{ - _application = pX; -} - -unsigned short EventID::getEventNumber() const -{ - return _eventNumber; -} - -void EventID::setEventNumber(unsigned short pX) -{ - _eventNumber = pX; -} - -void EventID::marshal(DataStream& dataStream) const -{ - dataStream << _site; - dataStream << _application; - dataStream << _eventNumber; -} - -void EventID::unmarshal(DataStream& dataStream) -{ - dataStream >> _site; - dataStream >> _application; - dataStream >> _eventNumber; -} - - -bool EventID::operator ==(const EventID& rhs) const - { - bool ivarsEqual = true; - - if( ! (_site == rhs._site) ) ivarsEqual = false; - if( ! (_application == rhs._application) ) ivarsEqual = false; - if( ! (_eventNumber == rhs._eventNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EventID::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _site - marshalSize = marshalSize + 2; // _application - marshalSize = marshalSize + 2; // _eventNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EventID.h b/src/dis6/EventID.h deleted file mode 100644 index 409f29f2..00000000 --- a/src/dis6/EventID.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.18. Identifies a unique event in a simulation via the combination of three values - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EventID -{ -protected: - /** The site ID */ - unsigned short _site; - - /** The application ID */ - unsigned short _application; - - /** the number of the event */ - unsigned short _eventNumber; - - - public: - EventID(); - virtual ~EventID(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSite() const; - void setSite(unsigned short pX); - - unsigned short getApplication() const; - void setApplication(unsigned short pX); - - unsigned short getEventNumber() const; - void setEventNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EventID& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EventReportPdu.cpp b/src/dis6/EventReportPdu.cpp deleted file mode 100644 index 344248e7..00000000 --- a/src/dis6/EventReportPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -EventReportPdu::EventReportPdu() : SimulationManagementFamilyPdu(), - _eventType(0), - _padding1(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 21 ); -} - -EventReportPdu::~EventReportPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int EventReportPdu::getEventType() const -{ - return _eventType; -} - -void EventReportPdu::setEventType(unsigned int pX) -{ - _eventType = pX; -} - -unsigned int EventReportPdu::getPadding1() const -{ - return _padding1; -} - -void EventReportPdu::setPadding1(unsigned int pX) -{ - _padding1 = pX; -} - -unsigned int EventReportPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int EventReportPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& EventReportPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& EventReportPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void EventReportPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& EventReportPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& EventReportPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void EventReportPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void EventReportPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _eventType; - dataStream << _padding1; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void EventReportPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _eventType; - dataStream >> _padding1; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool EventReportPdu::operator ==(const EventReportPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_eventType == rhs._eventType) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EventReportPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _eventType - marshalSize = marshalSize + 4; // _padding1 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EventReportPdu.h b/src/dis6/EventReportPdu.h deleted file mode 100644 index 33635919..00000000 --- a/src/dis6/EventReportPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.11. Reports occurance of a significant event to the simulation manager. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EventReportPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Type of event */ - unsigned int _eventType; - - /** padding */ - unsigned int _padding1; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - EventReportPdu(); - virtual ~EventReportPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getEventType() const; - void setEventType(unsigned int pX); - - unsigned int getPadding1() const; - void setPadding1(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EventReportPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EventReportReliablePdu.cpp b/src/dis6/EventReportReliablePdu.cpp deleted file mode 100644 index 8e20cedf..00000000 --- a/src/dis6/EventReportReliablePdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -EventReportReliablePdu::EventReportReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _eventType(0), - _pad1(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 61 ); -} - -EventReportReliablePdu::~EventReportReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned short EventReportReliablePdu::getEventType() const -{ - return _eventType; -} - -void EventReportReliablePdu::setEventType(unsigned short pX) -{ - _eventType = pX; -} - -unsigned int EventReportReliablePdu::getPad1() const -{ - return _pad1; -} - -void EventReportReliablePdu::setPad1(unsigned int pX) -{ - _pad1 = pX; -} - -unsigned int EventReportReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int EventReportReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& EventReportReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& EventReportReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void EventReportReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& EventReportReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& EventReportReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void EventReportReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void EventReportReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _eventType; - dataStream << _pad1; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void EventReportReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _eventType; - dataStream >> _pad1; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool EventReportReliablePdu::operator ==(const EventReportReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_eventType == rhs._eventType) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EventReportReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _eventType - marshalSize = marshalSize + 4; // _pad1 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/EventReportReliablePdu.h b/src/dis6/EventReportReliablePdu.h deleted file mode 100644 index 62ddcb0e..00000000 --- a/src/dis6/EventReportReliablePdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.11: reports the occurance of a significatnt event to the simulation manager. Needs manual intervention to fix padding in variable datums. UNFINISHED. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT EventReportReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** Event type */ - unsigned short _eventType; - - /** padding */ - unsigned int _pad1; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - EventReportReliablePdu(); - virtual ~EventReportReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getEventType() const; - void setEventType(unsigned short pX); - - unsigned int getPad1() const; - void setPad1(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EventReportReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FastEntityStatePdu.cpp b/src/dis6/FastEntityStatePdu.cpp deleted file mode 100644 index 593cb115..00000000 --- a/src/dis6/FastEntityStatePdu.cpp +++ /dev/null @@ -1,760 +0,0 @@ -#include -#include - -using namespace DIS; - - -FastEntityStatePdu::FastEntityStatePdu() : EntityInformationFamilyPdu(), - _site(0), - _application(0), - _entity(0), - _forceId(0), - _numberOfArticulationParameters(0), - _entityKind(0), - _domain(0), - _country(0), - _category(0), - _subcategory(0), - _specific(0), - _extra(0), - _altEntityKind(0), - _altDomain(0), - _altCountry(0), - _altCategory(0), - _altSubcategory(0), - _altSpecific(0), - _altExtra(0), - _xVelocity(0.0), - _yVelocity(0.0), - _zVelocity(0.0), - _xLocation(0.0), - _yLocation(0.0), - _zLocation(0.0), - _psi(0.0), - _theta(0.0), - _phi(0.0), - _entityAppearance(0), - _deadReckoningAlgorithm(0), - _xAcceleration(0.0), - _yAcceleration(0.0), - _zAcceleration(0.0), - _xAngularVelocity(0.0), - _yAngularVelocity(0.0), - _zAngularVelocity(0.0), - _capabilities(0) -{ - setPduType( 1 ); - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 15; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - - // Initialize fixed length array - for(int lengthmarking= 0; lengthmarking < 12; lengthmarking++) - { - _marking[lengthmarking] = 0; - } - -} - -FastEntityStatePdu::~FastEntityStatePdu() -{ - _articulationParameters.clear(); -} - -unsigned short FastEntityStatePdu::getSite() const -{ - return _site; -} - -void FastEntityStatePdu::setSite(unsigned short pX) -{ - _site = pX; -} - -unsigned short FastEntityStatePdu::getApplication() const -{ - return _application; -} - -void FastEntityStatePdu::setApplication(unsigned short pX) -{ - _application = pX; -} - -unsigned short FastEntityStatePdu::getEntity() const -{ - return _entity; -} - -void FastEntityStatePdu::setEntity(unsigned short pX) -{ - _entity = pX; -} - -unsigned char FastEntityStatePdu::getForceId() const -{ - return _forceId; -} - -void FastEntityStatePdu::setForceId(unsigned char pX) -{ - _forceId = pX; -} - -unsigned char FastEntityStatePdu::getNumberOfArticulationParameters() const -{ - return _articulationParameters.size(); -} - -unsigned char FastEntityStatePdu::getEntityKind() const -{ - return _entityKind; -} - -void FastEntityStatePdu::setEntityKind(unsigned char pX) -{ - _entityKind = pX; -} - -unsigned char FastEntityStatePdu::getDomain() const -{ - return _domain; -} - -void FastEntityStatePdu::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short FastEntityStatePdu::getCountry() const -{ - return _country; -} - -void FastEntityStatePdu::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char FastEntityStatePdu::getCategory() const -{ - return _category; -} - -void FastEntityStatePdu::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char FastEntityStatePdu::getSubcategory() const -{ - return _subcategory; -} - -void FastEntityStatePdu::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char FastEntityStatePdu::getSpecific() const -{ - return _specific; -} - -void FastEntityStatePdu::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -unsigned char FastEntityStatePdu::getExtra() const -{ - return _extra; -} - -void FastEntityStatePdu::setExtra(unsigned char pX) -{ - _extra = pX; -} - -unsigned char FastEntityStatePdu::getAltEntityKind() const -{ - return _altEntityKind; -} - -void FastEntityStatePdu::setAltEntityKind(unsigned char pX) -{ - _altEntityKind = pX; -} - -unsigned char FastEntityStatePdu::getAltDomain() const -{ - return _altDomain; -} - -void FastEntityStatePdu::setAltDomain(unsigned char pX) -{ - _altDomain = pX; -} - -unsigned short FastEntityStatePdu::getAltCountry() const -{ - return _altCountry; -} - -void FastEntityStatePdu::setAltCountry(unsigned short pX) -{ - _altCountry = pX; -} - -unsigned char FastEntityStatePdu::getAltCategory() const -{ - return _altCategory; -} - -void FastEntityStatePdu::setAltCategory(unsigned char pX) -{ - _altCategory = pX; -} - -unsigned char FastEntityStatePdu::getAltSubcategory() const -{ - return _altSubcategory; -} - -void FastEntityStatePdu::setAltSubcategory(unsigned char pX) -{ - _altSubcategory = pX; -} - -unsigned char FastEntityStatePdu::getAltSpecific() const -{ - return _altSpecific; -} - -void FastEntityStatePdu::setAltSpecific(unsigned char pX) -{ - _altSpecific = pX; -} - -unsigned char FastEntityStatePdu::getAltExtra() const -{ - return _altExtra; -} - -void FastEntityStatePdu::setAltExtra(unsigned char pX) -{ - _altExtra = pX; -} - -float FastEntityStatePdu::getXVelocity() const -{ - return _xVelocity; -} - -void FastEntityStatePdu::setXVelocity(float pX) -{ - _xVelocity = pX; -} - -float FastEntityStatePdu::getYVelocity() const -{ - return _yVelocity; -} - -void FastEntityStatePdu::setYVelocity(float pX) -{ - _yVelocity = pX; -} - -float FastEntityStatePdu::getZVelocity() const -{ - return _zVelocity; -} - -void FastEntityStatePdu::setZVelocity(float pX) -{ - _zVelocity = pX; -} - -double FastEntityStatePdu::getXLocation() const -{ - return _xLocation; -} - -void FastEntityStatePdu::setXLocation(double pX) -{ - _xLocation = pX; -} - -double FastEntityStatePdu::getYLocation() const -{ - return _yLocation; -} - -void FastEntityStatePdu::setYLocation(double pX) -{ - _yLocation = pX; -} - -double FastEntityStatePdu::getZLocation() const -{ - return _zLocation; -} - -void FastEntityStatePdu::setZLocation(double pX) -{ - _zLocation = pX; -} - -float FastEntityStatePdu::getPsi() const -{ - return _psi; -} - -void FastEntityStatePdu::setPsi(float pX) -{ - _psi = pX; -} - -float FastEntityStatePdu::getTheta() const -{ - return _theta; -} - -void FastEntityStatePdu::setTheta(float pX) -{ - _theta = pX; -} - -float FastEntityStatePdu::getPhi() const -{ - return _phi; -} - -void FastEntityStatePdu::setPhi(float pX) -{ - _phi = pX; -} - -int FastEntityStatePdu::getEntityAppearance() const -{ - return _entityAppearance; -} - -void FastEntityStatePdu::setEntityAppearance(int pX) -{ - _entityAppearance = pX; -} - -unsigned char FastEntityStatePdu::getDeadReckoningAlgorithm() const -{ - return _deadReckoningAlgorithm; -} - -void FastEntityStatePdu::setDeadReckoningAlgorithm(unsigned char pX) -{ - _deadReckoningAlgorithm = pX; -} - -char* FastEntityStatePdu::getOtherParameters() -{ - return _otherParameters; -} - -const char* FastEntityStatePdu::getOtherParameters() const -{ - return _otherParameters; -} - -void FastEntityStatePdu::setOtherParameters(const char* x) -{ - for(int i = 0; i < 15; i++) - { - _otherParameters[i] = x[i]; - } -} - -float FastEntityStatePdu::getXAcceleration() const -{ - return _xAcceleration; -} - -void FastEntityStatePdu::setXAcceleration(float pX) -{ - _xAcceleration = pX; -} - -float FastEntityStatePdu::getYAcceleration() const -{ - return _yAcceleration; -} - -void FastEntityStatePdu::setYAcceleration(float pX) -{ - _yAcceleration = pX; -} - -float FastEntityStatePdu::getZAcceleration() const -{ - return _zAcceleration; -} - -void FastEntityStatePdu::setZAcceleration(float pX) -{ - _zAcceleration = pX; -} - -float FastEntityStatePdu::getXAngularVelocity() const -{ - return _xAngularVelocity; -} - -void FastEntityStatePdu::setXAngularVelocity(float pX) -{ - _xAngularVelocity = pX; -} - -float FastEntityStatePdu::getYAngularVelocity() const -{ - return _yAngularVelocity; -} - -void FastEntityStatePdu::setYAngularVelocity(float pX) -{ - _yAngularVelocity = pX; -} - -float FastEntityStatePdu::getZAngularVelocity() const -{ - return _zAngularVelocity; -} - -void FastEntityStatePdu::setZAngularVelocity(float pX) -{ - _zAngularVelocity = pX; -} - -char* FastEntityStatePdu::getMarking() -{ - return _marking; -} - -const char* FastEntityStatePdu::getMarking() const -{ - return _marking; -} - -void FastEntityStatePdu::setMarking(const char* x) -{ - for(int i = 0; i < 12; i++) - { - _marking[i] = x[i]; - } -} - -// An alternate method to set the value if this could be a string. This is not strictly comnpliant with the DIS standard. -void FastEntityStatePdu::setByStringMarking(const char* x) -{ - std::strncpy(_marking, x, 12-1); - _marking[12 -1] = '\0'; -} - -int FastEntityStatePdu::getCapabilities() const -{ - return _capabilities; -} - -void FastEntityStatePdu::setCapabilities(int pX) -{ - _capabilities = pX; -} - -std::vector& FastEntityStatePdu::getArticulationParameters() -{ - return _articulationParameters; -} - -const std::vector& FastEntityStatePdu::getArticulationParameters() const -{ - return _articulationParameters; -} - -void FastEntityStatePdu::setArticulationParameters(const std::vector& pX) -{ - _articulationParameters = pX; -} - -void FastEntityStatePdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _site; - dataStream << _application; - dataStream << _entity; - dataStream << _forceId; - dataStream << ( char )_articulationParameters.size(); - dataStream << _entityKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; - dataStream << _extra; - dataStream << _altEntityKind; - dataStream << _altDomain; - dataStream << _altCountry; - dataStream << _altCategory; - dataStream << _altSubcategory; - dataStream << _altSpecific; - dataStream << _altExtra; - dataStream << _xVelocity; - dataStream << _yVelocity; - dataStream << _zVelocity; - dataStream << _xLocation; - dataStream << _yLocation; - dataStream << _zLocation; - dataStream << _psi; - dataStream << _theta; - dataStream << _phi; - dataStream << _entityAppearance; - dataStream << _deadReckoningAlgorithm; - - for(size_t idx = 0; idx < 15; idx++) - { - dataStream << _otherParameters[idx]; - } - - dataStream << _xAcceleration; - dataStream << _yAcceleration; - dataStream << _zAcceleration; - dataStream << _xAngularVelocity; - dataStream << _yAngularVelocity; - dataStream << _zAngularVelocity; - - for(size_t idx = 0; idx < 12; idx++) - { - dataStream << _marking[idx]; - } - - dataStream << _capabilities; - - for(size_t idx = 0; idx < _articulationParameters.size(); idx++) - { - ArticulationParameter x = _articulationParameters[idx]; - x.marshal(dataStream); - } - -} - -void FastEntityStatePdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _site; - dataStream >> _application; - dataStream >> _entity; - dataStream >> _forceId; - dataStream >> _numberOfArticulationParameters; - dataStream >> _entityKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; - dataStream >> _extra; - dataStream >> _altEntityKind; - dataStream >> _altDomain; - dataStream >> _altCountry; - dataStream >> _altCategory; - dataStream >> _altSubcategory; - dataStream >> _altSpecific; - dataStream >> _altExtra; - dataStream >> _xVelocity; - dataStream >> _yVelocity; - dataStream >> _zVelocity; - dataStream >> _xLocation; - dataStream >> _yLocation; - dataStream >> _zLocation; - dataStream >> _psi; - dataStream >> _theta; - dataStream >> _phi; - dataStream >> _entityAppearance; - dataStream >> _deadReckoningAlgorithm; - - for(size_t idx = 0; idx < 15; idx++) - { - dataStream >> _otherParameters[idx]; - } - - dataStream >> _xAcceleration; - dataStream >> _yAcceleration; - dataStream >> _zAcceleration; - dataStream >> _xAngularVelocity; - dataStream >> _yAngularVelocity; - dataStream >> _zAngularVelocity; - - for(size_t idx = 0; idx < 12; idx++) - { - dataStream >> _marking[idx]; - } - - dataStream >> _capabilities; - - _articulationParameters.clear(); - for(unsigned char idx = 0; idx < _numberOfArticulationParameters; idx++) - { - ArticulationParameter x; - x.unmarshal(dataStream); - _articulationParameters.push_back(x); - } -} - - -bool FastEntityStatePdu::operator ==(const FastEntityStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_site == rhs._site) ) ivarsEqual = false; - if( ! (_application == rhs._application) ) ivarsEqual = false; - if( ! (_entity == rhs._entity) ) ivarsEqual = false; - if( ! (_forceId == rhs._forceId) ) ivarsEqual = false; - if( ! (_entityKind == rhs._entityKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - if( ! (_extra == rhs._extra) ) ivarsEqual = false; - if( ! (_altEntityKind == rhs._altEntityKind) ) ivarsEqual = false; - if( ! (_altDomain == rhs._altDomain) ) ivarsEqual = false; - if( ! (_altCountry == rhs._altCountry) ) ivarsEqual = false; - if( ! (_altCategory == rhs._altCategory) ) ivarsEqual = false; - if( ! (_altSubcategory == rhs._altSubcategory) ) ivarsEqual = false; - if( ! (_altSpecific == rhs._altSpecific) ) ivarsEqual = false; - if( ! (_altExtra == rhs._altExtra) ) ivarsEqual = false; - if( ! (_xVelocity == rhs._xVelocity) ) ivarsEqual = false; - if( ! (_yVelocity == rhs._yVelocity) ) ivarsEqual = false; - if( ! (_zVelocity == rhs._zVelocity) ) ivarsEqual = false; - if( ! (_xLocation == rhs._xLocation) ) ivarsEqual = false; - if( ! (_yLocation == rhs._yLocation) ) ivarsEqual = false; - if( ! (_zLocation == rhs._zLocation) ) ivarsEqual = false; - if( ! (_psi == rhs._psi) ) ivarsEqual = false; - if( ! (_theta == rhs._theta) ) ivarsEqual = false; - if( ! (_phi == rhs._phi) ) ivarsEqual = false; - if( ! (_entityAppearance == rhs._entityAppearance) ) ivarsEqual = false; - if( ! (_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 15; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - if( ! (_xAcceleration == rhs._xAcceleration) ) ivarsEqual = false; - if( ! (_yAcceleration == rhs._yAcceleration) ) ivarsEqual = false; - if( ! (_zAcceleration == rhs._zAcceleration) ) ivarsEqual = false; - if( ! (_xAngularVelocity == rhs._xAngularVelocity) ) ivarsEqual = false; - if( ! (_yAngularVelocity == rhs._yAngularVelocity) ) ivarsEqual = false; - if( ! (_zAngularVelocity == rhs._zAngularVelocity) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 12; idx++) - { - if(!(_marking[idx] == rhs._marking[idx]) ) ivarsEqual = false; - } - - if( ! (_capabilities == rhs._capabilities) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _articulationParameters.size(); idx++) - { - if( ! ( _articulationParameters[idx] == rhs._articulationParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int FastEntityStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _site - marshalSize = marshalSize + 2; // _application - marshalSize = marshalSize + 2; // _entity - marshalSize = marshalSize + 1; // _forceId - marshalSize = marshalSize + 1; // _numberOfArticulationParameters - marshalSize = marshalSize + 1; // _entityKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - marshalSize = marshalSize + 1; // _extra - marshalSize = marshalSize + 1; // _altEntityKind - marshalSize = marshalSize + 1; // _altDomain - marshalSize = marshalSize + 2; // _altCountry - marshalSize = marshalSize + 1; // _altCategory - marshalSize = marshalSize + 1; // _altSubcategory - marshalSize = marshalSize + 1; // _altSpecific - marshalSize = marshalSize + 1; // _altExtra - marshalSize = marshalSize + 4; // _xVelocity - marshalSize = marshalSize + 4; // _yVelocity - marshalSize = marshalSize + 4; // _zVelocity - marshalSize = marshalSize + 8; // _xLocation - marshalSize = marshalSize + 8; // _yLocation - marshalSize = marshalSize + 8; // _zLocation - marshalSize = marshalSize + 4; // _psi - marshalSize = marshalSize + 4; // _theta - marshalSize = marshalSize + 4; // _phi - marshalSize = marshalSize + 4; // _entityAppearance - marshalSize = marshalSize + 1; // _deadReckoningAlgorithm - marshalSize = marshalSize + 15 * 1; // _otherParameters - marshalSize = marshalSize + 4; // _xAcceleration - marshalSize = marshalSize + 4; // _yAcceleration - marshalSize = marshalSize + 4; // _zAcceleration - marshalSize = marshalSize + 4; // _xAngularVelocity - marshalSize = marshalSize + 4; // _yAngularVelocity - marshalSize = marshalSize + 4; // _zAngularVelocity - marshalSize = marshalSize + 12 * 1; // _marking - marshalSize = marshalSize + 4; // _capabilities - - for(unsigned long long idx=0; idx < _articulationParameters.size(); idx++) - { - ArticulationParameter listElement = _articulationParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FastEntityStatePdu.h b/src/dis6/FastEntityStatePdu.h deleted file mode 100644 index f1094477..00000000 --- a/src/dis6/FastEntityStatePdu.h +++ /dev/null @@ -1,303 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.3.1. Represents the postion and state of one entity in the world. This is identical in function to entity state pdu, but generates less garbage to collect in the Java world. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT FastEntityStatePdu : public EntityInformationFamilyPdu -{ -protected: - /** The site ID */ - unsigned short _site; - - /** The application ID */ - unsigned short _application; - - /** the entity ID */ - unsigned short _entity; - - /** what force this entity is affiliated with, eg red, blue, neutral, etc */ - unsigned char _forceId; - - /** How many articulation parameters are in the variable length list */ - unsigned char _numberOfArticulationParameters; - - /** Kind of entity */ - unsigned char _entityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - /** specific info based on subcategory field */ - unsigned char _specific; - - unsigned char _extra; - - /** Kind of entity */ - unsigned char _altEntityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _altDomain; - - /** country to which the design of the entity is attributed */ - unsigned short _altCountry; - - /** category of entity */ - unsigned char _altCategory; - - /** subcategory of entity */ - unsigned char _altSubcategory; - - /** specific info based on subcategory field */ - unsigned char _altSpecific; - - unsigned char _altExtra; - - /** X velo */ - float _xVelocity; - - /** y Value */ - float _yVelocity; - - /** Z value */ - float _zVelocity; - - /** X value */ - double _xLocation; - - /** y Value */ - double _yLocation; - - /** Z value */ - double _zLocation; - - float _psi; - - float _theta; - - float _phi; - - /** a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. */ - int _entityAppearance; - - /** enumeration of what dead reckoning algorighm to use */ - unsigned char _deadReckoningAlgorithm; - - /** other parameters to use in the dead reckoning algorithm */ - char _otherParameters[15]; - - /** X value */ - float _xAcceleration; - - /** y Value */ - float _yAcceleration; - - /** Z value */ - float _zAcceleration; - - /** X value */ - float _xAngularVelocity; - - /** y Value */ - float _yAngularVelocity; - - /** Z value */ - float _zAngularVelocity; - - /** characters that can be used for debugging, or to draw unique strings on the side of entities in the world */ - char _marking[12]; - - /** a series of bit flags */ - int _capabilities; - - /** variable length list of articulation parameters */ - std::vector _articulationParameters; - - - public: - FastEntityStatePdu(); - virtual ~FastEntityStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSite() const; - void setSite(unsigned short pX); - - unsigned short getApplication() const; - void setApplication(unsigned short pX); - - unsigned short getEntity() const; - void setEntity(unsigned short pX); - - unsigned char getForceId() const; - void setForceId(unsigned char pX); - - unsigned char getNumberOfArticulationParameters() const; - - unsigned char getEntityKind() const; - void setEntityKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - unsigned char getExtra() const; - void setExtra(unsigned char pX); - - unsigned char getAltEntityKind() const; - void setAltEntityKind(unsigned char pX); - - unsigned char getAltDomain() const; - void setAltDomain(unsigned char pX); - - unsigned short getAltCountry() const; - void setAltCountry(unsigned short pX); - - unsigned char getAltCategory() const; - void setAltCategory(unsigned char pX); - - unsigned char getAltSubcategory() const; - void setAltSubcategory(unsigned char pX); - - unsigned char getAltSpecific() const; - void setAltSpecific(unsigned char pX); - - unsigned char getAltExtra() const; - void setAltExtra(unsigned char pX); - - float getXVelocity() const; - void setXVelocity(float pX); - - float getYVelocity() const; - void setYVelocity(float pX); - - float getZVelocity() const; - void setZVelocity(float pX); - - double getXLocation() const; - void setXLocation(double pX); - - double getYLocation() const; - void setYLocation(double pX); - - double getZLocation() const; - void setZLocation(double pX); - - float getPsi() const; - void setPsi(float pX); - - float getTheta() const; - void setTheta(float pX); - - float getPhi() const; - void setPhi(float pX); - - int getEntityAppearance() const; - void setEntityAppearance(int pX); - - unsigned char getDeadReckoningAlgorithm() const; - void setDeadReckoningAlgorithm(unsigned char pX); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - float getXAcceleration() const; - void setXAcceleration(float pX); - - float getYAcceleration() const; - void setYAcceleration(float pX); - - float getZAcceleration() const; - void setZAcceleration(float pX); - - float getXAngularVelocity() const; - void setXAngularVelocity(float pX); - - float getYAngularVelocity() const; - void setYAngularVelocity(float pX); - - float getZAngularVelocity() const; - void setZAngularVelocity(float pX); - - char* getMarking(); - const char* getMarking() const; - void setMarking( const char* pX); - void setByStringMarking(const char* pX); - - int getCapabilities() const; - void setCapabilities(int pX); - - std::vector& getArticulationParameters(); - const std::vector& getArticulationParameters() const; - void setArticulationParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FastEntityStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FirePdu.cpp b/src/dis6/FirePdu.cpp deleted file mode 100644 index 0780c3d0..00000000 --- a/src/dis6/FirePdu.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#include - -using namespace DIS; - - -FirePdu::FirePdu() : WarfareFamilyPdu(), - _munitionID(), - _eventID(), - _fireMissionIndex(0), - _locationInWorldCoordinates(), - _burstDescriptor(), - _velocity(), - _range(0.0) -{ - setPduType( 2 ); -} - -FirePdu::~FirePdu() -{ -} - -EntityID& FirePdu::getMunitionID() -{ - return _munitionID; -} - -const EntityID& FirePdu::getMunitionID() const -{ - return _munitionID; -} - -void FirePdu::setMunitionID(const EntityID &pX) -{ - _munitionID = pX; -} - -EventID& FirePdu::getEventID() -{ - return _eventID; -} - -const EventID& FirePdu::getEventID() const -{ - return _eventID; -} - -void FirePdu::setEventID(const EventID &pX) -{ - _eventID = pX; -} - -int FirePdu::getFireMissionIndex() const -{ - return _fireMissionIndex; -} - -void FirePdu::setFireMissionIndex(int pX) -{ - _fireMissionIndex = pX; -} - -Vector3Double& FirePdu::getLocationInWorldCoordinates() -{ - return _locationInWorldCoordinates; -} - -const Vector3Double& FirePdu::getLocationInWorldCoordinates() const -{ - return _locationInWorldCoordinates; -} - -void FirePdu::setLocationInWorldCoordinates(const Vector3Double &pX) -{ - _locationInWorldCoordinates = pX; -} - -BurstDescriptor& FirePdu::getBurstDescriptor() -{ - return _burstDescriptor; -} - -const BurstDescriptor& FirePdu::getBurstDescriptor() const -{ - return _burstDescriptor; -} - -void FirePdu::setBurstDescriptor(const BurstDescriptor &pX) -{ - _burstDescriptor = pX; -} - -Vector3Float& FirePdu::getVelocity() -{ - return _velocity; -} - -const Vector3Float& FirePdu::getVelocity() const -{ - return _velocity; -} - -void FirePdu::setVelocity(const Vector3Float &pX) -{ - _velocity = pX; -} - -float FirePdu::getRange() const -{ - return _range; -} - -void FirePdu::setRange(float pX) -{ - _range = pX; -} - -void FirePdu::marshal(DataStream& dataStream) const -{ - WarfareFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _munitionID.marshal(dataStream); - _eventID.marshal(dataStream); - dataStream << _fireMissionIndex; - _locationInWorldCoordinates.marshal(dataStream); - _burstDescriptor.marshal(dataStream); - _velocity.marshal(dataStream); - dataStream << _range; -} - -void FirePdu::unmarshal(DataStream& dataStream) -{ - WarfareFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _munitionID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - dataStream >> _fireMissionIndex; - _locationInWorldCoordinates.unmarshal(dataStream); - _burstDescriptor.unmarshal(dataStream); - _velocity.unmarshal(dataStream); - dataStream >> _range; -} - - -bool FirePdu::operator ==(const FirePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = WarfareFamilyPdu::operator==(rhs); - - if( ! (_munitionID == rhs._munitionID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_fireMissionIndex == rhs._fireMissionIndex) ) ivarsEqual = false; - if( ! (_locationInWorldCoordinates == rhs._locationInWorldCoordinates) ) ivarsEqual = false; - if( ! (_burstDescriptor == rhs._burstDescriptor) ) ivarsEqual = false; - if( ! (_velocity == rhs._velocity) ) ivarsEqual = false; - if( ! (_range == rhs._range) ) ivarsEqual = false; - - return ivarsEqual; - } - -int FirePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = WarfareFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _munitionID.getMarshalledSize(); // _munitionID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + 4; // _fireMissionIndex - marshalSize = marshalSize + _locationInWorldCoordinates.getMarshalledSize(); // _locationInWorldCoordinates - marshalSize = marshalSize + _burstDescriptor.getMarshalledSize(); // _burstDescriptor - marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity - marshalSize = marshalSize + 4; // _range - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FirePdu.h b/src/dis6/FirePdu.h deleted file mode 100644 index f5d28a76..00000000 --- a/src/dis6/FirePdu.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Sectioin 5.3.4.1. Information about someone firing something. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT FirePdu : public WarfareFamilyPdu -{ -protected: - /** ID of the munition that is being shot */ - EntityID _munitionID; - - /** ID of event */ - EventID _eventID; - - int _fireMissionIndex; - - /** location of the firing event */ - Vector3Double _locationInWorldCoordinates; - - /** Describes munitions used in the firing event */ - BurstDescriptor _burstDescriptor; - - /** Velocity of the ammunition */ - Vector3Float _velocity; - - /** range to the target */ - float _range; - - - public: - FirePdu(); - virtual ~FirePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getMunitionID(); - const EntityID& getMunitionID() const; - void setMunitionID(const EntityID &pX); - - EventID& getEventID(); - const EventID& getEventID() const; - void setEventID(const EventID &pX); - - int getFireMissionIndex() const; - void setFireMissionIndex(int pX); - - Vector3Double& getLocationInWorldCoordinates(); - const Vector3Double& getLocationInWorldCoordinates() const; - void setLocationInWorldCoordinates(const Vector3Double &pX); - - BurstDescriptor& getBurstDescriptor(); - const BurstDescriptor& getBurstDescriptor() const; - void setBurstDescriptor(const BurstDescriptor &pX); - - Vector3Float& getVelocity(); - const Vector3Float& getVelocity() const; - void setVelocity(const Vector3Float &pX); - - float getRange() const; - void setRange(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FirePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FixedDatum.cpp b/src/dis6/FixedDatum.cpp deleted file mode 100644 index b285dbaf..00000000 --- a/src/dis6/FixedDatum.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -FixedDatum::FixedDatum(): - _fixedDatumID(0), - _fixedDatumValue(0) -{ -} - -FixedDatum::~FixedDatum() -{ -} - -unsigned int FixedDatum::getFixedDatumID() const -{ - return _fixedDatumID; -} - -void FixedDatum::setFixedDatumID(unsigned int pX) -{ - _fixedDatumID = pX; -} - -unsigned int FixedDatum::getFixedDatumValue() const -{ - return _fixedDatumValue; -} - -void FixedDatum::setFixedDatumValue(unsigned int pX) -{ - _fixedDatumValue = pX; -} - -void FixedDatum::marshal(DataStream& dataStream) const -{ - dataStream << _fixedDatumID; - dataStream << _fixedDatumValue; -} - -void FixedDatum::unmarshal(DataStream& dataStream) -{ - dataStream >> _fixedDatumID; - dataStream >> _fixedDatumValue; -} - - -bool FixedDatum::operator ==(const FixedDatum& rhs) const - { - bool ivarsEqual = true; - - if( ! (_fixedDatumID == rhs._fixedDatumID) ) ivarsEqual = false; - if( ! (_fixedDatumValue == rhs._fixedDatumValue) ) ivarsEqual = false; - - return ivarsEqual; - } - -int FixedDatum::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _fixedDatumID - marshalSize = marshalSize + 4; // _fixedDatumValue - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FixedDatum.h b/src/dis6/FixedDatum.h deleted file mode 100644 index 2bbe751b..00000000 --- a/src/dis6/FixedDatum.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.18. Fixed Datum Record - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT FixedDatum -{ -protected: - /** ID of the fixed datum */ - unsigned int _fixedDatumID; - - /** Value for the fixed datum */ - unsigned int _fixedDatumValue; - - - public: - FixedDatum(); - virtual ~FixedDatum(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getFixedDatumID() const; - void setFixedDatumID(unsigned int pX); - - unsigned int getFixedDatumValue() const; - void setFixedDatumValue(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FixedDatum& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FourByteChunk.cpp b/src/dis6/FourByteChunk.cpp deleted file mode 100644 index 91d94d12..00000000 --- a/src/dis6/FourByteChunk.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -using namespace DIS; - - -FourByteChunk::FourByteChunk() -{ - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 4; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - -} - -FourByteChunk::~FourByteChunk() -{ -} - -char* FourByteChunk::getOtherParameters() -{ - return _otherParameters; -} - -const char* FourByteChunk::getOtherParameters() const -{ - return _otherParameters; -} - -void FourByteChunk::setOtherParameters(const char* x) -{ - for(int i = 0; i < 4; i++) - { - _otherParameters[i] = x[i]; - } -} - -void FourByteChunk::marshal(DataStream& dataStream) const -{ - - for(size_t idx = 0; idx < 4; idx++) - { - dataStream << _otherParameters[idx]; - } - -} - -void FourByteChunk::unmarshal(DataStream& dataStream) -{ - - for(size_t idx = 0; idx < 4; idx++) - { - dataStream >> _otherParameters[idx]; - } - -} - - -bool FourByteChunk::operator ==(const FourByteChunk& rhs) const - { - bool ivarsEqual = true; - - - for(unsigned char idx = 0; idx < 4; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int FourByteChunk::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4 * 1; // _otherParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FourByteChunk.h b/src/dis6/FourByteChunk.h deleted file mode 100644 index 03ba046c..00000000 --- a/src/dis6/FourByteChunk.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 32 bit piece of data - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT FourByteChunk -{ -protected: - /** four bytes of arbitrary data */ - char _otherParameters[4]; - - - public: - FourByteChunk(); - virtual ~FourByteChunk(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FourByteChunk& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FundamentalParameterData.cpp b/src/dis6/FundamentalParameterData.cpp deleted file mode 100644 index 864c7999..00000000 --- a/src/dis6/FundamentalParameterData.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include - -using namespace DIS; - - -FundamentalParameterData::FundamentalParameterData(): - _frequency(0.0), - _frequencyRange(0.0), - _effectiveRadiatedPower(0.0), - _pulseRepetitionFrequency(0.0), - _pulseWidth(0.0), - _beamAzimuthCenter(0.0), - _beamAzimuthSweep(0.0), - _beamElevationCenter(0.0), - _beamElevationSweep(0.0), - _beamSweepSync(0.0) -{ -} - -FundamentalParameterData::~FundamentalParameterData() -{ -} - -float FundamentalParameterData::getFrequency() const -{ - return _frequency; -} - -void FundamentalParameterData::setFrequency(float pX) -{ - _frequency = pX; -} - -float FundamentalParameterData::getFrequencyRange() const -{ - return _frequencyRange; -} - -void FundamentalParameterData::setFrequencyRange(float pX) -{ - _frequencyRange = pX; -} - -float FundamentalParameterData::getEffectiveRadiatedPower() const -{ - return _effectiveRadiatedPower; -} - -void FundamentalParameterData::setEffectiveRadiatedPower(float pX) -{ - _effectiveRadiatedPower = pX; -} - -float FundamentalParameterData::getPulseRepetitionFrequency() const -{ - return _pulseRepetitionFrequency; -} - -void FundamentalParameterData::setPulseRepetitionFrequency(float pX) -{ - _pulseRepetitionFrequency = pX; -} - -float FundamentalParameterData::getPulseWidth() const -{ - return _pulseWidth; -} - -void FundamentalParameterData::setPulseWidth(float pX) -{ - _pulseWidth = pX; -} - -float FundamentalParameterData::getBeamAzimuthCenter() const -{ - return _beamAzimuthCenter; -} - -void FundamentalParameterData::setBeamAzimuthCenter(float pX) -{ - _beamAzimuthCenter = pX; -} - -float FundamentalParameterData::getBeamAzimuthSweep() const -{ - return _beamAzimuthSweep; -} - -void FundamentalParameterData::setBeamAzimuthSweep(float pX) -{ - _beamAzimuthSweep = pX; -} - -float FundamentalParameterData::getBeamElevationCenter() const -{ - return _beamElevationCenter; -} - -void FundamentalParameterData::setBeamElevationCenter(float pX) -{ - _beamElevationCenter = pX; -} - -float FundamentalParameterData::getBeamElevationSweep() const -{ - return _beamElevationSweep; -} - -void FundamentalParameterData::setBeamElevationSweep(float pX) -{ - _beamElevationSweep = pX; -} - -float FundamentalParameterData::getBeamSweepSync() const -{ - return _beamSweepSync; -} - -void FundamentalParameterData::setBeamSweepSync(float pX) -{ - _beamSweepSync = pX; -} - -void FundamentalParameterData::marshal(DataStream& dataStream) const -{ - dataStream << _frequency; - dataStream << _frequencyRange; - dataStream << _effectiveRadiatedPower; - dataStream << _pulseRepetitionFrequency; - dataStream << _pulseWidth; - dataStream << _beamAzimuthCenter; - dataStream << _beamAzimuthSweep; - dataStream << _beamElevationCenter; - dataStream << _beamElevationSweep; - dataStream << _beamSweepSync; -} - -void FundamentalParameterData::unmarshal(DataStream& dataStream) -{ - dataStream >> _frequency; - dataStream >> _frequencyRange; - dataStream >> _effectiveRadiatedPower; - dataStream >> _pulseRepetitionFrequency; - dataStream >> _pulseWidth; - dataStream >> _beamAzimuthCenter; - dataStream >> _beamAzimuthSweep; - dataStream >> _beamElevationCenter; - dataStream >> _beamElevationSweep; - dataStream >> _beamSweepSync; -} - - -bool FundamentalParameterData::operator ==(const FundamentalParameterData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_frequency == rhs._frequency) ) ivarsEqual = false; - if( ! (_frequencyRange == rhs._frequencyRange) ) ivarsEqual = false; - if( ! (_effectiveRadiatedPower == rhs._effectiveRadiatedPower) ) ivarsEqual = false; - if( ! (_pulseRepetitionFrequency == rhs._pulseRepetitionFrequency) ) ivarsEqual = false; - if( ! (_pulseWidth == rhs._pulseWidth) ) ivarsEqual = false; - if( ! (_beamAzimuthCenter == rhs._beamAzimuthCenter) ) ivarsEqual = false; - if( ! (_beamAzimuthSweep == rhs._beamAzimuthSweep) ) ivarsEqual = false; - if( ! (_beamElevationCenter == rhs._beamElevationCenter) ) ivarsEqual = false; - if( ! (_beamElevationSweep == rhs._beamElevationSweep) ) ivarsEqual = false; - if( ! (_beamSweepSync == rhs._beamSweepSync) ) ivarsEqual = false; - - return ivarsEqual; - } - -int FundamentalParameterData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _frequency - marshalSize = marshalSize + 4; // _frequencyRange - marshalSize = marshalSize + 4; // _effectiveRadiatedPower - marshalSize = marshalSize + 4; // _pulseRepetitionFrequency - marshalSize = marshalSize + 4; // _pulseWidth - marshalSize = marshalSize + 4; // _beamAzimuthCenter - marshalSize = marshalSize + 4; // _beamAzimuthSweep - marshalSize = marshalSize + 4; // _beamElevationCenter - marshalSize = marshalSize + 4; // _beamElevationSweep - marshalSize = marshalSize + 4; // _beamSweepSync - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FundamentalParameterData.h b/src/dis6/FundamentalParameterData.h deleted file mode 100644 index 81d9f0ae..00000000 --- a/src/dis6/FundamentalParameterData.h +++ /dev/null @@ -1,122 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.22. Contains electromagnetic emmision regineratin parameters that are variable throughout a scenario dependent on the actions of the participants in the simulation. Also provides basic parametric data that may be used to support low-fidelity simulations. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT FundamentalParameterData -{ -protected: - /** center frequency of the emission in hertz. */ - float _frequency; - - /** Bandwidth of the frequencies corresponding to the fequency field. */ - float _frequencyRange; - - /** Effective radiated power for the emission in DdBm. For a radar noise jammer, indicates the peak of the transmitted power. */ - float _effectiveRadiatedPower; - - /** Average repetition frequency of the emission in hertz. */ - float _pulseRepetitionFrequency; - - /** Average pulse width of the emission in microseconds. */ - float _pulseWidth; - - /** Specifies the beam azimuth an elevation centers and corresponding half-angles to describe the scan volume */ - float _beamAzimuthCenter; - - /** Specifies the beam azimuth sweep to determine scan volume */ - float _beamAzimuthSweep; - - /** Specifies the beam elevation center to determine scan volume */ - float _beamElevationCenter; - - /** Specifies the beam elevation sweep to determine scan volume */ - float _beamElevationSweep; - - /** allows receiver to synchronize its regenerated scan pattern to that of the emmitter. Specifies the percentage of time a scan is through its pattern from its origion. */ - float _beamSweepSync; - - - public: - FundamentalParameterData(); - virtual ~FundamentalParameterData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getFrequency() const; - void setFrequency(float pX); - - float getFrequencyRange() const; - void setFrequencyRange(float pX); - - float getEffectiveRadiatedPower() const; - void setEffectiveRadiatedPower(float pX); - - float getPulseRepetitionFrequency() const; - void setPulseRepetitionFrequency(float pX); - - float getPulseWidth() const; - void setPulseWidth(float pX); - - float getBeamAzimuthCenter() const; - void setBeamAzimuthCenter(float pX); - - float getBeamAzimuthSweep() const; - void setBeamAzimuthSweep(float pX); - - float getBeamElevationCenter() const; - void setBeamElevationCenter(float pX); - - float getBeamElevationSweep() const; - void setBeamElevationSweep(float pX); - - float getBeamSweepSync() const; - void setBeamSweepSync(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FundamentalParameterData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FundamentalParameterDataIff.cpp b/src/dis6/FundamentalParameterDataIff.cpp deleted file mode 100644 index 7684f3fd..00000000 --- a/src/dis6/FundamentalParameterDataIff.cpp +++ /dev/null @@ -1,187 +0,0 @@ -#include - -using namespace DIS; - - -FundamentalParameterDataIff::FundamentalParameterDataIff(): - _erp(0.0), - _frequency(0.0), - _pgrf(0.0), - _pulseWidth(0.0), - _burstLength(0), - _applicableModes(0), - _pad2(0), - _pad3(0) -{ -} - -FundamentalParameterDataIff::~FundamentalParameterDataIff() -{ -} - -float FundamentalParameterDataIff::getErp() const -{ - return _erp; -} - -void FundamentalParameterDataIff::setErp(float pX) -{ - _erp = pX; -} - -float FundamentalParameterDataIff::getFrequency() const -{ - return _frequency; -} - -void FundamentalParameterDataIff::setFrequency(float pX) -{ - _frequency = pX; -} - -float FundamentalParameterDataIff::getPgrf() const -{ - return _pgrf; -} - -void FundamentalParameterDataIff::setPgrf(float pX) -{ - _pgrf = pX; -} - -float FundamentalParameterDataIff::getPulseWidth() const -{ - return _pulseWidth; -} - -void FundamentalParameterDataIff::setPulseWidth(float pX) -{ - _pulseWidth = pX; -} - -unsigned int FundamentalParameterDataIff::getBurstLength() const -{ - return _burstLength; -} - -void FundamentalParameterDataIff::setBurstLength(unsigned int pX) -{ - _burstLength = pX; -} - -unsigned char FundamentalParameterDataIff::getApplicableModes() const -{ - return _applicableModes; -} - -void FundamentalParameterDataIff::setApplicableModes(unsigned char pX) -{ - _applicableModes = pX; -} - -unsigned short FundamentalParameterDataIff::getPad2() const -{ - return _pad2; -} - -void FundamentalParameterDataIff::setPad2(unsigned short pX) -{ - _pad2 = pX; -} - -unsigned char FundamentalParameterDataIff::getPad3() const -{ - return _pad3; -} - -void FundamentalParameterDataIff::setPad3(unsigned char pX) -{ - _pad3 = pX; -} - -void FundamentalParameterDataIff::marshal(DataStream& dataStream) const -{ - dataStream << _erp; - dataStream << _frequency; - dataStream << _pgrf; - dataStream << _pulseWidth; - dataStream << _burstLength; - dataStream << _applicableModes; - dataStream << _pad2; - dataStream << _pad3; -} - -void FundamentalParameterDataIff::unmarshal(DataStream& dataStream) -{ - dataStream >> _erp; - dataStream >> _frequency; - dataStream >> _pgrf; - dataStream >> _pulseWidth; - dataStream >> _burstLength; - dataStream >> _applicableModes; - dataStream >> _pad2; - dataStream >> _pad3; -} - - -bool FundamentalParameterDataIff::operator ==(const FundamentalParameterDataIff& rhs) const - { - bool ivarsEqual = true; - - if( ! (_erp == rhs._erp) ) ivarsEqual = false; - if( ! (_frequency == rhs._frequency) ) ivarsEqual = false; - if( ! (_pgrf == rhs._pgrf) ) ivarsEqual = false; - if( ! (_pulseWidth == rhs._pulseWidth) ) ivarsEqual = false; - if( ! (_burstLength == rhs._burstLength) ) ivarsEqual = false; - if( ! (_applicableModes == rhs._applicableModes) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_pad3 == rhs._pad3) ) ivarsEqual = false; - - return ivarsEqual; - } - -int FundamentalParameterDataIff::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _erp - marshalSize = marshalSize + 4; // _frequency - marshalSize = marshalSize + 4; // _pgrf - marshalSize = marshalSize + 4; // _pulseWidth - marshalSize = marshalSize + 4; // _burstLength - marshalSize = marshalSize + 1; // _applicableModes - marshalSize = marshalSize + 2; // _pad2 - marshalSize = marshalSize + 1; // _pad3 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/FundamentalParameterDataIff.h b/src/dis6/FundamentalParameterDataIff.h deleted file mode 100644 index 66fde019..00000000 --- a/src/dis6/FundamentalParameterDataIff.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.2.45. Fundamental IFF atc data - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT FundamentalParameterDataIff -{ -protected: - /** ERP */ - float _erp; - - /** frequency */ - float _frequency; - - /** pgrf */ - float _pgrf; - - /** Pulse width */ - float _pulseWidth; - - /** Burst length */ - unsigned int _burstLength; - - /** Applicable modes enumeration */ - unsigned char _applicableModes; - - /** padding */ - unsigned short _pad2; - - /** padding */ - unsigned char _pad3; - - - public: - FundamentalParameterDataIff(); - virtual ~FundamentalParameterDataIff(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getErp() const; - void setErp(float pX); - - float getFrequency() const; - void setFrequency(float pX); - - float getPgrf() const; - void setPgrf(float pX); - - float getPulseWidth() const; - void setPulseWidth(float pX); - - unsigned int getBurstLength() const; - void setBurstLength(unsigned int pX); - - unsigned char getApplicableModes() const; - void setApplicableModes(unsigned char pX); - - unsigned short getPad2() const; - void setPad2(unsigned short pX); - - unsigned char getPad3() const; - void setPad3(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FundamentalParameterDataIff& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GridAxisRecord.cpp b/src/dis6/GridAxisRecord.cpp deleted file mode 100644 index 52dc7ca9..00000000 --- a/src/dis6/GridAxisRecord.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -GridAxisRecord::GridAxisRecord(): - _sampleType(0), - _dataRepresentation(0) -{ -} - -GridAxisRecord::~GridAxisRecord() -{ -} - -unsigned short GridAxisRecord::getSampleType() const -{ - return _sampleType; -} - -void GridAxisRecord::setSampleType(unsigned short pX) -{ - _sampleType = pX; -} - -unsigned short GridAxisRecord::getDataRepresentation() const -{ - return _dataRepresentation; -} - -void GridAxisRecord::setDataRepresentation(unsigned short pX) -{ - _dataRepresentation = pX; -} - -void GridAxisRecord::marshal(DataStream& dataStream) const -{ - dataStream << _sampleType; - dataStream << _dataRepresentation; -} - -void GridAxisRecord::unmarshal(DataStream& dataStream) -{ - dataStream >> _sampleType; - dataStream >> _dataRepresentation; -} - - -bool GridAxisRecord::operator ==(const GridAxisRecord& rhs) const - { - bool ivarsEqual = true; - - if( ! (_sampleType == rhs._sampleType) ) ivarsEqual = false; - if( ! (_dataRepresentation == rhs._dataRepresentation) ) ivarsEqual = false; - - return ivarsEqual; - } - -int GridAxisRecord::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _sampleType - marshalSize = marshalSize + 2; // _dataRepresentation - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GridAxisRecord.h b/src/dis6/GridAxisRecord.h deleted file mode 100644 index 814342a6..00000000 --- a/src/dis6/GridAxisRecord.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.2.44: Grid data record, a common abstract superclass for several subtypes - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT GridAxisRecord -{ -protected: - /** type of environmental sample */ - unsigned short _sampleType; - - /** value that describes data representation */ - unsigned short _dataRepresentation; - - - public: - GridAxisRecord(); - virtual ~GridAxisRecord(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSampleType() const; - void setSampleType(unsigned short pX); - - unsigned short getDataRepresentation() const; - void setDataRepresentation(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const GridAxisRecord& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GridAxisRecordRepresentation0.cpp b/src/dis6/GridAxisRecordRepresentation0.cpp deleted file mode 100644 index e5d532a8..00000000 --- a/src/dis6/GridAxisRecordRepresentation0.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - -GridAxisRecordRepresentation0::GridAxisRecordRepresentation0() - : GridAxisRecord(), _numberOfBytes(0) {} - -GridAxisRecordRepresentation0::~GridAxisRecordRepresentation0() { - _dataValues.clear(); -} - -unsigned short GridAxisRecordRepresentation0::getNumberOfBytes() const { - return _dataValues.size(); -} - -std::vector &GridAxisRecordRepresentation0::getDataValues() { - return _dataValues; -} - -const std::vector & -GridAxisRecordRepresentation0::getDataValues() const { - return _dataValues; -} - -void GridAxisRecordRepresentation0::setDataValues( - const std::vector &pX) { - _dataValues = pX; -} - -void GridAxisRecordRepresentation0::marshal(DataStream &dataStream) const { - GridAxisRecord::marshal( - dataStream); // Marshal information in superclass first - dataStream << (unsigned short)_dataValues.size(); - - for (auto &byte : _dataValues) { - dataStream << byte; - } -} - -void GridAxisRecordRepresentation0::unmarshal(DataStream &dataStream) { - GridAxisRecord::unmarshal( - dataStream); // unmarshal information in superclass first - dataStream >> _numberOfBytes; - - _dataValues.clear(); - for (auto idx = 0; idx < _numberOfBytes; ++idx) { - uint8_t x; - dataStream >> x; - _dataValues.push_back(x); - } -} - -bool GridAxisRecordRepresentation0::operator==( - const GridAxisRecordRepresentation0 &rhs) const { - auto ivarsEqual = true; - - ivarsEqual = - GridAxisRecord::operator==(rhs) && _dataValues == rhs._dataValues; - - return ivarsEqual; -} - -int GridAxisRecordRepresentation0::getMarshalledSize() const { - auto marshalSize = 0; - - marshalSize = GridAxisRecord::getMarshalledSize(); - marshalSize += 2; // _numberOfBytes - marshalSize += _dataValues.size(); - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GridAxisRecordRepresentation1.cpp b/src/dis6/GridAxisRecordRepresentation1.cpp deleted file mode 100644 index 34ce8465..00000000 --- a/src/dis6/GridAxisRecordRepresentation1.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include - -using namespace DIS; - - -GridAxisRecordRepresentation1::GridAxisRecordRepresentation1() : GridAxisRecord(), - _fieldScale(0.0), - _fieldOffset(0.0), - _numberOfValues(0) -{ -} - -GridAxisRecordRepresentation1::~GridAxisRecordRepresentation1() -{ - _dataValues.clear(); -} - -float GridAxisRecordRepresentation1::getFieldScale() const -{ - return _fieldScale; -} - -void GridAxisRecordRepresentation1::setFieldScale(float pX) -{ - _fieldScale = pX; -} - -float GridAxisRecordRepresentation1::getFieldOffset() const -{ - return _fieldOffset; -} - -void GridAxisRecordRepresentation1::setFieldOffset(float pX) -{ - _fieldOffset = pX; -} - -unsigned short GridAxisRecordRepresentation1::getNumberOfValues() const -{ - return _dataValues.size(); -} - -std::vector& GridAxisRecordRepresentation1::getDataValues() -{ - return _dataValues; -} - -const std::vector& GridAxisRecordRepresentation1::getDataValues() const -{ - return _dataValues; -} - -void GridAxisRecordRepresentation1::setDataValues(const std::vector& pX) -{ - _dataValues = pX; -} - -void GridAxisRecordRepresentation1::marshal(DataStream& dataStream) const -{ - GridAxisRecord::marshal(dataStream); // Marshal information in superclass first - dataStream << _fieldScale; - dataStream << _fieldOffset; - dataStream << ( unsigned short )_dataValues.size(); - - for(size_t idx = 0; idx < _dataValues.size(); idx++) - { - TwoByteChunk x = _dataValues[idx]; - x.marshal(dataStream); - } - -} - -void GridAxisRecordRepresentation1::unmarshal(DataStream& dataStream) -{ - GridAxisRecord::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _fieldScale; - dataStream >> _fieldOffset; - dataStream >> _numberOfValues; - - _dataValues.clear(); - for(size_t idx = 0; idx < _numberOfValues; idx++) - { - TwoByteChunk x; - x.unmarshal(dataStream); - _dataValues.push_back(x); - } -} - - -bool GridAxisRecordRepresentation1::operator ==(const GridAxisRecordRepresentation1& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = GridAxisRecord::operator==(rhs); - - if( ! (_fieldScale == rhs._fieldScale) ) ivarsEqual = false; - if( ! (_fieldOffset == rhs._fieldOffset) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _dataValues.size(); idx++) - { - if( ! ( _dataValues[idx] == rhs._dataValues[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int GridAxisRecordRepresentation1::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = GridAxisRecord::getMarshalledSize(); - marshalSize = marshalSize + 4; // _fieldScale - marshalSize = marshalSize + 4; // _fieldOffset - marshalSize = marshalSize + 2; // _numberOfValues - - for(unsigned long long idx=0; idx < _dataValues.size(); idx++) - { - TwoByteChunk listElement = _dataValues[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GridAxisRecordRepresentation1.h b/src/dis6/GridAxisRecordRepresentation1.h deleted file mode 100644 index dd6061a3..00000000 --- a/src/dis6/GridAxisRecordRepresentation1.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// 5.2.44: Grid data record, representation 1 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT GridAxisRecordRepresentation1 : public GridAxisRecord -{ -protected: - /** constant scale factor */ - float _fieldScale; - - /** constant offset used to scale grid data */ - float _fieldOffset; - - /** Number of data values */ - unsigned short _numberOfValues; - - /** variable length list of data parameters ^^^this is wrong--need padding as well */ - std::vector _dataValues; - - - public: - GridAxisRecordRepresentation1(); - virtual ~GridAxisRecordRepresentation1(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getFieldScale() const; - void setFieldScale(float pX); - - float getFieldOffset() const; - void setFieldOffset(float pX); - - unsigned short getNumberOfValues() const; - - std::vector& getDataValues(); - const std::vector& getDataValues() const; - void setDataValues(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const GridAxisRecordRepresentation1& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GridAxisRecordRepresentation2.cpp b/src/dis6/GridAxisRecordRepresentation2.cpp deleted file mode 100644 index cea24f09..00000000 --- a/src/dis6/GridAxisRecordRepresentation2.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include - -using namespace DIS; - - -GridAxisRecordRepresentation2::GridAxisRecordRepresentation2() : GridAxisRecord(), - _numberOfValues(0) -{ -} - -GridAxisRecordRepresentation2::~GridAxisRecordRepresentation2() -{ - _dataValues.clear(); -} - -unsigned short GridAxisRecordRepresentation2::getNumberOfValues() const -{ - return _dataValues.size(); -} - -std::vector& GridAxisRecordRepresentation2::getDataValues() -{ - return _dataValues; -} - -const std::vector& GridAxisRecordRepresentation2::getDataValues() const -{ - return _dataValues; -} - -void GridAxisRecordRepresentation2::setDataValues(const std::vector& pX) -{ - _dataValues = pX; -} - -void GridAxisRecordRepresentation2::marshal(DataStream& dataStream) const -{ - GridAxisRecord::marshal(dataStream); // Marshal information in superclass first - dataStream << ( unsigned short )_dataValues.size(); - - for(size_t idx = 0; idx < _dataValues.size(); idx++) - { - FourByteChunk x = _dataValues[idx]; - x.marshal(dataStream); - } - -} - -void GridAxisRecordRepresentation2::unmarshal(DataStream& dataStream) -{ - GridAxisRecord::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _numberOfValues; - - _dataValues.clear(); - for(size_t idx = 0; idx < _numberOfValues; idx++) - { - FourByteChunk x; - x.unmarshal(dataStream); - _dataValues.push_back(x); - } -} - - -bool GridAxisRecordRepresentation2::operator ==(const GridAxisRecordRepresentation2& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = GridAxisRecord::operator==(rhs); - - - for(size_t idx = 0; idx < _dataValues.size(); idx++) - { - if( ! ( _dataValues[idx] == rhs._dataValues[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int GridAxisRecordRepresentation2::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = GridAxisRecord::getMarshalledSize(); - marshalSize = marshalSize + 2; // _numberOfValues - - for(unsigned long long idx=0; idx < _dataValues.size(); idx++) - { - FourByteChunk listElement = _dataValues[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GridAxisRecordRepresentation2.h b/src/dis6/GridAxisRecordRepresentation2.h deleted file mode 100644 index 9adbc9dd..00000000 --- a/src/dis6/GridAxisRecordRepresentation2.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// 5.2.44: Grid data record, representation 1 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT GridAxisRecordRepresentation2 : public GridAxisRecord -{ -protected: - /** number of values */ - unsigned short _numberOfValues; - - /** variable length list of data parameters ^^^this is wrong--need padding as well */ - std::vector _dataValues; - - - public: - GridAxisRecordRepresentation2(); - virtual ~GridAxisRecordRepresentation2(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getNumberOfValues() const; - - std::vector& getDataValues(); - const std::vector& getDataValues() const; - void setDataValues(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const GridAxisRecordRepresentation2& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GriddedDataPdu.cpp b/src/dis6/GriddedDataPdu.cpp deleted file mode 100644 index ebc97370..00000000 --- a/src/dis6/GriddedDataPdu.cpp +++ /dev/null @@ -1,336 +0,0 @@ -#include - -using namespace DIS; - - -GriddedDataPdu::GriddedDataPdu() : SyntheticEnvironmentFamilyPdu(), - _environmentalSimulationApplicationID(), - _fieldNumber(0), - _pduNumber(0), - _pduTotal(0), - _coordinateSystem(0), - _numberOfGridAxes(0), - _constantGrid(0), - _environmentType(), - _orientation(), - _sampleTime(0), - _totalValues(0), - _vectorDimension(0), - _padding1(0), - _padding2(0) -{ - setPduType( 42 ); -} - -GriddedDataPdu::~GriddedDataPdu() -{ - _gridDataList.clear(); -} - -EntityID& GriddedDataPdu::getEnvironmentalSimulationApplicationID() -{ - return _environmentalSimulationApplicationID; -} - -const EntityID& GriddedDataPdu::getEnvironmentalSimulationApplicationID() const -{ - return _environmentalSimulationApplicationID; -} - -void GriddedDataPdu::setEnvironmentalSimulationApplicationID(const EntityID &pX) -{ - _environmentalSimulationApplicationID = pX; -} - -unsigned short GriddedDataPdu::getFieldNumber() const -{ - return _fieldNumber; -} - -void GriddedDataPdu::setFieldNumber(unsigned short pX) -{ - _fieldNumber = pX; -} - -unsigned short GriddedDataPdu::getPduNumber() const -{ - return _pduNumber; -} - -void GriddedDataPdu::setPduNumber(unsigned short pX) -{ - _pduNumber = pX; -} - -unsigned short GriddedDataPdu::getPduTotal() const -{ - return _pduTotal; -} - -void GriddedDataPdu::setPduTotal(unsigned short pX) -{ - _pduTotal = pX; -} - -unsigned short GriddedDataPdu::getCoordinateSystem() const -{ - return _coordinateSystem; -} - -void GriddedDataPdu::setCoordinateSystem(unsigned short pX) -{ - _coordinateSystem = pX; -} - -unsigned char GriddedDataPdu::getNumberOfGridAxes() const -{ - return _gridDataList.size(); -} - -unsigned char GriddedDataPdu::getConstantGrid() const -{ - return _constantGrid; -} - -void GriddedDataPdu::setConstantGrid(unsigned char pX) -{ - _constantGrid = pX; -} - -EntityType& GriddedDataPdu::getEnvironmentType() -{ - return _environmentType; -} - -const EntityType& GriddedDataPdu::getEnvironmentType() const -{ - return _environmentType; -} - -void GriddedDataPdu::setEnvironmentType(const EntityType &pX) -{ - _environmentType = pX; -} - -Orientation& GriddedDataPdu::getOrientation() -{ - return _orientation; -} - -const Orientation& GriddedDataPdu::getOrientation() const -{ - return _orientation; -} - -void GriddedDataPdu::setOrientation(const Orientation &pX) -{ - _orientation = pX; -} - -unsigned long long GriddedDataPdu::getSampleTime() const -{ - return _sampleTime; -} - -void GriddedDataPdu::setSampleTime(unsigned long long pX) -{ - _sampleTime = pX; -} - -unsigned int GriddedDataPdu::getTotalValues() const -{ - return _totalValues; -} - -void GriddedDataPdu::setTotalValues(unsigned int pX) -{ - _totalValues = pX; -} - -unsigned char GriddedDataPdu::getVectorDimension() const -{ - return _vectorDimension; -} - -void GriddedDataPdu::setVectorDimension(unsigned char pX) -{ - _vectorDimension = pX; -} - -unsigned short GriddedDataPdu::getPadding1() const -{ - return _padding1; -} - -void GriddedDataPdu::setPadding1(unsigned short pX) -{ - _padding1 = pX; -} - -unsigned char GriddedDataPdu::getPadding2() const -{ - return _padding2; -} - -void GriddedDataPdu::setPadding2(unsigned char pX) -{ - _padding2 = pX; -} - -std::vector& GriddedDataPdu::getGridDataList() -{ - return _gridDataList; -} - -const std::vector& GriddedDataPdu::getGridDataList() const -{ - return _gridDataList; -} - -void GriddedDataPdu::setGridDataList(const std::vector& pX) -{ - _gridDataList = pX; -} - -void GriddedDataPdu::marshal(DataStream& dataStream) const -{ - SyntheticEnvironmentFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _environmentalSimulationApplicationID.marshal(dataStream); - dataStream << _fieldNumber; - dataStream << _pduNumber; - dataStream << _pduTotal; - dataStream << _coordinateSystem; - dataStream << ( unsigned char )_gridDataList.size(); - dataStream << _constantGrid; - _environmentType.marshal(dataStream); - _orientation.marshal(dataStream); - dataStream << _sampleTime; - dataStream << _totalValues; - dataStream << _vectorDimension; - dataStream << _padding1; - dataStream << _padding2; - - for(size_t idx = 0; idx < _gridDataList.size(); idx++) - { - GridAxisRecord x = _gridDataList[idx]; - x.marshal(dataStream); - } - -} - -void GriddedDataPdu::unmarshal(DataStream& dataStream) -{ - SyntheticEnvironmentFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _environmentalSimulationApplicationID.unmarshal(dataStream); - dataStream >> _fieldNumber; - dataStream >> _pduNumber; - dataStream >> _pduTotal; - dataStream >> _coordinateSystem; - dataStream >> _numberOfGridAxes; - dataStream >> _constantGrid; - _environmentType.unmarshal(dataStream); - _orientation.unmarshal(dataStream); - dataStream >> _sampleTime; - dataStream >> _totalValues; - dataStream >> _vectorDimension; - dataStream >> _padding1; - dataStream >> _padding2; - - _gridDataList.clear(); - for(size_t idx = 0; idx < _numberOfGridAxes; idx++) - { - GridAxisRecord x; - x.unmarshal(dataStream); - _gridDataList.push_back(x); - } -} - - -bool GriddedDataPdu::operator ==(const GriddedDataPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); - - if( ! (_environmentalSimulationApplicationID == rhs._environmentalSimulationApplicationID) ) ivarsEqual = false; - if( ! (_fieldNumber == rhs._fieldNumber) ) ivarsEqual = false; - if( ! (_pduNumber == rhs._pduNumber) ) ivarsEqual = false; - if( ! (_pduTotal == rhs._pduTotal) ) ivarsEqual = false; - if( ! (_coordinateSystem == rhs._coordinateSystem) ) ivarsEqual = false; - if( ! (_constantGrid == rhs._constantGrid) ) ivarsEqual = false; - if( ! (_environmentType == rhs._environmentType) ) ivarsEqual = false; - if( ! (_orientation == rhs._orientation) ) ivarsEqual = false; - if( ! (_sampleTime == rhs._sampleTime) ) ivarsEqual = false; - if( ! (_totalValues == rhs._totalValues) ) ivarsEqual = false; - if( ! (_vectorDimension == rhs._vectorDimension) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _gridDataList.size(); idx++) - { - if( ! ( _gridDataList[idx] == rhs._gridDataList[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int GriddedDataPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _environmentalSimulationApplicationID.getMarshalledSize(); // _environmentalSimulationApplicationID - marshalSize = marshalSize + 2; // _fieldNumber - marshalSize = marshalSize + 2; // _pduNumber - marshalSize = marshalSize + 2; // _pduTotal - marshalSize = marshalSize + 2; // _coordinateSystem - marshalSize = marshalSize + 1; // _numberOfGridAxes - marshalSize = marshalSize + 1; // _constantGrid - marshalSize = marshalSize + _environmentType.getMarshalledSize(); // _environmentType - marshalSize = marshalSize + _orientation.getMarshalledSize(); // _orientation - marshalSize = marshalSize + 8; // _sampleTime - marshalSize = marshalSize + 4; // _totalValues - marshalSize = marshalSize + 1; // _vectorDimension - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - - for(unsigned long long idx=0; idx < _gridDataList.size(); idx++) - { - GridAxisRecord listElement = _gridDataList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GriddedDataPdu.h b/src/dis6/GriddedDataPdu.h deleted file mode 100644 index 67c4a2dd..00000000 --- a/src/dis6/GriddedDataPdu.h +++ /dev/null @@ -1,161 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.11.2: Information about globat, spatially varying enviornmental effects. This requires manual cleanup; the grid axis records are variable sized. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT GriddedDataPdu : public SyntheticEnvironmentFamilyPdu -{ -protected: - /** environmental simulation application ID */ - EntityID _environmentalSimulationApplicationID; - - /** unique identifier for each piece of enviornmental data */ - unsigned short _fieldNumber; - - /** sequence number for the total set of PDUS used to transmit the data */ - unsigned short _pduNumber; - - /** Total number of PDUS used to transmit the data */ - unsigned short _pduTotal; - - /** coordinate system of the grid */ - unsigned short _coordinateSystem; - - /** number of grid axes for the environmental data */ - unsigned char _numberOfGridAxes; - - /** are domain grid axes identidal to those of the priveious domain update? */ - unsigned char _constantGrid; - - /** type of environment */ - EntityType _environmentType; - - /** orientation of the data grid */ - Orientation _orientation; - - /** valid time of the enviormental data sample, 64 bit unsigned int */ - unsigned long long _sampleTime; - - /** total number of all data values for all pdus for an environmental sample */ - unsigned int _totalValues; - - /** total number of data values at each grid point. */ - unsigned char _vectorDimension; - - /** padding */ - unsigned short _padding1; - - /** padding */ - unsigned char _padding2; - - /** Grid data ^^^This is wrong */ - std::vector _gridDataList; - - - public: - GriddedDataPdu(); - virtual ~GriddedDataPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEnvironmentalSimulationApplicationID(); - const EntityID& getEnvironmentalSimulationApplicationID() const; - void setEnvironmentalSimulationApplicationID(const EntityID &pX); - - unsigned short getFieldNumber() const; - void setFieldNumber(unsigned short pX); - - unsigned short getPduNumber() const; - void setPduNumber(unsigned short pX); - - unsigned short getPduTotal() const; - void setPduTotal(unsigned short pX); - - unsigned short getCoordinateSystem() const; - void setCoordinateSystem(unsigned short pX); - - unsigned char getNumberOfGridAxes() const; - - unsigned char getConstantGrid() const; - void setConstantGrid(unsigned char pX); - - EntityType& getEnvironmentType(); - const EntityType& getEnvironmentType() const; - void setEnvironmentType(const EntityType &pX); - - Orientation& getOrientation(); - const Orientation& getOrientation() const; - void setOrientation(const Orientation &pX); - - unsigned long long getSampleTime() const; - void setSampleTime(unsigned long long pX); - - unsigned int getTotalValues() const; - void setTotalValues(unsigned int pX); - - unsigned char getVectorDimension() const; - void setVectorDimension(unsigned char pX); - - unsigned short getPadding1() const; - void setPadding1(unsigned short pX); - - unsigned char getPadding2() const; - void setPadding2(unsigned char pX); - - std::vector& getGridDataList(); - const std::vector& getGridDataList() const; - void setGridDataList(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const GriddedDataPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IffAtcNavAidsLayer1Pdu.cpp b/src/dis6/IffAtcNavAidsLayer1Pdu.cpp deleted file mode 100644 index 82bc2ab3..00000000 --- a/src/dis6/IffAtcNavAidsLayer1Pdu.cpp +++ /dev/null @@ -1,188 +0,0 @@ -#include - -using namespace DIS; - - -IffAtcNavAidsLayer1Pdu::IffAtcNavAidsLayer1Pdu() : DistributedEmissionsFamilyPdu(), - _emittingEntityId(), - _eventID(), - _location(), - _systemID(), - _pad2(0), - _fundamentalParameters() -{ - setPduType( 28 ); -} - -IffAtcNavAidsLayer1Pdu::~IffAtcNavAidsLayer1Pdu() -{ -} - -EntityID& IffAtcNavAidsLayer1Pdu::getEmittingEntityId() -{ - return _emittingEntityId; -} - -const EntityID& IffAtcNavAidsLayer1Pdu::getEmittingEntityId() const -{ - return _emittingEntityId; -} - -void IffAtcNavAidsLayer1Pdu::setEmittingEntityId(const EntityID &pX) -{ - _emittingEntityId = pX; -} - -EventID& IffAtcNavAidsLayer1Pdu::getEventID() -{ - return _eventID; -} - -const EventID& IffAtcNavAidsLayer1Pdu::getEventID() const -{ - return _eventID; -} - -void IffAtcNavAidsLayer1Pdu::setEventID(const EventID &pX) -{ - _eventID = pX; -} - -Vector3Float& IffAtcNavAidsLayer1Pdu::getLocation() -{ - return _location; -} - -const Vector3Float& IffAtcNavAidsLayer1Pdu::getLocation() const -{ - return _location; -} - -void IffAtcNavAidsLayer1Pdu::setLocation(const Vector3Float &pX) -{ - _location = pX; -} - -SystemID& IffAtcNavAidsLayer1Pdu::getSystemID() -{ - return _systemID; -} - -const SystemID& IffAtcNavAidsLayer1Pdu::getSystemID() const -{ - return _systemID; -} - -void IffAtcNavAidsLayer1Pdu::setSystemID(const SystemID &pX) -{ - _systemID = pX; -} - -unsigned short IffAtcNavAidsLayer1Pdu::getPad2() const -{ - return _pad2; -} - -void IffAtcNavAidsLayer1Pdu::setPad2(unsigned short pX) -{ - _pad2 = pX; -} - -IffFundamentalData& IffAtcNavAidsLayer1Pdu::getFundamentalParameters() -{ - return _fundamentalParameters; -} - -const IffFundamentalData& IffAtcNavAidsLayer1Pdu::getFundamentalParameters() const -{ - return _fundamentalParameters; -} - -void IffAtcNavAidsLayer1Pdu::setFundamentalParameters(const IffFundamentalData &pX) -{ - _fundamentalParameters = pX; -} - -void IffAtcNavAidsLayer1Pdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _emittingEntityId.marshal(dataStream); - _eventID.marshal(dataStream); - _location.marshal(dataStream); - _systemID.marshal(dataStream); - dataStream << _pad2; - _fundamentalParameters.marshal(dataStream); -} - -void IffAtcNavAidsLayer1Pdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _emittingEntityId.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - _location.unmarshal(dataStream); - _systemID.unmarshal(dataStream); - dataStream >> _pad2; - _fundamentalParameters.unmarshal(dataStream); -} - - -bool IffAtcNavAidsLayer1Pdu::operator ==(const IffAtcNavAidsLayer1Pdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_emittingEntityId == rhs._emittingEntityId) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_location == rhs._location) ) ivarsEqual = false; - if( ! (_systemID == rhs._systemID) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_fundamentalParameters == rhs._fundamentalParameters) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IffAtcNavAidsLayer1Pdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _emittingEntityId.getMarshalledSize(); // _emittingEntityId - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + _location.getMarshalledSize(); // _location - marshalSize = marshalSize + _systemID.getMarshalledSize(); // _systemID - marshalSize = marshalSize + 2; // _pad2 - marshalSize = marshalSize + _fundamentalParameters.getMarshalledSize(); // _fundamentalParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IffAtcNavAidsLayer1Pdu.h b/src/dis6/IffAtcNavAidsLayer1Pdu.h deleted file mode 100644 index f822a743..00000000 --- a/src/dis6/IffAtcNavAidsLayer1Pdu.h +++ /dev/null @@ -1,109 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// 5.3.7.4.1: Navigational and IFF PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT IffAtcNavAidsLayer1Pdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** ID of the entity that is the source of the emissions */ - EntityID _emittingEntityId; - - /** Number generated by the issuing simulation to associate realted events. */ - EventID _eventID; - - /** Location wrt entity. There is some ambugiuity in the standard here, but this is the order it is listed in the table. */ - Vector3Float _location; - - /** System ID information */ - SystemID _systemID; - - /** padding */ - unsigned short _pad2; - - /** fundamental parameters */ - IffFundamentalData _fundamentalParameters; - - - public: - IffAtcNavAidsLayer1Pdu(); - virtual ~IffAtcNavAidsLayer1Pdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEmittingEntityId(); - const EntityID& getEmittingEntityId() const; - void setEmittingEntityId(const EntityID &pX); - - EventID& getEventID(); - const EventID& getEventID() const; - void setEventID(const EventID &pX); - - Vector3Float& getLocation(); - const Vector3Float& getLocation() const; - void setLocation(const Vector3Float &pX); - - SystemID& getSystemID(); - const SystemID& getSystemID() const; - void setSystemID(const SystemID &pX); - - unsigned short getPad2() const; - void setPad2(unsigned short pX); - - IffFundamentalData& getFundamentalParameters(); - const IffFundamentalData& getFundamentalParameters() const; - void setFundamentalParameters(const IffFundamentalData &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IffAtcNavAidsLayer1Pdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IffAtcNavAidsLayer2Pdu.cpp b/src/dis6/IffAtcNavAidsLayer2Pdu.cpp deleted file mode 100644 index 1baa855a..00000000 --- a/src/dis6/IffAtcNavAidsLayer2Pdu.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include - -using namespace DIS; - - -IffAtcNavAidsLayer2Pdu::IffAtcNavAidsLayer2Pdu() : IffAtcNavAidsLayer1Pdu(), - _layerHeader(), - _beamData(), - _secondaryOperationalData() -{ -} - -IffAtcNavAidsLayer2Pdu::~IffAtcNavAidsLayer2Pdu() -{ - _fundamentalIffParameters.clear(); -} - -LayerHeader& IffAtcNavAidsLayer2Pdu::getLayerHeader() -{ - return _layerHeader; -} - -const LayerHeader& IffAtcNavAidsLayer2Pdu::getLayerHeader() const -{ - return _layerHeader; -} - -void IffAtcNavAidsLayer2Pdu::setLayerHeader(const LayerHeader &pX) -{ - _layerHeader = pX; -} - -BeamData& IffAtcNavAidsLayer2Pdu::getBeamData() -{ - return _beamData; -} - -const BeamData& IffAtcNavAidsLayer2Pdu::getBeamData() const -{ - return _beamData; -} - -void IffAtcNavAidsLayer2Pdu::setBeamData(const BeamData &pX) -{ - _beamData = pX; -} - -BeamData& IffAtcNavAidsLayer2Pdu::getSecondaryOperationalData() -{ - return _secondaryOperationalData; -} - -const BeamData& IffAtcNavAidsLayer2Pdu::getSecondaryOperationalData() const -{ - return _secondaryOperationalData; -} - -void IffAtcNavAidsLayer2Pdu::setSecondaryOperationalData(const BeamData &pX) -{ - _secondaryOperationalData = pX; -} - -std::vector& IffAtcNavAidsLayer2Pdu::getFundamentalIffParameters() -{ - return _fundamentalIffParameters; -} - -const std::vector& IffAtcNavAidsLayer2Pdu::getFundamentalIffParameters() const -{ - return _fundamentalIffParameters; -} - -void IffAtcNavAidsLayer2Pdu::setFundamentalIffParameters(const std::vector& pX) -{ - _fundamentalIffParameters = pX; -} - -void IffAtcNavAidsLayer2Pdu::marshal(DataStream& dataStream) const -{ - IffAtcNavAidsLayer1Pdu::marshal(dataStream); // Marshal information in superclass first - _layerHeader.marshal(dataStream); - _beamData.marshal(dataStream); - _secondaryOperationalData.marshal(dataStream); - - for(size_t idx = 0; idx < _fundamentalIffParameters.size(); idx++) - { - FundamentalParameterDataIff x = _fundamentalIffParameters[idx]; - x.marshal(dataStream); - } - -} - -void IffAtcNavAidsLayer2Pdu::unmarshal(DataStream& dataStream) -{ - IffAtcNavAidsLayer1Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _layerHeader.unmarshal(dataStream); - _beamData.unmarshal(dataStream); - _secondaryOperationalData.unmarshal(dataStream); - - _fundamentalIffParameters.clear(); - for(size_t idx = 0; idx < _pad2; idx++) - { - FundamentalParameterDataIff x; - x.unmarshal(dataStream); - _fundamentalIffParameters.push_back(x); - } -} - - -bool IffAtcNavAidsLayer2Pdu::operator ==(const IffAtcNavAidsLayer2Pdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = IffAtcNavAidsLayer1Pdu::operator==(rhs); - - if( ! (_layerHeader == rhs._layerHeader) ) ivarsEqual = false; - if( ! (_beamData == rhs._beamData) ) ivarsEqual = false; - if( ! (_secondaryOperationalData == rhs._secondaryOperationalData) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fundamentalIffParameters.size(); idx++) - { - if( ! ( _fundamentalIffParameters[idx] == rhs._fundamentalIffParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int IffAtcNavAidsLayer2Pdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = IffAtcNavAidsLayer1Pdu::getMarshalledSize(); - marshalSize = marshalSize + _layerHeader.getMarshalledSize(); // _layerHeader - marshalSize = marshalSize + _beamData.getMarshalledSize(); // _beamData - marshalSize = marshalSize + _secondaryOperationalData.getMarshalledSize(); // _secondaryOperationalData - - for(unsigned long long idx=0; idx < _fundamentalIffParameters.size(); idx++) - { - FundamentalParameterDataIff listElement = _fundamentalIffParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IffAtcNavAidsLayer2Pdu.h b/src/dis6/IffAtcNavAidsLayer2Pdu.h deleted file mode 100644 index cccb6995..00000000 --- a/src/dis6/IffAtcNavAidsLayer2Pdu.h +++ /dev/null @@ -1,96 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7.4.2 When present, layer 2 should follow layer 1 and have the following fields. This requires manual cleanup. the beamData attribute semantics are used in multiple ways. UNFINSISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT IffAtcNavAidsLayer2Pdu : public IffAtcNavAidsLayer1Pdu -{ -protected: - /** layer header */ - LayerHeader _layerHeader; - - /** beam data */ - BeamData _beamData; - - /** Secondary operational data, 5.2.57 */ - BeamData _secondaryOperationalData; - - /** variable length list of fundamental parameters. ^^^This is wrong */ - std::vector _fundamentalIffParameters; - - - public: - IffAtcNavAidsLayer2Pdu(); - virtual ~IffAtcNavAidsLayer2Pdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - LayerHeader& getLayerHeader(); - const LayerHeader& getLayerHeader() const; - void setLayerHeader(const LayerHeader &pX); - - BeamData& getBeamData(); - const BeamData& getBeamData() const; - void setBeamData(const BeamData &pX); - - BeamData& getSecondaryOperationalData(); - const BeamData& getSecondaryOperationalData() const; - void setSecondaryOperationalData(const BeamData &pX); - - std::vector& getFundamentalIffParameters(); - const std::vector& getFundamentalIffParameters() const; - void setFundamentalIffParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IffAtcNavAidsLayer2Pdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IffFundamentalData.cpp b/src/dis6/IffFundamentalData.cpp deleted file mode 100644 index 1affc6d1..00000000 --- a/src/dis6/IffFundamentalData.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include - -using namespace DIS; - - -IffFundamentalData::IffFundamentalData(): - _systemStatus(0), - _alternateParameter4(0), - _informationLayers(0), - _modifier(0), - _parameter1(0), - _parameter2(0), - _parameter3(0), - _parameter4(0), - _parameter5(0), - _parameter6(0) -{ -} - -IffFundamentalData::~IffFundamentalData() -{ -} - -unsigned char IffFundamentalData::getSystemStatus() const -{ - return _systemStatus; -} - -void IffFundamentalData::setSystemStatus(unsigned char pX) -{ - _systemStatus = pX; -} - -unsigned char IffFundamentalData::getAlternateParameter4() const -{ - return _alternateParameter4; -} - -void IffFundamentalData::setAlternateParameter4(unsigned char pX) -{ - _alternateParameter4 = pX; -} - -unsigned char IffFundamentalData::getInformationLayers() const -{ - return _informationLayers; -} - -void IffFundamentalData::setInformationLayers(unsigned char pX) -{ - _informationLayers = pX; -} - -unsigned char IffFundamentalData::getModifier() const -{ - return _modifier; -} - -void IffFundamentalData::setModifier(unsigned char pX) -{ - _modifier = pX; -} - -unsigned short IffFundamentalData::getParameter1() const -{ - return _parameter1; -} - -void IffFundamentalData::setParameter1(unsigned short pX) -{ - _parameter1 = pX; -} - -unsigned short IffFundamentalData::getParameter2() const -{ - return _parameter2; -} - -void IffFundamentalData::setParameter2(unsigned short pX) -{ - _parameter2 = pX; -} - -unsigned short IffFundamentalData::getParameter3() const -{ - return _parameter3; -} - -void IffFundamentalData::setParameter3(unsigned short pX) -{ - _parameter3 = pX; -} - -unsigned short IffFundamentalData::getParameter4() const -{ - return _parameter4; -} - -void IffFundamentalData::setParameter4(unsigned short pX) -{ - _parameter4 = pX; -} - -unsigned short IffFundamentalData::getParameter5() const -{ - return _parameter5; -} - -void IffFundamentalData::setParameter5(unsigned short pX) -{ - _parameter5 = pX; -} - -unsigned short IffFundamentalData::getParameter6() const -{ - return _parameter6; -} - -void IffFundamentalData::setParameter6(unsigned short pX) -{ - _parameter6 = pX; -} - -void IffFundamentalData::marshal(DataStream& dataStream) const -{ - dataStream << _systemStatus; - dataStream << _alternateParameter4; - dataStream << _informationLayers; - dataStream << _modifier; - dataStream << _parameter1; - dataStream << _parameter2; - dataStream << _parameter3; - dataStream << _parameter4; - dataStream << _parameter5; - dataStream << _parameter6; -} - -void IffFundamentalData::unmarshal(DataStream& dataStream) -{ - dataStream >> _systemStatus; - dataStream >> _alternateParameter4; - dataStream >> _informationLayers; - dataStream >> _modifier; - dataStream >> _parameter1; - dataStream >> _parameter2; - dataStream >> _parameter3; - dataStream >> _parameter4; - dataStream >> _parameter5; - dataStream >> _parameter6; -} - - -bool IffFundamentalData::operator ==(const IffFundamentalData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_systemStatus == rhs._systemStatus) ) ivarsEqual = false; - if( ! (_alternateParameter4 == rhs._alternateParameter4) ) ivarsEqual = false; - if( ! (_informationLayers == rhs._informationLayers) ) ivarsEqual = false; - if( ! (_modifier == rhs._modifier) ) ivarsEqual = false; - if( ! (_parameter1 == rhs._parameter1) ) ivarsEqual = false; - if( ! (_parameter2 == rhs._parameter2) ) ivarsEqual = false; - if( ! (_parameter3 == rhs._parameter3) ) ivarsEqual = false; - if( ! (_parameter4 == rhs._parameter4) ) ivarsEqual = false; - if( ! (_parameter5 == rhs._parameter5) ) ivarsEqual = false; - if( ! (_parameter6 == rhs._parameter6) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IffFundamentalData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _systemStatus - marshalSize = marshalSize + 1; // _alternateParameter4 - marshalSize = marshalSize + 1; // _informationLayers - marshalSize = marshalSize + 1; // _modifier - marshalSize = marshalSize + 2; // _parameter1 - marshalSize = marshalSize + 2; // _parameter2 - marshalSize = marshalSize + 2; // _parameter3 - marshalSize = marshalSize + 2; // _parameter4 - marshalSize = marshalSize + 2; // _parameter5 - marshalSize = marshalSize + 2; // _parameter6 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IffFundamentalData.h b/src/dis6/IffFundamentalData.h deleted file mode 100644 index 5cb9c0a6..00000000 --- a/src/dis6/IffFundamentalData.h +++ /dev/null @@ -1,122 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.2.42. Basic operational data ofr IFF ATC NAVAIDS - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT IffFundamentalData -{ -protected: - /** system status */ - unsigned char _systemStatus; - - /** Alternate parameter 4 */ - unsigned char _alternateParameter4; - - /** eight boolean fields */ - unsigned char _informationLayers; - - /** enumeration */ - unsigned char _modifier; - - /** parameter, enumeration */ - unsigned short _parameter1; - - /** parameter, enumeration */ - unsigned short _parameter2; - - /** parameter, enumeration */ - unsigned short _parameter3; - - /** parameter, enumeration */ - unsigned short _parameter4; - - /** parameter, enumeration */ - unsigned short _parameter5; - - /** parameter, enumeration */ - unsigned short _parameter6; - - - public: - IffFundamentalData(); - virtual ~IffFundamentalData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getSystemStatus() const; - void setSystemStatus(unsigned char pX); - - unsigned char getAlternateParameter4() const; - void setAlternateParameter4(unsigned char pX); - - unsigned char getInformationLayers() const; - void setInformationLayers(unsigned char pX); - - unsigned char getModifier() const; - void setModifier(unsigned char pX); - - unsigned short getParameter1() const; - void setParameter1(unsigned short pX); - - unsigned short getParameter2() const; - void setParameter2(unsigned short pX); - - unsigned short getParameter3() const; - void setParameter3(unsigned short pX); - - unsigned short getParameter4() const; - void setParameter4(unsigned short pX); - - unsigned short getParameter5() const; - void setParameter5(unsigned short pX); - - unsigned short getParameter6() const; - void setParameter6(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IffFundamentalData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IntercomCommunicationsParameters.cpp b/src/dis6/IntercomCommunicationsParameters.cpp deleted file mode 100644 index 475b3b9c..00000000 --- a/src/dis6/IntercomCommunicationsParameters.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include - -using namespace DIS; - -IntercomCommunicationsParameters::IntercomCommunicationsParameters() - : _recordType(0), _recordLength(0), _recordSpecificField(0) {} - -IntercomCommunicationsParameters::~IntercomCommunicationsParameters() {} - -unsigned short IntercomCommunicationsParameters::getRecordType() const { - return _recordType; -} - -void IntercomCommunicationsParameters::setRecordType(unsigned short pX) { - _recordType = pX; -} - -unsigned short IntercomCommunicationsParameters::getRecordLength() const { - return _recordLength; -} - -void IntercomCommunicationsParameters::setRecordLength(unsigned short pX) { - _recordLength = pX; -} - -unsigned int IntercomCommunicationsParameters::getRecordSpecificField() const { - return _recordSpecificField; -} - -void IntercomCommunicationsParameters::setRecordSpecificField(unsigned int pX) { - _recordSpecificField = pX; -} - -void IntercomCommunicationsParameters::marshal(DataStream &dataStream) const { - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _recordSpecificField; -} - -void IntercomCommunicationsParameters::unmarshal(DataStream &dataStream) { - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _recordSpecificField; -} - -bool IntercomCommunicationsParameters::operator==( - const IntercomCommunicationsParameters &rhs) const { - auto ivarsEqual = true; - - if (!(_recordType == rhs._recordType)) - ivarsEqual = false; - if (!(_recordLength == rhs._recordLength)) - ivarsEqual = false; - if (!(_recordSpecificField == rhs._recordSpecificField)) - ivarsEqual = false; - - return ivarsEqual; -} - -int IntercomCommunicationsParameters::getMarshalledSize() const { - auto marshalSize = 0; - - marshalSize = marshalSize + 2; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 4; // _recordSpecificField - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IntercomCommunicationsParameters.h b/src/dis6/IntercomCommunicationsParameters.h deleted file mode 100644 index f32e0d26..00000000 --- a/src/dis6/IntercomCommunicationsParameters.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.2.46. Intercom communcations parameters - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT IntercomCommunicationsParameters -{ -protected: - /** Type of intercom parameters record */ - unsigned short _recordType; - - /** length of record */ - unsigned short _recordLength; - - /** Jerks. Looks like the committee is forcing a lookup of the record type parameter to find out how long the field is. This is a placeholder. */ - unsigned int _recordSpecificField; - - - public: - IntercomCommunicationsParameters(); - virtual ~IntercomCommunicationsParameters(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getRecordType() const; - void setRecordType(unsigned short pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned int getRecordSpecificField() const; - void setRecordSpecificField(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IntercomCommunicationsParameters& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IntercomControlPdu.cpp b/src/dis6/IntercomControlPdu.cpp deleted file mode 100644 index 8c4ec83c..00000000 --- a/src/dis6/IntercomControlPdu.cpp +++ /dev/null @@ -1,286 +0,0 @@ -#include - -using namespace DIS; - - -IntercomControlPdu::IntercomControlPdu() : RadioCommunicationsFamilyPdu(), - _controlType(0), - _communicationsChannelType(0), - _sourceEntityID(), - _sourceCommunicationsDeviceID(0), - _sourceLineID(0), - _transmitPriority(0), - _transmitLineState(0), - _command(0), - _masterEntityID(), - _masterCommunicationsDeviceID(0), - _intercomParametersLength(0) -{ - setPduType( 32 ); -} - -IntercomControlPdu::~IntercomControlPdu() -{ - _intercomParameters.clear(); -} - -unsigned char IntercomControlPdu::getControlType() const -{ - return _controlType; -} - -void IntercomControlPdu::setControlType(unsigned char pX) -{ - _controlType = pX; -} - -unsigned char IntercomControlPdu::getCommunicationsChannelType() const -{ - return _communicationsChannelType; -} - -void IntercomControlPdu::setCommunicationsChannelType(unsigned char pX) -{ - _communicationsChannelType = pX; -} - -EntityID& IntercomControlPdu::getSourceEntityID() -{ - return _sourceEntityID; -} - -const EntityID& IntercomControlPdu::getSourceEntityID() const -{ - return _sourceEntityID; -} - -void IntercomControlPdu::setSourceEntityID(const EntityID &pX) -{ - _sourceEntityID = pX; -} - -unsigned char IntercomControlPdu::getSourceCommunicationsDeviceID() const -{ - return _sourceCommunicationsDeviceID; -} - -void IntercomControlPdu::setSourceCommunicationsDeviceID(unsigned char pX) -{ - _sourceCommunicationsDeviceID = pX; -} - -unsigned char IntercomControlPdu::getSourceLineID() const -{ - return _sourceLineID; -} - -void IntercomControlPdu::setSourceLineID(unsigned char pX) -{ - _sourceLineID = pX; -} - -unsigned char IntercomControlPdu::getTransmitPriority() const -{ - return _transmitPriority; -} - -void IntercomControlPdu::setTransmitPriority(unsigned char pX) -{ - _transmitPriority = pX; -} - -unsigned char IntercomControlPdu::getTransmitLineState() const -{ - return _transmitLineState; -} - -void IntercomControlPdu::setTransmitLineState(unsigned char pX) -{ - _transmitLineState = pX; -} - -unsigned char IntercomControlPdu::getCommand() const -{ - return _command; -} - -void IntercomControlPdu::setCommand(unsigned char pX) -{ - _command = pX; -} - -EntityID& IntercomControlPdu::getMasterEntityID() -{ - return _masterEntityID; -} - -const EntityID& IntercomControlPdu::getMasterEntityID() const -{ - return _masterEntityID; -} - -void IntercomControlPdu::setMasterEntityID(const EntityID &pX) -{ - _masterEntityID = pX; -} - -unsigned short IntercomControlPdu::getMasterCommunicationsDeviceID() const -{ - return _masterCommunicationsDeviceID; -} - -void IntercomControlPdu::setMasterCommunicationsDeviceID(unsigned short pX) -{ - _masterCommunicationsDeviceID = pX; -} - -unsigned int IntercomControlPdu::getIntercomParametersLength() const -{ - return _intercomParameters.size(); -} - -std::vector& IntercomControlPdu::getIntercomParameters() -{ - return _intercomParameters; -} - -const std::vector& IntercomControlPdu::getIntercomParameters() const -{ - return _intercomParameters; -} - -void IntercomControlPdu::setIntercomParameters(const std::vector& pX) -{ - _intercomParameters = pX; -} - -void IntercomControlPdu::marshal(DataStream& dataStream) const -{ - RadioCommunicationsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _controlType; - dataStream << _communicationsChannelType; - _sourceEntityID.marshal(dataStream); - dataStream << _sourceCommunicationsDeviceID; - dataStream << _sourceLineID; - dataStream << _transmitPriority; - dataStream << _transmitLineState; - dataStream << _command; - _masterEntityID.marshal(dataStream); - dataStream << _masterCommunicationsDeviceID; - dataStream << ( unsigned int )_intercomParameters.size(); - - for(size_t idx = 0; idx < _intercomParameters.size(); idx++) - { - IntercomCommunicationsParameters x = _intercomParameters[idx]; - x.marshal(dataStream); - } - -} - -void IntercomControlPdu::unmarshal(DataStream& dataStream) -{ - RadioCommunicationsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _controlType; - dataStream >> _communicationsChannelType; - _sourceEntityID.unmarshal(dataStream); - dataStream >> _sourceCommunicationsDeviceID; - dataStream >> _sourceLineID; - dataStream >> _transmitPriority; - dataStream >> _transmitLineState; - dataStream >> _command; - _masterEntityID.unmarshal(dataStream); - dataStream >> _masterCommunicationsDeviceID; - dataStream >> _intercomParametersLength; - - _intercomParameters.clear(); - for(size_t idx = 0; idx < _intercomParametersLength; idx++) - { - IntercomCommunicationsParameters x; - x.unmarshal(dataStream); - _intercomParameters.push_back(x); - } -} - - -bool IntercomControlPdu::operator ==(const IntercomControlPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); - - if( ! (_controlType == rhs._controlType) ) ivarsEqual = false; - if( ! (_communicationsChannelType == rhs._communicationsChannelType) ) ivarsEqual = false; - if( ! (_sourceEntityID == rhs._sourceEntityID) ) ivarsEqual = false; - if( ! (_sourceCommunicationsDeviceID == rhs._sourceCommunicationsDeviceID) ) ivarsEqual = false; - if( ! (_sourceLineID == rhs._sourceLineID) ) ivarsEqual = false; - if( ! (_transmitPriority == rhs._transmitPriority) ) ivarsEqual = false; - if( ! (_transmitLineState == rhs._transmitLineState) ) ivarsEqual = false; - if( ! (_command == rhs._command) ) ivarsEqual = false; - if( ! (_masterEntityID == rhs._masterEntityID) ) ivarsEqual = false; - if( ! (_masterCommunicationsDeviceID == rhs._masterCommunicationsDeviceID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _intercomParameters.size(); idx++) - { - if( ! ( _intercomParameters[idx] == rhs._intercomParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int IntercomControlPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _controlType - marshalSize = marshalSize + 1; // _communicationsChannelType - marshalSize = marshalSize + _sourceEntityID.getMarshalledSize(); // _sourceEntityID - marshalSize = marshalSize + 1; // _sourceCommunicationsDeviceID - marshalSize = marshalSize + 1; // _sourceLineID - marshalSize = marshalSize + 1; // _transmitPriority - marshalSize = marshalSize + 1; // _transmitLineState - marshalSize = marshalSize + 1; // _command - marshalSize = marshalSize + _masterEntityID.getMarshalledSize(); // _masterEntityID - marshalSize = marshalSize + 2; // _masterCommunicationsDeviceID - marshalSize = marshalSize + 4; // _intercomParametersLength - - for(unsigned long long idx=0; idx < _intercomParameters.size(); idx++) - { - IntercomCommunicationsParameters listElement = _intercomParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IntercomControlPdu.h b/src/dis6/IntercomControlPdu.h deleted file mode 100644 index 77c3eb67..00000000 --- a/src/dis6/IntercomControlPdu.h +++ /dev/null @@ -1,141 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.8.5. Detailed inofrmation about the state of an intercom device and the actions it is requestion of another intercom device, or the response to a requested action. Required manual intervention to fix the intercom parameters, which can be of varialbe length. UNFINSISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT IntercomControlPdu : public RadioCommunicationsFamilyPdu -{ -protected: - /** control type */ - unsigned char _controlType; - - /** control type */ - unsigned char _communicationsChannelType; - - /** Source entity ID */ - EntityID _sourceEntityID; - - /** The specific intercom device being simulated within an entity. */ - unsigned char _sourceCommunicationsDeviceID; - - /** Line number to which the intercom control refers */ - unsigned char _sourceLineID; - - /** priority of this message relative to transmissons from other intercom devices */ - unsigned char _transmitPriority; - - /** current transmit state of the line */ - unsigned char _transmitLineState; - - /** detailed type requested. */ - unsigned char _command; - - /** eid of the entity that has created this intercom channel. */ - EntityID _masterEntityID; - - /** specific intercom device that has created this intercom channel */ - unsigned short _masterCommunicationsDeviceID; - - /** number of intercom parameters */ - unsigned int _intercomParametersLength; - - /** ^^^This is wrong--the length of the data field is variable. Using a long for now. */ - std::vector _intercomParameters; - - - public: - IntercomControlPdu(); - virtual ~IntercomControlPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getControlType() const; - void setControlType(unsigned char pX); - - unsigned char getCommunicationsChannelType() const; - void setCommunicationsChannelType(unsigned char pX); - - EntityID& getSourceEntityID(); - const EntityID& getSourceEntityID() const; - void setSourceEntityID(const EntityID &pX); - - unsigned char getSourceCommunicationsDeviceID() const; - void setSourceCommunicationsDeviceID(unsigned char pX); - - unsigned char getSourceLineID() const; - void setSourceLineID(unsigned char pX); - - unsigned char getTransmitPriority() const; - void setTransmitPriority(unsigned char pX); - - unsigned char getTransmitLineState() const; - void setTransmitLineState(unsigned char pX); - - unsigned char getCommand() const; - void setCommand(unsigned char pX); - - EntityID& getMasterEntityID(); - const EntityID& getMasterEntityID() const; - void setMasterEntityID(const EntityID &pX); - - unsigned short getMasterCommunicationsDeviceID() const; - void setMasterCommunicationsDeviceID(unsigned short pX); - - unsigned int getIntercomParametersLength() const; - - std::vector& getIntercomParameters(); - const std::vector& getIntercomParameters() const; - void setIntercomParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IntercomControlPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IntercomSignalPdu.cpp b/src/dis6/IntercomSignalPdu.cpp deleted file mode 100644 index fa0277cf..00000000 --- a/src/dis6/IntercomSignalPdu.cpp +++ /dev/null @@ -1,159 +0,0 @@ -#include - -using namespace DIS; - -IntercomSignalPdu::IntercomSignalPdu() - : RadioCommunicationsFamilyPdu(), _entityID(), _communicationsDeviceID(0), - _encodingScheme(0), _tdlType(0), _sampleRate(0), _dataLength(0), - _samples(0) { - setPduType(31); -} - -IntercomSignalPdu::~IntercomSignalPdu() { _data.clear(); } - -EntityID &IntercomSignalPdu::getEntityID() { return _entityID; } - -const EntityID &IntercomSignalPdu::getEntityID() const { return _entityID; } - -void IntercomSignalPdu::setEntityID(const EntityID &pX) { _entityID = pX; } - -unsigned short IntercomSignalPdu::getCommunicationsDeviceID() const { - return _communicationsDeviceID; -} - -void IntercomSignalPdu::setCommunicationsDeviceID(unsigned short pX) { - _communicationsDeviceID = pX; -} - -unsigned short IntercomSignalPdu::getEncodingScheme() const { - return _encodingScheme; -} - -void IntercomSignalPdu::setEncodingScheme(unsigned short pX) { - _encodingScheme = pX; -} - -unsigned short IntercomSignalPdu::getTdlType() const { return _tdlType; } - -void IntercomSignalPdu::setTdlType(unsigned short pX) { _tdlType = pX; } - -unsigned int IntercomSignalPdu::getSampleRate() const { return _sampleRate; } - -void IntercomSignalPdu::setSampleRate(unsigned int pX) { _sampleRate = pX; } - -unsigned short IntercomSignalPdu::getDataLength() const { return _data.size(); } - -unsigned short IntercomSignalPdu::getSamples() const { return _samples; } - -void IntercomSignalPdu::setSamples(unsigned short pX) { _samples = pX; } - -std::vector &IntercomSignalPdu::getData() { return _data; } - -const std::vector &IntercomSignalPdu::getData() const { return _data; } - -void IntercomSignalPdu::setData(const std::vector &pX) { _data = pX; } - -void IntercomSignalPdu::marshal(DataStream &dataStream) const { - RadioCommunicationsFamilyPdu::marshal( - dataStream); // Marshal information in superclass first - _entityID.marshal(dataStream); - dataStream << _communicationsDeviceID; - dataStream << _encodingScheme; - dataStream << _tdlType; - dataStream << _sampleRate; - dataStream << (unsigned short)_data.size(); - dataStream << _samples; - - for (auto &byte : _data) { - dataStream << byte; - } -} - -void IntercomSignalPdu::unmarshal(DataStream &dataStream) { - RadioCommunicationsFamilyPdu::unmarshal( - dataStream); // unmarshal information in superclass first - _entityID.unmarshal(dataStream); - dataStream >> _communicationsDeviceID; - dataStream >> _encodingScheme; - dataStream >> _tdlType; - dataStream >> _sampleRate; - dataStream >> _dataLength; - dataStream >> _samples; - - _data.clear(); - for (auto idx = 0; idx < _dataLength; idx++) { - uint8_t x; - dataStream >> x; - _data.push_back(x); - } -} - -bool IntercomSignalPdu::operator==(const IntercomSignalPdu &rhs) const { - bool ivarsEqual = true; - - ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); - - if (!(_entityID == rhs._entityID)) - ivarsEqual = false; - if (!(_communicationsDeviceID == rhs._communicationsDeviceID)) - ivarsEqual = false; - if (!(_encodingScheme == rhs._encodingScheme)) - ivarsEqual = false; - if (!(_tdlType == rhs._tdlType)) - ivarsEqual = false; - if (!(_sampleRate == rhs._sampleRate)) - ivarsEqual = false; - if (!(_samples == rhs._samples)) - ivarsEqual = false; - - ivarsEqual = (_data == rhs._data); - - return ivarsEqual; -} - -int IntercomSignalPdu::getMarshalledSize() const { - int marshalSize = 0; - - marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); - marshalSize += _entityID.getMarshalledSize(); // _entityID - marshalSize += 2; // _communicationsDeviceID - marshalSize += 2; // _encodingScheme - marshalSize += 2; // _tdlType - marshalSize += 4; // _sampleRate - marshalSize += 2; // _dataLength - marshalSize += 2; // _samples - marshalSize += _data.size(); - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IntercomSignalPdu.h b/src/dis6/IntercomSignalPdu.h deleted file mode 100644 index 79a754be..00000000 --- a/src/dis6/IntercomSignalPdu.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include "dis6/EntityID.h" -#include "dis6/RadioCommunicationsFamilyPdu.h" -#include "dis6/opendis6_export.h" -#include "dis6/utils/DataStream.h" -#include -#include - -namespace DIS { -// Section 5.3.8.4. Actual transmission of intercome voice data. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All -// rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT IntercomSignalPdu : public RadioCommunicationsFamilyPdu { -protected: - /** entity ID */ - EntityID _entityID; - - /** ID of communications device */ - unsigned short _communicationsDeviceID; - - /** encoding scheme */ - unsigned short _encodingScheme; - - /** tactical data link type */ - unsigned short _tdlType; - - /** sample rate */ - unsigned int _sampleRate; - - /** data length */ - unsigned short _dataLength; - - /** samples */ - unsigned short _samples; - - /** data bytes */ - std::vector _data; - -public: - IntercomSignalPdu(); - virtual ~IntercomSignalPdu(); - - virtual void marshal(DataStream &dataStream) const; - virtual void unmarshal(DataStream &dataStream); - - EntityID &getEntityID(); - const EntityID &getEntityID() const; - void setEntityID(const EntityID &pX); - - unsigned short getCommunicationsDeviceID() const; - void setCommunicationsDeviceID(unsigned short pX); - - unsigned short getEncodingScheme() const; - void setEncodingScheme(unsigned short pX); - - unsigned short getTdlType() const; - void setTdlType(unsigned short pX); - - unsigned int getSampleRate() const; - void setSampleRate(unsigned int pX); - - unsigned short getDataLength() const; - - unsigned short getSamples() const; - void setSamples(unsigned short pX); - - std::vector &getData(); - const std::vector &getData() const; - void setData(const std::vector &pX); - - virtual int getMarshalledSize() const; - - bool operator==(const IntercomSignalPdu &rhs) const; -}; -} // namespace DIS - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IsGroupOfPdu.cpp b/src/dis6/IsGroupOfPdu.cpp deleted file mode 100644 index 8f5f8230..00000000 --- a/src/dis6/IsGroupOfPdu.cpp +++ /dev/null @@ -1,206 +0,0 @@ -#include - -using namespace DIS; - - -IsGroupOfPdu::IsGroupOfPdu() : EntityManagementFamilyPdu(), - _groupEntityID(), - _groupedEntityCategory(0), - _numberOfGroupedEntities(0), - _pad2(0), - _latitude(0.0), - _longitude(0.0) -{ - setPduType( 34 ); -} - -IsGroupOfPdu::~IsGroupOfPdu() -{ - _groupedEntityDescriptions.clear(); -} - -EntityID& IsGroupOfPdu::getGroupEntityID() -{ - return _groupEntityID; -} - -const EntityID& IsGroupOfPdu::getGroupEntityID() const -{ - return _groupEntityID; -} - -void IsGroupOfPdu::setGroupEntityID(const EntityID &pX) -{ - _groupEntityID = pX; -} - -unsigned char IsGroupOfPdu::getGroupedEntityCategory() const -{ - return _groupedEntityCategory; -} - -void IsGroupOfPdu::setGroupedEntityCategory(unsigned char pX) -{ - _groupedEntityCategory = pX; -} - -unsigned char IsGroupOfPdu::getNumberOfGroupedEntities() const -{ - return _groupedEntityDescriptions.size(); -} - -unsigned int IsGroupOfPdu::getPad2() const -{ - return _pad2; -} - -void IsGroupOfPdu::setPad2(unsigned int pX) -{ - _pad2 = pX; -} - -double IsGroupOfPdu::getLatitude() const -{ - return _latitude; -} - -void IsGroupOfPdu::setLatitude(double pX) -{ - _latitude = pX; -} - -double IsGroupOfPdu::getLongitude() const -{ - return _longitude; -} - -void IsGroupOfPdu::setLongitude(double pX) -{ - _longitude = pX; -} - -std::vector& IsGroupOfPdu::getGroupedEntityDescriptions() -{ - return _groupedEntityDescriptions; -} - -const std::vector& IsGroupOfPdu::getGroupedEntityDescriptions() const -{ - return _groupedEntityDescriptions; -} - -void IsGroupOfPdu::setGroupedEntityDescriptions(const std::vector& pX) -{ - _groupedEntityDescriptions = pX; -} - -void IsGroupOfPdu::marshal(DataStream& dataStream) const -{ - EntityManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _groupEntityID.marshal(dataStream); - dataStream << _groupedEntityCategory; - dataStream << ( unsigned char )_groupedEntityDescriptions.size(); - dataStream << _pad2; - dataStream << _latitude; - dataStream << _longitude; - - for(size_t idx = 0; idx < _groupedEntityDescriptions.size(); idx++) - { - VariableDatum x = _groupedEntityDescriptions[idx]; - x.marshal(dataStream); - } - -} - -void IsGroupOfPdu::unmarshal(DataStream& dataStream) -{ - EntityManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _groupEntityID.unmarshal(dataStream); - dataStream >> _groupedEntityCategory; - dataStream >> _numberOfGroupedEntities; - dataStream >> _pad2; - dataStream >> _latitude; - dataStream >> _longitude; - - _groupedEntityDescriptions.clear(); - for(size_t idx = 0; idx < _numberOfGroupedEntities; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _groupedEntityDescriptions.push_back(x); - } -} - - -bool IsGroupOfPdu::operator ==(const IsGroupOfPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); - - if( ! (_groupEntityID == rhs._groupEntityID) ) ivarsEqual = false; - if( ! (_groupedEntityCategory == rhs._groupedEntityCategory) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_latitude == rhs._latitude) ) ivarsEqual = false; - if( ! (_longitude == rhs._longitude) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _groupedEntityDescriptions.size(); idx++) - { - if( ! ( _groupedEntityDescriptions[idx] == rhs._groupedEntityDescriptions[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int IsGroupOfPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _groupEntityID.getMarshalledSize(); // _groupEntityID - marshalSize = marshalSize + 1; // _groupedEntityCategory - marshalSize = marshalSize + 1; // _numberOfGroupedEntities - marshalSize = marshalSize + 4; // _pad2 - marshalSize = marshalSize + 8; // _latitude - marshalSize = marshalSize + 8; // _longitude - - for(unsigned long long idx=0; idx < _groupedEntityDescriptions.size(); idx++) - { - VariableDatum listElement = _groupedEntityDescriptions[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IsGroupOfPdu.h b/src/dis6/IsGroupOfPdu.h deleted file mode 100644 index 2d765f89..00000000 --- a/src/dis6/IsGroupOfPdu.h +++ /dev/null @@ -1,109 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.9.2 Information about a particular group of entities grouped together for the purposes of netowrk bandwidth reduction or aggregation. Needs manual cleanup. The GED size requires a database lookup. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT IsGroupOfPdu : public EntityManagementFamilyPdu -{ -protected: - /** ID of aggregated entities */ - EntityID _groupEntityID; - - /** type of entities constituting the group */ - unsigned char _groupedEntityCategory; - - /** Number of individual entities constituting the group */ - unsigned char _numberOfGroupedEntities; - - /** padding */ - unsigned int _pad2; - - /** latitude */ - double _latitude; - - /** longitude */ - double _longitude; - - /** GED records about each individual entity in the group. ^^^this is wrong--need a database lookup to find the actual size of the list elements */ - std::vector _groupedEntityDescriptions; - - - public: - IsGroupOfPdu(); - virtual ~IsGroupOfPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getGroupEntityID(); - const EntityID& getGroupEntityID() const; - void setGroupEntityID(const EntityID &pX); - - unsigned char getGroupedEntityCategory() const; - void setGroupedEntityCategory(unsigned char pX); - - unsigned char getNumberOfGroupedEntities() const; - - unsigned int getPad2() const; - void setPad2(unsigned int pX); - - double getLatitude() const; - void setLatitude(double pX); - - double getLongitude() const; - void setLongitude(double pX); - - std::vector& getGroupedEntityDescriptions(); - const std::vector& getGroupedEntityDescriptions() const; - void setGroupedEntityDescriptions(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IsGroupOfPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IsPartOfPdu.cpp b/src/dis6/IsPartOfPdu.cpp deleted file mode 100644 index e8111e65..00000000 --- a/src/dis6/IsPartOfPdu.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include - -using namespace DIS; - - -IsPartOfPdu::IsPartOfPdu() : EntityManagementFamilyPdu(), - _orginatingEntityID(), - _receivingEntityID(), - _relationship(), - _partLocation(), - _namedLocationID(), - _partEntityType() -{ - setPduType( 36 ); -} - -IsPartOfPdu::~IsPartOfPdu() -{ -} - -EntityID& IsPartOfPdu::getOrginatingEntityID() -{ - return _orginatingEntityID; -} - -const EntityID& IsPartOfPdu::getOrginatingEntityID() const -{ - return _orginatingEntityID; -} - -void IsPartOfPdu::setOrginatingEntityID(const EntityID &pX) -{ - _orginatingEntityID = pX; -} - -EntityID& IsPartOfPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& IsPartOfPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void IsPartOfPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -Relationship& IsPartOfPdu::getRelationship() -{ - return _relationship; -} - -const Relationship& IsPartOfPdu::getRelationship() const -{ - return _relationship; -} - -void IsPartOfPdu::setRelationship(const Relationship &pX) -{ - _relationship = pX; -} - -Vector3Float& IsPartOfPdu::getPartLocation() -{ - return _partLocation; -} - -const Vector3Float& IsPartOfPdu::getPartLocation() const -{ - return _partLocation; -} - -void IsPartOfPdu::setPartLocation(const Vector3Float &pX) -{ - _partLocation = pX; -} - -NamedLocation& IsPartOfPdu::getNamedLocationID() -{ - return _namedLocationID; -} - -const NamedLocation& IsPartOfPdu::getNamedLocationID() const -{ - return _namedLocationID; -} - -void IsPartOfPdu::setNamedLocationID(const NamedLocation &pX) -{ - _namedLocationID = pX; -} - -EntityType& IsPartOfPdu::getPartEntityType() -{ - return _partEntityType; -} - -const EntityType& IsPartOfPdu::getPartEntityType() const -{ - return _partEntityType; -} - -void IsPartOfPdu::setPartEntityType(const EntityType &pX) -{ - _partEntityType = pX; -} - -void IsPartOfPdu::marshal(DataStream& dataStream) const -{ - EntityManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _orginatingEntityID.marshal(dataStream); - _receivingEntityID.marshal(dataStream); - _relationship.marshal(dataStream); - _partLocation.marshal(dataStream); - _namedLocationID.marshal(dataStream); - _partEntityType.marshal(dataStream); -} - -void IsPartOfPdu::unmarshal(DataStream& dataStream) -{ - EntityManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _orginatingEntityID.unmarshal(dataStream); - _receivingEntityID.unmarshal(dataStream); - _relationship.unmarshal(dataStream); - _partLocation.unmarshal(dataStream); - _namedLocationID.unmarshal(dataStream); - _partEntityType.unmarshal(dataStream); -} - - -bool IsPartOfPdu::operator ==(const IsPartOfPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); - - if( ! (_orginatingEntityID == rhs._orginatingEntityID) ) ivarsEqual = false; - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_relationship == rhs._relationship) ) ivarsEqual = false; - if( ! (_partLocation == rhs._partLocation) ) ivarsEqual = false; - if( ! (_namedLocationID == rhs._namedLocationID) ) ivarsEqual = false; - if( ! (_partEntityType == rhs._partEntityType) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IsPartOfPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _relationship.getMarshalledSize(); // _relationship - marshalSize = marshalSize + _partLocation.getMarshalledSize(); // _partLocation - marshalSize = marshalSize + _namedLocationID.getMarshalledSize(); // _namedLocationID - marshalSize = marshalSize + _partEntityType.getMarshalledSize(); // _partEntityType - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/IsPartOfPdu.h b/src/dis6/IsPartOfPdu.h deleted file mode 100644 index c05c1de4..00000000 --- a/src/dis6/IsPartOfPdu.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.9.4 The joining of two or more simulation entities is communicated by this PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT IsPartOfPdu : public EntityManagementFamilyPdu -{ -protected: - /** ID of entity originating PDU */ - EntityID _orginatingEntityID; - - /** ID of entity receiving PDU */ - EntityID _receivingEntityID; - - /** relationship of joined parts */ - Relationship _relationship; - - /** location of part; centroid of part in host's coordinate system. x=range, y=bearing, z=0 */ - Vector3Float _partLocation; - - /** named location */ - NamedLocation _namedLocationID; - - /** entity type */ - EntityType _partEntityType; - - - public: - IsPartOfPdu(); - virtual ~IsPartOfPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOrginatingEntityID(); - const EntityID& getOrginatingEntityID() const; - void setOrginatingEntityID(const EntityID &pX); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - Relationship& getRelationship(); - const Relationship& getRelationship() const; - void setRelationship(const Relationship &pX); - - Vector3Float& getPartLocation(); - const Vector3Float& getPartLocation() const; - void setPartLocation(const Vector3Float &pX); - - NamedLocation& getNamedLocationID(); - const NamedLocation& getNamedLocationID() const; - void setNamedLocationID(const NamedLocation &pX); - - EntityType& getPartEntityType(); - const EntityType& getPartEntityType() const; - void setPartEntityType(const EntityType &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IsPartOfPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LayerHeader.cpp b/src/dis6/LayerHeader.cpp deleted file mode 100644 index 5ff69e44..00000000 --- a/src/dis6/LayerHeader.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -LayerHeader::LayerHeader(): - _layerNumber(0), - _layerSpecificInformaiton(0), - _length(0) -{ -} - -LayerHeader::~LayerHeader() -{ -} - -unsigned char LayerHeader::getLayerNumber() const -{ - return _layerNumber; -} - -void LayerHeader::setLayerNumber(unsigned char pX) -{ - _layerNumber = pX; -} - -unsigned char LayerHeader::getLayerSpecificInformaiton() const -{ - return _layerSpecificInformaiton; -} - -void LayerHeader::setLayerSpecificInformaiton(unsigned char pX) -{ - _layerSpecificInformaiton = pX; -} - -unsigned short LayerHeader::getLength() const -{ - return _length; -} - -void LayerHeader::setLength(unsigned short pX) -{ - _length = pX; -} - -void LayerHeader::marshal(DataStream& dataStream) const -{ - dataStream << _layerNumber; - dataStream << _layerSpecificInformaiton; - dataStream << _length; -} - -void LayerHeader::unmarshal(DataStream& dataStream) -{ - dataStream >> _layerNumber; - dataStream >> _layerSpecificInformaiton; - dataStream >> _length; -} - - -bool LayerHeader::operator ==(const LayerHeader& rhs) const - { - bool ivarsEqual = true; - - if( ! (_layerNumber == rhs._layerNumber) ) ivarsEqual = false; - if( ! (_layerSpecificInformaiton == rhs._layerSpecificInformaiton) ) ivarsEqual = false; - if( ! (_length == rhs._length) ) ivarsEqual = false; - - return ivarsEqual; - } - -int LayerHeader::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _layerNumber - marshalSize = marshalSize + 1; // _layerSpecificInformaiton - marshalSize = marshalSize + 2; // _length - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LayerHeader.h b/src/dis6/LayerHeader.h deleted file mode 100644 index 96f4ee2a..00000000 --- a/src/dis6/LayerHeader.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.2.47. Layer header. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT LayerHeader -{ -protected: - /** Layer number */ - unsigned char _layerNumber; - - /** Layer speccific information enumeration */ - unsigned char _layerSpecificInformaiton; - - /** information length */ - unsigned short _length; - - - public: - LayerHeader(); - virtual ~LayerHeader(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getLayerNumber() const; - void setLayerNumber(unsigned char pX); - - unsigned char getLayerSpecificInformaiton() const; - void setLayerSpecificInformaiton(unsigned char pX); - - unsigned short getLength() const; - void setLength(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LayerHeader& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LinearObjectStatePdu.cpp b/src/dis6/LinearObjectStatePdu.cpp deleted file mode 100644 index 0a0ab236..00000000 --- a/src/dis6/LinearObjectStatePdu.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include - -using namespace DIS; - - -LinearObjectStatePdu::LinearObjectStatePdu() : SyntheticEnvironmentFamilyPdu(), - _objectID(), - _referencedObjectID(), - _updateNumber(0), - _forceID(0), - _numberOfSegments(0), - _requesterID(), - _receivingID(), - _objectType() -{ - setPduType( 44 ); -} - -LinearObjectStatePdu::~LinearObjectStatePdu() -{ - _linearSegmentParameters.clear(); -} - -EntityID& LinearObjectStatePdu::getObjectID() -{ - return _objectID; -} - -const EntityID& LinearObjectStatePdu::getObjectID() const -{ - return _objectID; -} - -void LinearObjectStatePdu::setObjectID(const EntityID &pX) -{ - _objectID = pX; -} - -EntityID& LinearObjectStatePdu::getReferencedObjectID() -{ - return _referencedObjectID; -} - -const EntityID& LinearObjectStatePdu::getReferencedObjectID() const -{ - return _referencedObjectID; -} - -void LinearObjectStatePdu::setReferencedObjectID(const EntityID &pX) -{ - _referencedObjectID = pX; -} - -unsigned short LinearObjectStatePdu::getUpdateNumber() const -{ - return _updateNumber; -} - -void LinearObjectStatePdu::setUpdateNumber(unsigned short pX) -{ - _updateNumber = pX; -} - -unsigned char LinearObjectStatePdu::getForceID() const -{ - return _forceID; -} - -void LinearObjectStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char LinearObjectStatePdu::getNumberOfSegments() const -{ - return _linearSegmentParameters.size(); -} - -SimulationAddress& LinearObjectStatePdu::getRequesterID() -{ - return _requesterID; -} - -const SimulationAddress& LinearObjectStatePdu::getRequesterID() const -{ - return _requesterID; -} - -void LinearObjectStatePdu::setRequesterID(const SimulationAddress &pX) -{ - _requesterID = pX; -} - -SimulationAddress& LinearObjectStatePdu::getReceivingID() -{ - return _receivingID; -} - -const SimulationAddress& LinearObjectStatePdu::getReceivingID() const -{ - return _receivingID; -} - -void LinearObjectStatePdu::setReceivingID(const SimulationAddress &pX) -{ - _receivingID = pX; -} - -ObjectType& LinearObjectStatePdu::getObjectType() -{ - return _objectType; -} - -const ObjectType& LinearObjectStatePdu::getObjectType() const -{ - return _objectType; -} - -void LinearObjectStatePdu::setObjectType(const ObjectType &pX) -{ - _objectType = pX; -} - -std::vector& LinearObjectStatePdu::getLinearSegmentParameters() -{ - return _linearSegmentParameters; -} - -const std::vector& LinearObjectStatePdu::getLinearSegmentParameters() const -{ - return _linearSegmentParameters; -} - -void LinearObjectStatePdu::setLinearSegmentParameters(const std::vector& pX) -{ - _linearSegmentParameters = pX; -} - -void LinearObjectStatePdu::marshal(DataStream& dataStream) const -{ - SyntheticEnvironmentFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _objectID.marshal(dataStream); - _referencedObjectID.marshal(dataStream); - dataStream << _updateNumber; - dataStream << _forceID; - dataStream << ( unsigned char )_linearSegmentParameters.size(); - _requesterID.marshal(dataStream); - _receivingID.marshal(dataStream); - _objectType.marshal(dataStream); - - for(size_t idx = 0; idx < _linearSegmentParameters.size(); idx++) - { - LinearSegmentParameter x = _linearSegmentParameters[idx]; - x.marshal(dataStream); - } - -} - -void LinearObjectStatePdu::unmarshal(DataStream& dataStream) -{ - SyntheticEnvironmentFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _objectID.unmarshal(dataStream); - _referencedObjectID.unmarshal(dataStream); - dataStream >> _updateNumber; - dataStream >> _forceID; - dataStream >> _numberOfSegments; - _requesterID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - _objectType.unmarshal(dataStream); - - _linearSegmentParameters.clear(); - for(size_t idx = 0; idx < _numberOfSegments; idx++) - { - LinearSegmentParameter x; - x.unmarshal(dataStream); - _linearSegmentParameters.push_back(x); - } -} - - -bool LinearObjectStatePdu::operator ==(const LinearObjectStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); - - if( ! (_objectID == rhs._objectID) ) ivarsEqual = false; - if( ! (_referencedObjectID == rhs._referencedObjectID) ) ivarsEqual = false; - if( ! (_updateNumber == rhs._updateNumber) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_requesterID == rhs._requesterID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_objectType == rhs._objectType) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _linearSegmentParameters.size(); idx++) - { - if( ! ( _linearSegmentParameters[idx] == rhs._linearSegmentParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int LinearObjectStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID - marshalSize = marshalSize + _referencedObjectID.getMarshalledSize(); // _referencedObjectID - marshalSize = marshalSize + 2; // _updateNumber - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _numberOfSegments - marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType - - for(unsigned long long idx=0; idx < _linearSegmentParameters.size(); idx++) - { - LinearSegmentParameter listElement = _linearSegmentParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LinearObjectStatePdu.h b/src/dis6/LinearObjectStatePdu.h deleted file mode 100644 index 42b2daa7..00000000 --- a/src/dis6/LinearObjectStatePdu.h +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.11.4: Information abut the addition or modification of a synthecic enviroment object that is anchored to the terrain with a single point and has size or orientation. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT LinearObjectStatePdu : public SyntheticEnvironmentFamilyPdu -{ -protected: - /** Object in synthetic environment */ - EntityID _objectID; - - /** Object with which this point object is associated */ - EntityID _referencedObjectID; - - /** unique update number of each state transition of an object */ - unsigned short _updateNumber; - - /** force ID */ - unsigned char _forceID; - - /** number of linear segment parameters */ - unsigned char _numberOfSegments; - - /** requesterID */ - SimulationAddress _requesterID; - - /** receiver ID */ - SimulationAddress _receivingID; - - /** Object type */ - ObjectType _objectType; - - /** Linear segment parameters */ - std::vector _linearSegmentParameters; - - - public: - LinearObjectStatePdu(); - virtual ~LinearObjectStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getObjectID(); - const EntityID& getObjectID() const; - void setObjectID(const EntityID &pX); - - EntityID& getReferencedObjectID(); - const EntityID& getReferencedObjectID() const; - void setReferencedObjectID(const EntityID &pX); - - unsigned short getUpdateNumber() const; - void setUpdateNumber(unsigned short pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getNumberOfSegments() const; - - SimulationAddress& getRequesterID(); - const SimulationAddress& getRequesterID() const; - void setRequesterID(const SimulationAddress &pX); - - SimulationAddress& getReceivingID(); - const SimulationAddress& getReceivingID() const; - void setReceivingID(const SimulationAddress &pX); - - ObjectType& getObjectType(); - const ObjectType& getObjectType() const; - void setObjectType(const ObjectType &pX); - - std::vector& getLinearSegmentParameters(); - const std::vector& getLinearSegmentParameters() const; - void setLinearSegmentParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LinearObjectStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LinearSegmentParameter.cpp b/src/dis6/LinearSegmentParameter.cpp deleted file mode 100644 index 6a5c9978..00000000 --- a/src/dis6/LinearSegmentParameter.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include - -using namespace DIS; - - -LinearSegmentParameter::LinearSegmentParameter(): - _segmentNumber(0), - _segmentAppearance(), - _location(), - _orientation(), - _segmentLength(0), - _segmentWidth(0), - _segmentHeight(0), - _segmentDepth(0), - _pad1(0) -{ -} - -LinearSegmentParameter::~LinearSegmentParameter() -{ -} - -unsigned char LinearSegmentParameter::getSegmentNumber() const -{ - return _segmentNumber; -} - -void LinearSegmentParameter::setSegmentNumber(unsigned char pX) -{ - _segmentNumber = pX; -} - -SixByteChunk& LinearSegmentParameter::getSegmentAppearance() -{ - return _segmentAppearance; -} - -const SixByteChunk& LinearSegmentParameter::getSegmentAppearance() const -{ - return _segmentAppearance; -} - -void LinearSegmentParameter::setSegmentAppearance(const SixByteChunk &pX) -{ - _segmentAppearance = pX; -} - -Vector3Double& LinearSegmentParameter::getLocation() -{ - return _location; -} - -const Vector3Double& LinearSegmentParameter::getLocation() const -{ - return _location; -} - -void LinearSegmentParameter::setLocation(const Vector3Double &pX) -{ - _location = pX; -} - -Orientation& LinearSegmentParameter::getOrientation() -{ - return _orientation; -} - -const Orientation& LinearSegmentParameter::getOrientation() const -{ - return _orientation; -} - -void LinearSegmentParameter::setOrientation(const Orientation &pX) -{ - _orientation = pX; -} - -unsigned short LinearSegmentParameter::getSegmentLength() const -{ - return _segmentLength; -} - -void LinearSegmentParameter::setSegmentLength(unsigned short pX) -{ - _segmentLength = pX; -} - -unsigned short LinearSegmentParameter::getSegmentWidth() const -{ - return _segmentWidth; -} - -void LinearSegmentParameter::setSegmentWidth(unsigned short pX) -{ - _segmentWidth = pX; -} - -unsigned short LinearSegmentParameter::getSegmentHeight() const -{ - return _segmentHeight; -} - -void LinearSegmentParameter::setSegmentHeight(unsigned short pX) -{ - _segmentHeight = pX; -} - -unsigned short LinearSegmentParameter::getSegmentDepth() const -{ - return _segmentDepth; -} - -void LinearSegmentParameter::setSegmentDepth(unsigned short pX) -{ - _segmentDepth = pX; -} - -unsigned int LinearSegmentParameter::getPad1() const -{ - return _pad1; -} - -void LinearSegmentParameter::setPad1(unsigned int pX) -{ - _pad1 = pX; -} - -void LinearSegmentParameter::marshal(DataStream& dataStream) const -{ - dataStream << _segmentNumber; - _segmentAppearance.marshal(dataStream); - _location.marshal(dataStream); - _orientation.marshal(dataStream); - dataStream << _segmentLength; - dataStream << _segmentWidth; - dataStream << _segmentHeight; - dataStream << _segmentDepth; - dataStream << _pad1; -} - -void LinearSegmentParameter::unmarshal(DataStream& dataStream) -{ - dataStream >> _segmentNumber; - _segmentAppearance.unmarshal(dataStream); - _location.unmarshal(dataStream); - _orientation.unmarshal(dataStream); - dataStream >> _segmentLength; - dataStream >> _segmentWidth; - dataStream >> _segmentHeight; - dataStream >> _segmentDepth; - dataStream >> _pad1; -} - - -bool LinearSegmentParameter::operator ==(const LinearSegmentParameter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_segmentNumber == rhs._segmentNumber) ) ivarsEqual = false; - if( ! (_segmentAppearance == rhs._segmentAppearance) ) ivarsEqual = false; - if( ! (_location == rhs._location) ) ivarsEqual = false; - if( ! (_orientation == rhs._orientation) ) ivarsEqual = false; - if( ! (_segmentLength == rhs._segmentLength) ) ivarsEqual = false; - if( ! (_segmentWidth == rhs._segmentWidth) ) ivarsEqual = false; - if( ! (_segmentHeight == rhs._segmentHeight) ) ivarsEqual = false; - if( ! (_segmentDepth == rhs._segmentDepth) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - - return ivarsEqual; - } - -int LinearSegmentParameter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _segmentNumber - marshalSize = marshalSize + _segmentAppearance.getMarshalledSize(); // _segmentAppearance - marshalSize = marshalSize + _location.getMarshalledSize(); // _location - marshalSize = marshalSize + _orientation.getMarshalledSize(); // _orientation - marshalSize = marshalSize + 2; // _segmentLength - marshalSize = marshalSize + 2; // _segmentWidth - marshalSize = marshalSize + 2; // _segmentHeight - marshalSize = marshalSize + 2; // _segmentDepth - marshalSize = marshalSize + 4; // _pad1 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LinearSegmentParameter.h b/src/dis6/LinearSegmentParameter.h deleted file mode 100644 index b8884d7d..00000000 --- a/src/dis6/LinearSegmentParameter.h +++ /dev/null @@ -1,122 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// 5.2.48: Linear segment parameters - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT LinearSegmentParameter -{ -protected: - /** number of segments */ - unsigned char _segmentNumber; - - /** segment appearance */ - SixByteChunk _segmentAppearance; - - /** location */ - Vector3Double _location; - - /** orientation */ - Orientation _orientation; - - /** segmentLength */ - unsigned short _segmentLength; - - /** segmentWidth */ - unsigned short _segmentWidth; - - /** segmentHeight */ - unsigned short _segmentHeight; - - /** segment Depth */ - unsigned short _segmentDepth; - - /** segment Depth */ - unsigned int _pad1; - - - public: - LinearSegmentParameter(); - virtual ~LinearSegmentParameter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getSegmentNumber() const; - void setSegmentNumber(unsigned char pX); - - SixByteChunk& getSegmentAppearance(); - const SixByteChunk& getSegmentAppearance() const; - void setSegmentAppearance(const SixByteChunk &pX); - - Vector3Double& getLocation(); - const Vector3Double& getLocation() const; - void setLocation(const Vector3Double &pX); - - Orientation& getOrientation(); - const Orientation& getOrientation() const; - void setOrientation(const Orientation &pX); - - unsigned short getSegmentLength() const; - void setSegmentLength(unsigned short pX); - - unsigned short getSegmentWidth() const; - void setSegmentWidth(unsigned short pX); - - unsigned short getSegmentHeight() const; - void setSegmentHeight(unsigned short pX); - - unsigned short getSegmentDepth() const; - void setSegmentDepth(unsigned short pX); - - unsigned int getPad1() const; - void setPad1(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LinearSegmentParameter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LogisticsFamilyPdu.cpp b/src/dis6/LogisticsFamilyPdu.cpp deleted file mode 100644 index 721b06dc..00000000 --- a/src/dis6/LogisticsFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -LogisticsFamilyPdu::LogisticsFamilyPdu() : Pdu() - -{ - setProtocolFamily( 3 ); -} - -LogisticsFamilyPdu::~LogisticsFamilyPdu() -{ -} - -void LogisticsFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void LogisticsFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool LogisticsFamilyPdu::operator ==(const LogisticsFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int LogisticsFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LogisticsFamilyPdu.h b/src/dis6/LogisticsFamilyPdu.h deleted file mode 100644 index 4d0e395e..00000000 --- a/src/dis6/LogisticsFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.5. Abstract superclass for logistics PDUs. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT LogisticsFamilyPdu : public Pdu -{ -protected: - - public: - LogisticsFamilyPdu(); - virtual ~LogisticsFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LogisticsFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/LogisticsPdu.cpp b/src/dis6/LogisticsPdu.cpp deleted file mode 100644 index 17fb5a0f..00000000 --- a/src/dis6/LogisticsPdu.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace DIS; - - -LogisticsPdu::LogisticsPdu() : Pdu() - -{ - setProtocolFamily( 3 ); -} - -LogisticsPdu::~LogisticsPdu() -{ -} - -void LogisticsPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void LogisticsPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool LogisticsPdu::operator ==(const LogisticsPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int LogisticsPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - diff --git a/src/dis6/LogisticsPdu.h b/src/dis6/LogisticsPdu.h deleted file mode 100644 index 57e1078d..00000000 --- a/src/dis6/LogisticsPdu.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.5. Abstract superclass for logistics PDUs. COMPLETE - -// Copyright (c) 2007, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT LogisticsPdu : public Pdu -{ -protected: - - public: - LogisticsPdu(); - virtual ~LogisticsPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LogisticsPdu& rhs) const; -}; -} - diff --git a/src/dis6/Marking.cpp b/src/dis6/Marking.cpp deleted file mode 100644 index 4c382505..00000000 --- a/src/dis6/Marking.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include - -#include - -using namespace DIS; - - -Marking::Marking(): - _characterSet(0) -{ - // Initialize fixed length array - for(int lengthcharacters= 0; lengthcharacters < 11; lengthcharacters++) - { - _characters[lengthcharacters] = 0; - } - -} - -Marking::~Marking() -{ -} - -unsigned char Marking::getCharacterSet() const -{ - return _characterSet; -} - -void Marking::setCharacterSet(unsigned char pX) -{ - _characterSet = pX; -} - -char* Marking::getCharacters() -{ - return _characters; -} - -const char* Marking::getCharacters() const -{ - return _characters; -} - -void Marking::setCharacters(const char* x) -{ - for(int i = 0; i < 11; i++) - { - _characters[i] = x[i]; - } -} - -// An alternate method to set the value if this could be a string. This is not strictly comnpliant with the DIS standard. -void Marking::setByStringCharacters(const char* x) -{ - std::strncpy(_characters, x, 11-1); - _characters[11 -1] = '\0'; -} - -void Marking::marshal(DataStream& dataStream) const -{ - dataStream << _characterSet; - - for(size_t idx = 0; idx < 11; idx++) - { - dataStream << _characters[idx]; - } - -} - -void Marking::unmarshal(DataStream& dataStream) -{ - dataStream >> _characterSet; - - for(size_t idx = 0; idx < 11; idx++) - { - dataStream >> _characters[idx]; - } - -} - - -bool Marking::operator ==(const Marking& rhs) const - { - bool ivarsEqual = true; - - if( ! (_characterSet == rhs._characterSet) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 11; idx++) - { - if(!(_characters[idx] == rhs._characters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int Marking::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _characterSet - marshalSize = marshalSize + 11 * 1; // _characters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Marking.h b/src/dis6/Marking.h deleted file mode 100644 index 10cb7862..00000000 --- a/src/dis6/Marking.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.15. Specifies the character set used inthe first byte, followed by 11 characters of text data. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT Marking -{ -protected: - /** The character set */ - unsigned char _characterSet; - - /** The characters */ - char _characters[11]; - - - public: - Marking(); - virtual ~Marking(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getCharacterSet() const; - void setCharacterSet(unsigned char pX); - - char* getCharacters(); - const char* getCharacters() const; - void setCharacters( const char* pX); - void setByStringCharacters(const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Marking& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldDataPdu.cpp b/src/dis6/MinefieldDataPdu.cpp deleted file mode 100644 index d8d4f42e..00000000 --- a/src/dis6/MinefieldDataPdu.cpp +++ /dev/null @@ -1,344 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldDataPdu::MinefieldDataPdu() : MinefieldFamilyPdu(), - _minefieldID(), - _requestingEntityID(), - _minefieldSequenceNumbeer(0), - _requestID(0), - _pduSequenceNumber(0), - _numberOfPdus(0), - _numberOfMinesInThisPdu(0), - _numberOfSensorTypes(0), - _pad2(0), - _dataFilter(0), - _mineType(), - _pad3(0) -{ - setPduType( 39 ); -} - -MinefieldDataPdu::~MinefieldDataPdu() -{ - _sensorTypes.clear(); - _mineLocation.clear(); -} - -EntityID& MinefieldDataPdu::getMinefieldID() -{ - return _minefieldID; -} - -const EntityID& MinefieldDataPdu::getMinefieldID() const -{ - return _minefieldID; -} - -void MinefieldDataPdu::setMinefieldID(const EntityID &pX) -{ - _minefieldID = pX; -} - -EntityID& MinefieldDataPdu::getRequestingEntityID() -{ - return _requestingEntityID; -} - -const EntityID& MinefieldDataPdu::getRequestingEntityID() const -{ - return _requestingEntityID; -} - -void MinefieldDataPdu::setRequestingEntityID(const EntityID &pX) -{ - _requestingEntityID = pX; -} - -unsigned short MinefieldDataPdu::getMinefieldSequenceNumbeer() const -{ - return _minefieldSequenceNumbeer; -} - -void MinefieldDataPdu::setMinefieldSequenceNumbeer(unsigned short pX) -{ - _minefieldSequenceNumbeer = pX; -} - -unsigned char MinefieldDataPdu::getRequestID() const -{ - return _requestID; -} - -void MinefieldDataPdu::setRequestID(unsigned char pX) -{ - _requestID = pX; -} - -unsigned char MinefieldDataPdu::getPduSequenceNumber() const -{ - return _pduSequenceNumber; -} - -void MinefieldDataPdu::setPduSequenceNumber(unsigned char pX) -{ - _pduSequenceNumber = pX; -} - -unsigned char MinefieldDataPdu::getNumberOfPdus() const -{ - return _numberOfPdus; -} - -void MinefieldDataPdu::setNumberOfPdus(unsigned char pX) -{ - _numberOfPdus = pX; -} - -unsigned char MinefieldDataPdu::getNumberOfMinesInThisPdu() const -{ - return _mineLocation.size(); -} - -unsigned char MinefieldDataPdu::getNumberOfSensorTypes() const -{ - return _sensorTypes.size(); -} - -unsigned char MinefieldDataPdu::getPad2() const -{ - return _pad2; -} - -void MinefieldDataPdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int MinefieldDataPdu::getDataFilter() const -{ - return _dataFilter; -} - -void MinefieldDataPdu::setDataFilter(unsigned int pX) -{ - _dataFilter = pX; -} - -EntityType& MinefieldDataPdu::getMineType() -{ - return _mineType; -} - -const EntityType& MinefieldDataPdu::getMineType() const -{ - return _mineType; -} - -void MinefieldDataPdu::setMineType(const EntityType &pX) -{ - _mineType = pX; -} - -std::vector& MinefieldDataPdu::getSensorTypes() -{ - return _sensorTypes; -} - -const std::vector& MinefieldDataPdu::getSensorTypes() const -{ - return _sensorTypes; -} - -void MinefieldDataPdu::setSensorTypes(const std::vector& pX) -{ - _sensorTypes = pX; -} - -unsigned char MinefieldDataPdu::getPad3() const -{ - return _pad3; -} - -void MinefieldDataPdu::setPad3(unsigned char pX) -{ - _pad3 = pX; -} - -std::vector& MinefieldDataPdu::getMineLocation() -{ - return _mineLocation; -} - -const std::vector& MinefieldDataPdu::getMineLocation() const -{ - return _mineLocation; -} - -void MinefieldDataPdu::setMineLocation(const std::vector& pX) -{ - _mineLocation = pX; -} - -void MinefieldDataPdu::marshal(DataStream& dataStream) const -{ - MinefieldFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _minefieldID.marshal(dataStream); - _requestingEntityID.marshal(dataStream); - dataStream << _minefieldSequenceNumbeer; - dataStream << _requestID; - dataStream << _pduSequenceNumber; - dataStream << _numberOfPdus; - dataStream << ( unsigned char )_mineLocation.size(); - dataStream << ( unsigned char )_sensorTypes.size(); - dataStream << _pad2; - dataStream << _dataFilter; - _mineType.marshal(dataStream); - - for(size_t idx = 0; idx < _sensorTypes.size(); idx++) - { - TwoByteChunk x = _sensorTypes[idx]; - x.marshal(dataStream); - } - - dataStream << _pad3; - - for(size_t idx = 0; idx < _mineLocation.size(); idx++) - { - Vector3Float x = _mineLocation[idx]; - x.marshal(dataStream); - } - -} - -void MinefieldDataPdu::unmarshal(DataStream& dataStream) -{ - MinefieldFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _minefieldID.unmarshal(dataStream); - _requestingEntityID.unmarshal(dataStream); - dataStream >> _minefieldSequenceNumbeer; - dataStream >> _requestID; - dataStream >> _pduSequenceNumber; - dataStream >> _numberOfPdus; - dataStream >> _numberOfMinesInThisPdu; - dataStream >> _numberOfSensorTypes; - dataStream >> _pad2; - dataStream >> _dataFilter; - _mineType.unmarshal(dataStream); - - _sensorTypes.clear(); - for(size_t idx = 0; idx < _numberOfSensorTypes; idx++) - { - TwoByteChunk x; - x.unmarshal(dataStream); - _sensorTypes.push_back(x); - } - dataStream >> _pad3; - - _mineLocation.clear(); - for(size_t idx = 0; idx < _numberOfMinesInThisPdu; idx++) - { - Vector3Float x; - x.unmarshal(dataStream); - _mineLocation.push_back(x); - } -} - - -bool MinefieldDataPdu::operator ==(const MinefieldDataPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = MinefieldFamilyPdu::operator==(rhs); - - if( ! (_minefieldID == rhs._minefieldID) ) ivarsEqual = false; - if( ! (_requestingEntityID == rhs._requestingEntityID) ) ivarsEqual = false; - if( ! (_minefieldSequenceNumbeer == rhs._minefieldSequenceNumbeer) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_pduSequenceNumber == rhs._pduSequenceNumber) ) ivarsEqual = false; - if( ! (_numberOfPdus == rhs._numberOfPdus) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_dataFilter == rhs._dataFilter) ) ivarsEqual = false; - if( ! (_mineType == rhs._mineType) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _sensorTypes.size(); idx++) - { - if( ! ( _sensorTypes[idx] == rhs._sensorTypes[idx]) ) ivarsEqual = false; - } - - if( ! (_pad3 == rhs._pad3) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _mineLocation.size(); idx++) - { - if( ! ( _mineLocation[idx] == rhs._mineLocation[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int MinefieldDataPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = MinefieldFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID - marshalSize = marshalSize + _requestingEntityID.getMarshalledSize(); // _requestingEntityID - marshalSize = marshalSize + 2; // _minefieldSequenceNumbeer - marshalSize = marshalSize + 1; // _requestID - marshalSize = marshalSize + 1; // _pduSequenceNumber - marshalSize = marshalSize + 1; // _numberOfPdus - marshalSize = marshalSize + 1; // _numberOfMinesInThisPdu - marshalSize = marshalSize + 1; // _numberOfSensorTypes - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _dataFilter - marshalSize = marshalSize + _mineType.getMarshalledSize(); // _mineType - - for(unsigned long long idx=0; idx < _sensorTypes.size(); idx++) - { - TwoByteChunk listElement = _sensorTypes[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - marshalSize = marshalSize + 1; // _pad3 - - for(unsigned long long idx=0; idx < _mineLocation.size(); idx++) - { - Vector3Float listElement = _mineLocation[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldDataPdu.h b/src/dis6/MinefieldDataPdu.h deleted file mode 100644 index 045c9042..00000000 --- a/src/dis6/MinefieldDataPdu.h +++ /dev/null @@ -1,156 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.10.3 Information about individual mines within a minefield. This is very, very wrong. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT MinefieldDataPdu : public MinefieldFamilyPdu -{ -protected: - /** Minefield ID */ - EntityID _minefieldID; - - /** ID of entity making request */ - EntityID _requestingEntityID; - - /** Minefield sequence number */ - unsigned short _minefieldSequenceNumbeer; - - /** request ID */ - unsigned char _requestID; - - /** pdu sequence number */ - unsigned char _pduSequenceNumber; - - /** number of pdus in response */ - unsigned char _numberOfPdus; - - /** how many mines are in this PDU */ - unsigned char _numberOfMinesInThisPdu; - - /** how many sensor type are in this PDU */ - unsigned char _numberOfSensorTypes; - - /** padding */ - unsigned char _pad2; - - /** 32 boolean fields */ - unsigned int _dataFilter; - - /** Mine type */ - EntityType _mineType; - - /** Sensor types, each 16 bits long */ - std::vector _sensorTypes; - - /** Padding to get things 32-bit aligned. ^^^this is wrong--dyanmically sized padding needed */ - unsigned char _pad3; - - /** Mine locations */ - std::vector _mineLocation; - - - public: - MinefieldDataPdu(); - virtual ~MinefieldDataPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getMinefieldID(); - const EntityID& getMinefieldID() const; - void setMinefieldID(const EntityID &pX); - - EntityID& getRequestingEntityID(); - const EntityID& getRequestingEntityID() const; - void setRequestingEntityID(const EntityID &pX); - - unsigned short getMinefieldSequenceNumbeer() const; - void setMinefieldSequenceNumbeer(unsigned short pX); - - unsigned char getRequestID() const; - void setRequestID(unsigned char pX); - - unsigned char getPduSequenceNumber() const; - void setPduSequenceNumber(unsigned char pX); - - unsigned char getNumberOfPdus() const; - void setNumberOfPdus(unsigned char pX); - - unsigned char getNumberOfMinesInThisPdu() const; - - unsigned char getNumberOfSensorTypes() const; - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getDataFilter() const; - void setDataFilter(unsigned int pX); - - EntityType& getMineType(); - const EntityType& getMineType() const; - void setMineType(const EntityType &pX); - - std::vector& getSensorTypes(); - const std::vector& getSensorTypes() const; - void setSensorTypes(const std::vector& pX); - - unsigned char getPad3() const; - void setPad3(unsigned char pX); - - std::vector& getMineLocation(); - const std::vector& getMineLocation() const; - void setMineLocation(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldDataPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldFamilyPdu.cpp b/src/dis6/MinefieldFamilyPdu.cpp deleted file mode 100644 index 5af2e547..00000000 --- a/src/dis6/MinefieldFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldFamilyPdu::MinefieldFamilyPdu() : Pdu() - -{ - setProtocolFamily( 8 ); -} - -MinefieldFamilyPdu::~MinefieldFamilyPdu() -{ -} - -void MinefieldFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void MinefieldFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool MinefieldFamilyPdu::operator ==(const MinefieldFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int MinefieldFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldFamilyPdu.h b/src/dis6/MinefieldFamilyPdu.h deleted file mode 100644 index c2a7387f..00000000 --- a/src/dis6/MinefieldFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.10.1 Abstract superclass for PDUs relating to minefields - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT MinefieldFamilyPdu : public Pdu -{ -protected: - - public: - MinefieldFamilyPdu(); - virtual ~MinefieldFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldPduFamily.cpp b/src/dis6/MinefieldPduFamily.cpp deleted file mode 100644 index 9518ec4d..00000000 --- a/src/dis6/MinefieldPduFamily.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldPduFamily::MinefieldPduFamily() : Pdu() - -{ - setProtocolFamily( 8 ); -} - -MinefieldPduFamily::~MinefieldPduFamily() -{ -} - -void MinefieldPduFamily::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void MinefieldPduFamily::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool MinefieldPduFamily::operator ==(const MinefieldPduFamily& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int MinefieldPduFamily::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - diff --git a/src/dis6/MinefieldPduFamily.h b/src/dis6/MinefieldPduFamily.h deleted file mode 100644 index be06ed2e..00000000 --- a/src/dis6/MinefieldPduFamily.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.10.1 Abstract superclass for PDUs relating to minefields - -// Copyright (c) 2007, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT MinefieldPduFamily : public Pdu -{ -protected: - - public: - MinefieldPduFamily(); - virtual ~MinefieldPduFamily(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldPduFamily& rhs) const; -}; -} - diff --git a/src/dis6/MinefieldQueryPdu.cpp b/src/dis6/MinefieldQueryPdu.cpp deleted file mode 100644 index 27c00112..00000000 --- a/src/dis6/MinefieldQueryPdu.cpp +++ /dev/null @@ -1,284 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldQueryPdu::MinefieldQueryPdu() : MinefieldFamilyPdu(), - _minefieldID(), - _requestingEntityID(), - _requestID(0), - _numberOfPerimeterPoints(0), - _pad2(0), - _numberOfSensorTypes(0), - _dataFilter(0), - _requestedMineType() -{ - setPduType( 38 ); -} - -MinefieldQueryPdu::~MinefieldQueryPdu() -{ - _requestedPerimeterPoints.clear(); - _sensorTypes.clear(); -} - -EntityID& MinefieldQueryPdu::getMinefieldID() -{ - return _minefieldID; -} - -const EntityID& MinefieldQueryPdu::getMinefieldID() const -{ - return _minefieldID; -} - -void MinefieldQueryPdu::setMinefieldID(const EntityID &pX) -{ - _minefieldID = pX; -} - -EntityID& MinefieldQueryPdu::getRequestingEntityID() -{ - return _requestingEntityID; -} - -const EntityID& MinefieldQueryPdu::getRequestingEntityID() const -{ - return _requestingEntityID; -} - -void MinefieldQueryPdu::setRequestingEntityID(const EntityID &pX) -{ - _requestingEntityID = pX; -} - -unsigned char MinefieldQueryPdu::getRequestID() const -{ - return _requestID; -} - -void MinefieldQueryPdu::setRequestID(unsigned char pX) -{ - _requestID = pX; -} - -unsigned char MinefieldQueryPdu::getNumberOfPerimeterPoints() const -{ - return _requestedPerimeterPoints.size(); -} - -unsigned char MinefieldQueryPdu::getPad2() const -{ - return _pad2; -} - -void MinefieldQueryPdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned char MinefieldQueryPdu::getNumberOfSensorTypes() const -{ - return _sensorTypes.size(); -} - -unsigned int MinefieldQueryPdu::getDataFilter() const -{ - return _dataFilter; -} - -void MinefieldQueryPdu::setDataFilter(unsigned int pX) -{ - _dataFilter = pX; -} - -EntityType& MinefieldQueryPdu::getRequestedMineType() -{ - return _requestedMineType; -} - -const EntityType& MinefieldQueryPdu::getRequestedMineType() const -{ - return _requestedMineType; -} - -void MinefieldQueryPdu::setRequestedMineType(const EntityType &pX) -{ - _requestedMineType = pX; -} - -std::vector& MinefieldQueryPdu::getRequestedPerimeterPoints() -{ - return _requestedPerimeterPoints; -} - -const std::vector& MinefieldQueryPdu::getRequestedPerimeterPoints() const -{ - return _requestedPerimeterPoints; -} - -void MinefieldQueryPdu::setRequestedPerimeterPoints(const std::vector& pX) -{ - _requestedPerimeterPoints = pX; -} - -std::vector& MinefieldQueryPdu::getSensorTypes() -{ - return _sensorTypes; -} - -const std::vector& MinefieldQueryPdu::getSensorTypes() const -{ - return _sensorTypes; -} - -void MinefieldQueryPdu::setSensorTypes(const std::vector& pX) -{ - _sensorTypes = pX; -} - -void MinefieldQueryPdu::marshal(DataStream& dataStream) const -{ - MinefieldFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _minefieldID.marshal(dataStream); - _requestingEntityID.marshal(dataStream); - dataStream << _requestID; - dataStream << ( unsigned char )_requestedPerimeterPoints.size(); - dataStream << _pad2; - dataStream << ( unsigned char )_sensorTypes.size(); - dataStream << _dataFilter; - _requestedMineType.marshal(dataStream); - - for(size_t idx = 0; idx < _requestedPerimeterPoints.size(); idx++) - { - Point x = _requestedPerimeterPoints[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _sensorTypes.size(); idx++) - { - TwoByteChunk x = _sensorTypes[idx]; - x.marshal(dataStream); - } - -} - -void MinefieldQueryPdu::unmarshal(DataStream& dataStream) -{ - MinefieldFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _minefieldID.unmarshal(dataStream); - _requestingEntityID.unmarshal(dataStream); - dataStream >> _requestID; - dataStream >> _numberOfPerimeterPoints; - dataStream >> _pad2; - dataStream >> _numberOfSensorTypes; - dataStream >> _dataFilter; - _requestedMineType.unmarshal(dataStream); - - _requestedPerimeterPoints.clear(); - for(size_t idx = 0; idx < _numberOfPerimeterPoints; idx++) - { - Point x; - x.unmarshal(dataStream); - _requestedPerimeterPoints.push_back(x); - } - - _sensorTypes.clear(); - for(size_t idx = 0; idx < _numberOfSensorTypes; idx++) - { - TwoByteChunk x; - x.unmarshal(dataStream); - _sensorTypes.push_back(x); - } -} - - -bool MinefieldQueryPdu::operator ==(const MinefieldQueryPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = MinefieldFamilyPdu::operator==(rhs); - - if( ! (_minefieldID == rhs._minefieldID) ) ivarsEqual = false; - if( ! (_requestingEntityID == rhs._requestingEntityID) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_dataFilter == rhs._dataFilter) ) ivarsEqual = false; - if( ! (_requestedMineType == rhs._requestedMineType) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _requestedPerimeterPoints.size(); idx++) - { - if( ! ( _requestedPerimeterPoints[idx] == rhs._requestedPerimeterPoints[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _sensorTypes.size(); idx++) - { - if( ! ( _sensorTypes[idx] == rhs._sensorTypes[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int MinefieldQueryPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = MinefieldFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID - marshalSize = marshalSize + _requestingEntityID.getMarshalledSize(); // _requestingEntityID - marshalSize = marshalSize + 1; // _requestID - marshalSize = marshalSize + 1; // _numberOfPerimeterPoints - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 1; // _numberOfSensorTypes - marshalSize = marshalSize + 4; // _dataFilter - marshalSize = marshalSize + _requestedMineType.getMarshalledSize(); // _requestedMineType - - for(unsigned long long idx=0; idx < _requestedPerimeterPoints.size(); idx++) - { - Point listElement = _requestedPerimeterPoints[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _sensorTypes.size(); idx++) - { - TwoByteChunk listElement = _sensorTypes[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldQueryPdu.h b/src/dis6/MinefieldQueryPdu.h deleted file mode 100644 index a2938649..00000000 --- a/src/dis6/MinefieldQueryPdu.h +++ /dev/null @@ -1,132 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.10.2 Query a minefield for information about individual mines. Requires manual clean up to get the padding right. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT MinefieldQueryPdu : public MinefieldFamilyPdu -{ -protected: - /** Minefield ID */ - EntityID _minefieldID; - - /** EID of entity making the request */ - EntityID _requestingEntityID; - - /** request ID */ - unsigned char _requestID; - - /** Number of perimeter points for the minefield */ - unsigned char _numberOfPerimeterPoints; - - /** Padding */ - unsigned char _pad2; - - /** Number of sensor types */ - unsigned char _numberOfSensorTypes; - - /** data filter, 32 boolean fields */ - unsigned int _dataFilter; - - /** Entity type of mine being requested */ - EntityType _requestedMineType; - - /** perimeter points of request */ - std::vector _requestedPerimeterPoints; - - /** Sensor types, each 16 bits long */ - std::vector _sensorTypes; - - - public: - MinefieldQueryPdu(); - virtual ~MinefieldQueryPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getMinefieldID(); - const EntityID& getMinefieldID() const; - void setMinefieldID(const EntityID &pX); - - EntityID& getRequestingEntityID(); - const EntityID& getRequestingEntityID() const; - void setRequestingEntityID(const EntityID &pX); - - unsigned char getRequestID() const; - void setRequestID(unsigned char pX); - - unsigned char getNumberOfPerimeterPoints() const; - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned char getNumberOfSensorTypes() const; - - unsigned int getDataFilter() const; - void setDataFilter(unsigned int pX); - - EntityType& getRequestedMineType(); - const EntityType& getRequestedMineType() const; - void setRequestedMineType(const EntityType &pX); - - std::vector& getRequestedPerimeterPoints(); - const std::vector& getRequestedPerimeterPoints() const; - void setRequestedPerimeterPoints(const std::vector& pX); - - std::vector& getSensorTypes(); - const std::vector& getSensorTypes() const; - void setSensorTypes(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldQueryPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldResponseNackPdu.cpp b/src/dis6/MinefieldResponseNackPdu.cpp deleted file mode 100644 index ee795694..00000000 --- a/src/dis6/MinefieldResponseNackPdu.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldResponseNackPdu::MinefieldResponseNackPdu() : MinefieldFamilyPdu(), - _minefieldID(), - _requestingEntityID(), - _requestID(0), - _numberOfMissingPdus(0) -{ - setPduType( 40 ); -} - -MinefieldResponseNackPdu::~MinefieldResponseNackPdu() -{ - _missingPduSequenceNumbers.clear(); -} - -EntityID& MinefieldResponseNackPdu::getMinefieldID() -{ - return _minefieldID; -} - -const EntityID& MinefieldResponseNackPdu::getMinefieldID() const -{ - return _minefieldID; -} - -void MinefieldResponseNackPdu::setMinefieldID(const EntityID &pX) -{ - _minefieldID = pX; -} - -EntityID& MinefieldResponseNackPdu::getRequestingEntityID() -{ - return _requestingEntityID; -} - -const EntityID& MinefieldResponseNackPdu::getRequestingEntityID() const -{ - return _requestingEntityID; -} - -void MinefieldResponseNackPdu::setRequestingEntityID(const EntityID &pX) -{ - _requestingEntityID = pX; -} - -unsigned char MinefieldResponseNackPdu::getRequestID() const -{ - return _requestID; -} - -void MinefieldResponseNackPdu::setRequestID(unsigned char pX) -{ - _requestID = pX; -} - -unsigned char MinefieldResponseNackPdu::getNumberOfMissingPdus() const -{ - return _missingPduSequenceNumbers.size(); -} - -std::vector& MinefieldResponseNackPdu::getMissingPduSequenceNumbers() -{ - return _missingPduSequenceNumbers; -} - -const std::vector& MinefieldResponseNackPdu::getMissingPduSequenceNumbers() const -{ - return _missingPduSequenceNumbers; -} - -void MinefieldResponseNackPdu::setMissingPduSequenceNumbers(const std::vector& pX) -{ - _missingPduSequenceNumbers = pX; -} - -void MinefieldResponseNackPdu::marshal(DataStream& dataStream) const -{ - MinefieldFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _minefieldID.marshal(dataStream); - _requestingEntityID.marshal(dataStream); - dataStream << _requestID; - dataStream << ( unsigned char )_missingPduSequenceNumbers.size(); - - for(size_t idx = 0; idx < _missingPduSequenceNumbers.size(); idx++) - { - EightByteChunk x = _missingPduSequenceNumbers[idx]; - x.marshal(dataStream); - } - -} - -void MinefieldResponseNackPdu::unmarshal(DataStream& dataStream) -{ - MinefieldFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _minefieldID.unmarshal(dataStream); - _requestingEntityID.unmarshal(dataStream); - dataStream >> _requestID; - dataStream >> _numberOfMissingPdus; - - _missingPduSequenceNumbers.clear(); - for(size_t idx = 0; idx < _numberOfMissingPdus; idx++) - { - EightByteChunk x; - x.unmarshal(dataStream); - _missingPduSequenceNumbers.push_back(x); - } -} - - -bool MinefieldResponseNackPdu::operator ==(const MinefieldResponseNackPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = MinefieldFamilyPdu::operator==(rhs); - - if( ! (_minefieldID == rhs._minefieldID) ) ivarsEqual = false; - if( ! (_requestingEntityID == rhs._requestingEntityID) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _missingPduSequenceNumbers.size(); idx++) - { - if( ! ( _missingPduSequenceNumbers[idx] == rhs._missingPduSequenceNumbers[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int MinefieldResponseNackPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = MinefieldFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID - marshalSize = marshalSize + _requestingEntityID.getMarshalledSize(); // _requestingEntityID - marshalSize = marshalSize + 1; // _requestID - marshalSize = marshalSize + 1; // _numberOfMissingPdus - - for(unsigned long long idx=0; idx < _missingPduSequenceNumbers.size(); idx++) - { - EightByteChunk listElement = _missingPduSequenceNumbers[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldResponseNackPdu.h b/src/dis6/MinefieldResponseNackPdu.h deleted file mode 100644 index 269030aa..00000000 --- a/src/dis6/MinefieldResponseNackPdu.h +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.10.4 proivde the means to request a retransmit of a minefield data pdu. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT MinefieldResponseNackPdu : public MinefieldFamilyPdu -{ -protected: - /** Minefield ID */ - EntityID _minefieldID; - - /** entity ID making the request */ - EntityID _requestingEntityID; - - /** request ID */ - unsigned char _requestID; - - /** how many pdus were missing */ - unsigned char _numberOfMissingPdus; - - /** PDU sequence numbers that were missing */ - std::vector _missingPduSequenceNumbers; - - - public: - MinefieldResponseNackPdu(); - virtual ~MinefieldResponseNackPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getMinefieldID(); - const EntityID& getMinefieldID() const; - void setMinefieldID(const EntityID &pX); - - EntityID& getRequestingEntityID(); - const EntityID& getRequestingEntityID() const; - void setRequestingEntityID(const EntityID &pX); - - unsigned char getRequestID() const; - void setRequestID(unsigned char pX); - - unsigned char getNumberOfMissingPdus() const; - - std::vector& getMissingPduSequenceNumbers(); - const std::vector& getMissingPduSequenceNumbers() const; - void setMissingPduSequenceNumbers(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldResponseNackPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldStatePdu.cpp b/src/dis6/MinefieldStatePdu.cpp deleted file mode 100644 index e2657f40..00000000 --- a/src/dis6/MinefieldStatePdu.cpp +++ /dev/null @@ -1,319 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldStatePdu::MinefieldStatePdu() : MinefieldFamilyPdu(), - _minefieldID(), - _minefieldSequence(0), - _forceID(0), - _numberOfPerimeterPoints(0), - _minefieldType(), - _numberOfMineTypes(0), - _minefieldLocation(), - _minefieldOrientation(), - _appearance(0), - _protocolMode(0) -{ - setPduType( 37 ); -} - -MinefieldStatePdu::~MinefieldStatePdu() -{ - _perimeterPoints.clear(); - _mineType.clear(); -} - -EntityID& MinefieldStatePdu::getMinefieldID() -{ - return _minefieldID; -} - -const EntityID& MinefieldStatePdu::getMinefieldID() const -{ - return _minefieldID; -} - -void MinefieldStatePdu::setMinefieldID(const EntityID &pX) -{ - _minefieldID = pX; -} - -unsigned short MinefieldStatePdu::getMinefieldSequence() const -{ - return _minefieldSequence; -} - -void MinefieldStatePdu::setMinefieldSequence(unsigned short pX) -{ - _minefieldSequence = pX; -} - -unsigned char MinefieldStatePdu::getForceID() const -{ - return _forceID; -} - -void MinefieldStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char MinefieldStatePdu::getNumberOfPerimeterPoints() const -{ - return _perimeterPoints.size(); -} - -EntityType& MinefieldStatePdu::getMinefieldType() -{ - return _minefieldType; -} - -const EntityType& MinefieldStatePdu::getMinefieldType() const -{ - return _minefieldType; -} - -void MinefieldStatePdu::setMinefieldType(const EntityType &pX) -{ - _minefieldType = pX; -} - -unsigned short MinefieldStatePdu::getNumberOfMineTypes() const -{ - return _mineType.size(); -} - -Vector3Double& MinefieldStatePdu::getMinefieldLocation() -{ - return _minefieldLocation; -} - -const Vector3Double& MinefieldStatePdu::getMinefieldLocation() const -{ - return _minefieldLocation; -} - -void MinefieldStatePdu::setMinefieldLocation(const Vector3Double &pX) -{ - _minefieldLocation = pX; -} - -Orientation& MinefieldStatePdu::getMinefieldOrientation() -{ - return _minefieldOrientation; -} - -const Orientation& MinefieldStatePdu::getMinefieldOrientation() const -{ - return _minefieldOrientation; -} - -void MinefieldStatePdu::setMinefieldOrientation(const Orientation &pX) -{ - _minefieldOrientation = pX; -} - -unsigned short MinefieldStatePdu::getAppearance() const -{ - return _appearance; -} - -void MinefieldStatePdu::setAppearance(unsigned short pX) -{ - _appearance = pX; -} - -unsigned short MinefieldStatePdu::getProtocolMode() const -{ - return _protocolMode; -} - -void MinefieldStatePdu::setProtocolMode(unsigned short pX) -{ - _protocolMode = pX; -} - -std::vector& MinefieldStatePdu::getPerimeterPoints() -{ - return _perimeterPoints; -} - -const std::vector& MinefieldStatePdu::getPerimeterPoints() const -{ - return _perimeterPoints; -} - -void MinefieldStatePdu::setPerimeterPoints(const std::vector& pX) -{ - _perimeterPoints = pX; -} - -std::vector& MinefieldStatePdu::getMineType() -{ - return _mineType; -} - -const std::vector& MinefieldStatePdu::getMineType() const -{ - return _mineType; -} - -void MinefieldStatePdu::setMineType(const std::vector& pX) -{ - _mineType = pX; -} - -void MinefieldStatePdu::marshal(DataStream& dataStream) const -{ - MinefieldFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _minefieldID.marshal(dataStream); - dataStream << _minefieldSequence; - dataStream << _forceID; - dataStream << ( unsigned char )_perimeterPoints.size(); - _minefieldType.marshal(dataStream); - dataStream << ( unsigned short )_mineType.size(); - _minefieldLocation.marshal(dataStream); - _minefieldOrientation.marshal(dataStream); - dataStream << _appearance; - dataStream << _protocolMode; - - for(size_t idx = 0; idx < _perimeterPoints.size(); idx++) - { - Point x = _perimeterPoints[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _mineType.size(); idx++) - { - EntityType x = _mineType[idx]; - x.marshal(dataStream); - } - -} - -void MinefieldStatePdu::unmarshal(DataStream& dataStream) -{ - MinefieldFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _minefieldID.unmarshal(dataStream); - dataStream >> _minefieldSequence; - dataStream >> _forceID; - dataStream >> _numberOfPerimeterPoints; - _minefieldType.unmarshal(dataStream); - dataStream >> _numberOfMineTypes; - _minefieldLocation.unmarshal(dataStream); - _minefieldOrientation.unmarshal(dataStream); - dataStream >> _appearance; - dataStream >> _protocolMode; - - _perimeterPoints.clear(); - for(size_t idx = 0; idx < _numberOfPerimeterPoints; idx++) - { - Point x; - x.unmarshal(dataStream); - _perimeterPoints.push_back(x); - } - - _mineType.clear(); - for(size_t idx = 0; idx < _numberOfMineTypes; idx++) - { - EntityType x; - x.unmarshal(dataStream); - _mineType.push_back(x); - } -} - - -bool MinefieldStatePdu::operator ==(const MinefieldStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = MinefieldFamilyPdu::operator==(rhs); - - if( ! (_minefieldID == rhs._minefieldID) ) ivarsEqual = false; - if( ! (_minefieldSequence == rhs._minefieldSequence) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_minefieldType == rhs._minefieldType) ) ivarsEqual = false; - if( ! (_minefieldLocation == rhs._minefieldLocation) ) ivarsEqual = false; - if( ! (_minefieldOrientation == rhs._minefieldOrientation) ) ivarsEqual = false; - if( ! (_appearance == rhs._appearance) ) ivarsEqual = false; - if( ! (_protocolMode == rhs._protocolMode) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _perimeterPoints.size(); idx++) - { - if( ! ( _perimeterPoints[idx] == rhs._perimeterPoints[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _mineType.size(); idx++) - { - if( ! ( _mineType[idx] == rhs._mineType[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int MinefieldStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = MinefieldFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID - marshalSize = marshalSize + 2; // _minefieldSequence - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _numberOfPerimeterPoints - marshalSize = marshalSize + _minefieldType.getMarshalledSize(); // _minefieldType - marshalSize = marshalSize + 2; // _numberOfMineTypes - marshalSize = marshalSize + _minefieldLocation.getMarshalledSize(); // _minefieldLocation - marshalSize = marshalSize + _minefieldOrientation.getMarshalledSize(); // _minefieldOrientation - marshalSize = marshalSize + 2; // _appearance - marshalSize = marshalSize + 2; // _protocolMode - - for(unsigned long long idx=0; idx < _perimeterPoints.size(); idx++) - { - Point listElement = _perimeterPoints[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _mineType.size(); idx++) - { - EntityType listElement = _mineType[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/MinefieldStatePdu.h b/src/dis6/MinefieldStatePdu.h deleted file mode 100644 index 44c0b5f8..00000000 --- a/src/dis6/MinefieldStatePdu.h +++ /dev/null @@ -1,146 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.10.1 Abstract superclass for PDUs relating to minefields. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT MinefieldStatePdu : public MinefieldFamilyPdu -{ -protected: - /** Minefield ID */ - EntityID _minefieldID; - - /** Minefield sequence */ - unsigned short _minefieldSequence; - - /** force ID */ - unsigned char _forceID; - - /** Number of permieter points */ - unsigned char _numberOfPerimeterPoints; - - /** type of minefield */ - EntityType _minefieldType; - - /** how many mine types */ - unsigned short _numberOfMineTypes; - - /** location of minefield in world coords */ - Vector3Double _minefieldLocation; - - /** orientation of minefield */ - Orientation _minefieldOrientation; - - /** appearance bitflags */ - unsigned short _appearance; - - /** protocolMode */ - unsigned short _protocolMode; - - /** perimeter points for the minefield */ - std::vector _perimeterPoints; - - /** Type of mines */ - std::vector _mineType; - - - public: - MinefieldStatePdu(); - virtual ~MinefieldStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getMinefieldID(); - const EntityID& getMinefieldID() const; - void setMinefieldID(const EntityID &pX); - - unsigned short getMinefieldSequence() const; - void setMinefieldSequence(unsigned short pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getNumberOfPerimeterPoints() const; - - EntityType& getMinefieldType(); - const EntityType& getMinefieldType() const; - void setMinefieldType(const EntityType &pX); - - unsigned short getNumberOfMineTypes() const; - - Vector3Double& getMinefieldLocation(); - const Vector3Double& getMinefieldLocation() const; - void setMinefieldLocation(const Vector3Double &pX); - - Orientation& getMinefieldOrientation(); - const Orientation& getMinefieldOrientation() const; - void setMinefieldOrientation(const Orientation &pX); - - unsigned short getAppearance() const; - void setAppearance(unsigned short pX); - - unsigned short getProtocolMode() const; - void setProtocolMode(unsigned short pX); - - std::vector& getPerimeterPoints(); - const std::vector& getPerimeterPoints() const; - void setPerimeterPoints(const std::vector& pX); - - std::vector& getMineType(); - const std::vector& getMineType() const; - void setMineType(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ModulationType.cpp b/src/dis6/ModulationType.cpp deleted file mode 100644 index d87268c7..00000000 --- a/src/dis6/ModulationType.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -ModulationType::ModulationType(): - _spreadSpectrum(0), - _major(0), - _detail(0), - _system(0) -{ -} - -ModulationType::~ModulationType() -{ -} - -unsigned short ModulationType::getSpreadSpectrum() const -{ - return _spreadSpectrum; -} - -void ModulationType::setSpreadSpectrum(unsigned short pX) -{ - _spreadSpectrum = pX; -} - -unsigned short ModulationType::getMajor() const -{ - return _major; -} - -void ModulationType::setMajor(unsigned short pX) -{ - _major = pX; -} - -unsigned short ModulationType::getDetail() const -{ - return _detail; -} - -void ModulationType::setDetail(unsigned short pX) -{ - _detail = pX; -} - -unsigned short ModulationType::getSystem() const -{ - return _system; -} - -void ModulationType::setSystem(unsigned short pX) -{ - _system = pX; -} - -void ModulationType::marshal(DataStream& dataStream) const -{ - dataStream << _spreadSpectrum; - dataStream << _major; - dataStream << _detail; - dataStream << _system; -} - -void ModulationType::unmarshal(DataStream& dataStream) -{ - dataStream >> _spreadSpectrum; - dataStream >> _major; - dataStream >> _detail; - dataStream >> _system; -} - - -bool ModulationType::operator ==(const ModulationType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_spreadSpectrum == rhs._spreadSpectrum) ) ivarsEqual = false; - if( ! (_major == rhs._major) ) ivarsEqual = false; - if( ! (_detail == rhs._detail) ) ivarsEqual = false; - if( ! (_system == rhs._system) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ModulationType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _spreadSpectrum - marshalSize = marshalSize + 2; // _major - marshalSize = marshalSize + 2; // _detail - marshalSize = marshalSize + 2; // _system - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ModulationType.h b/src/dis6/ModulationType.h deleted file mode 100644 index 18e081fe..00000000 --- a/src/dis6/ModulationType.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Radio modulation - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ModulationType -{ -protected: - /** spread spectrum, 16 bit boolean array */ - unsigned short _spreadSpectrum; - - /** major */ - unsigned short _major; - - /** detail */ - unsigned short _detail; - - /** system */ - unsigned short _system; - - - public: - ModulationType(); - virtual ~ModulationType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSpreadSpectrum() const; - void setSpreadSpectrum(unsigned short pX); - - unsigned short getMajor() const; - void setMajor(unsigned short pX); - - unsigned short getDetail() const; - void setDetail(unsigned short pX); - - unsigned short getSystem() const; - void setSystem(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ModulationType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/NamedLocation.cpp b/src/dis6/NamedLocation.cpp deleted file mode 100644 index d303222a..00000000 --- a/src/dis6/NamedLocation.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -NamedLocation::NamedLocation(): - _stationName(0), - _stationNumber(0) -{ -} - -NamedLocation::~NamedLocation() -{ -} - -unsigned short NamedLocation::getStationName() const -{ - return _stationName; -} - -void NamedLocation::setStationName(unsigned short pX) -{ - _stationName = pX; -} - -unsigned short NamedLocation::getStationNumber() const -{ - return _stationNumber; -} - -void NamedLocation::setStationNumber(unsigned short pX) -{ - _stationNumber = pX; -} - -void NamedLocation::marshal(DataStream& dataStream) const -{ - dataStream << _stationName; - dataStream << _stationNumber; -} - -void NamedLocation::unmarshal(DataStream& dataStream) -{ - dataStream >> _stationName; - dataStream >> _stationNumber; -} - - -bool NamedLocation::operator ==(const NamedLocation& rhs) const - { - bool ivarsEqual = true; - - if( ! (_stationName == rhs._stationName) ) ivarsEqual = false; - if( ! (_stationNumber == rhs._stationNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int NamedLocation::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _stationName - marshalSize = marshalSize + 2; // _stationNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/NamedLocation.h b/src/dis6/NamedLocation.h deleted file mode 100644 index c8351d0f..00000000 --- a/src/dis6/NamedLocation.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// discrete ostional relationsihip - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT NamedLocation -{ -protected: - /** station name enumeration */ - unsigned short _stationName; - - /** station number */ - unsigned short _stationNumber; - - - public: - NamedLocation(); - virtual ~NamedLocation(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getStationName() const; - void setStationName(unsigned short pX); - - unsigned short getStationNumber() const; - void setStationNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const NamedLocation& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ObjectType.cpp b/src/dis6/ObjectType.cpp deleted file mode 100644 index 91965dbb..00000000 --- a/src/dis6/ObjectType.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -ObjectType::ObjectType(): - _entityKind(0), - _domain(0), - _country(0), - _category(0), - _subcategory(0) -{ -} - -ObjectType::~ObjectType() -{ -} - -unsigned char ObjectType::getEntityKind() const -{ - return _entityKind; -} - -void ObjectType::setEntityKind(unsigned char pX) -{ - _entityKind = pX; -} - -unsigned char ObjectType::getDomain() const -{ - return _domain; -} - -void ObjectType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short ObjectType::getCountry() const -{ - return _country; -} - -void ObjectType::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char ObjectType::getCategory() const -{ - return _category; -} - -void ObjectType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char ObjectType::getSubcategory() const -{ - return _subcategory; -} - -void ObjectType::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -void ObjectType::marshal(DataStream& dataStream) const -{ - dataStream << _entityKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _subcategory; -} - -void ObjectType::unmarshal(DataStream& dataStream) -{ - dataStream >> _entityKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _subcategory; -} - - -bool ObjectType::operator ==(const ObjectType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityKind == rhs._entityKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ObjectType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _entityKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ObjectType.h b/src/dis6/ObjectType.h deleted file mode 100644 index 52e26b15..00000000 --- a/src/dis6/ObjectType.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Identifies type of object. This is a shorter version of EntityType that omits the specific and extra fields. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ObjectType -{ -protected: - /** Kind of entity */ - unsigned char _entityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - - public: - ObjectType(); - virtual ~ObjectType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getEntityKind() const; - void setEntityKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ObjectType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Orientation.cpp b/src/dis6/Orientation.cpp deleted file mode 100644 index 1269627e..00000000 --- a/src/dis6/Orientation.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -Orientation::Orientation(): - _psi(0.0), - _theta(0.0), - _phi(0.0) -{ -} - -Orientation::~Orientation() -{ -} - -float Orientation::getPsi() const -{ - return _psi; -} - -void Orientation::setPsi(float pX) -{ - _psi = pX; -} - -float Orientation::getTheta() const -{ - return _theta; -} - -void Orientation::setTheta(float pX) -{ - _theta = pX; -} - -float Orientation::getPhi() const -{ - return _phi; -} - -void Orientation::setPhi(float pX) -{ - _phi = pX; -} - -void Orientation::marshal(DataStream& dataStream) const -{ - dataStream << _psi; - dataStream << _theta; - dataStream << _phi; -} - -void Orientation::unmarshal(DataStream& dataStream) -{ - dataStream >> _psi; - dataStream >> _theta; - dataStream >> _phi; -} - - -bool Orientation::operator ==(const Orientation& rhs) const - { - bool ivarsEqual = true; - - if( ! (_psi == rhs._psi) ) ivarsEqual = false; - if( ! (_theta == rhs._theta) ) ivarsEqual = false; - if( ! (_phi == rhs._phi) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Orientation::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _psi - marshalSize = marshalSize + 4; // _theta - marshalSize = marshalSize + 4; // _phi - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Orientation.h b/src/dis6/Orientation.h deleted file mode 100644 index de1776c5..00000000 --- a/src/dis6/Orientation.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.17. Three floating point values representing an orientation, psi, theta, and phi, aka the euler angles, in radians - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT Orientation -{ -protected: - float _psi; - - float _theta; - - float _phi; - - - public: - Orientation(); - virtual ~Orientation(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getPsi() const; - void setPsi(float pX); - - float getTheta() const; - void setTheta(float pX); - - float getPhi() const; - void setPhi(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Orientation& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Pdu.cpp b/src/dis6/Pdu.cpp deleted file mode 100644 index 2405f885..00000000 --- a/src/dis6/Pdu.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -Pdu::Pdu(): - _protocolVersion(6), - _exerciseID(0), - _pduType(0), - _protocolFamily(0), - _timestamp(0), - _length(0), - _padding(0) -{ -} - -Pdu::~Pdu() -{ -} - -unsigned char Pdu::getProtocolVersion() const -{ - return _protocolVersion; -} - -void Pdu::setProtocolVersion(unsigned char pX) -{ - _protocolVersion = pX; -} - -unsigned char Pdu::getExerciseID() const -{ - return _exerciseID; -} - -void Pdu::setExerciseID(unsigned char pX) -{ - _exerciseID = pX; -} - -unsigned char Pdu::getPduType() const -{ - return _pduType; -} - -void Pdu::setPduType(unsigned char pX) -{ - _pduType = pX; -} - -unsigned char Pdu::getProtocolFamily() const -{ - return _protocolFamily; -} - -void Pdu::setProtocolFamily(unsigned char pX) -{ - _protocolFamily = pX; -} - -unsigned int Pdu::getTimestamp() const -{ - return _timestamp; -} - -void Pdu::setTimestamp(unsigned int pX) -{ - _timestamp = pX; -} - -unsigned short Pdu::getLength() const -{ - return this->getMarshalledSize(); -} - -void Pdu::setLength(unsigned short pX) -{ - _length = pX; -} - -short Pdu::getPadding() const -{ - return _padding; -} - -void Pdu::setPadding(short pX) -{ - _padding = pX; -} - -void Pdu::marshal(DataStream& dataStream) const -{ - dataStream << _protocolVersion; - dataStream << _exerciseID; - dataStream << _pduType; - dataStream << _protocolFamily; - dataStream << _timestamp; - dataStream << this->getLength(); - dataStream << _padding; -} - -void Pdu::unmarshal(DataStream& dataStream) -{ - dataStream >> _protocolVersion; - dataStream >> _exerciseID; - dataStream >> _pduType; - dataStream >> _protocolFamily; - dataStream >> _timestamp; - dataStream >> _length; - dataStream >> _padding; -} - - -bool Pdu::operator ==(const Pdu& rhs) const - { - bool ivarsEqual = true; - - if( ! (_protocolVersion == rhs._protocolVersion) ) ivarsEqual = false; - if( ! (_exerciseID == rhs._exerciseID) ) ivarsEqual = false; - if( ! (_pduType == rhs._pduType) ) ivarsEqual = false; - if( ! (_protocolFamily == rhs._protocolFamily) ) ivarsEqual = false; - if( ! (_timestamp == rhs._timestamp) ) ivarsEqual = false; - if( ! (_length == rhs._length) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Pdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _protocolVersion - marshalSize = marshalSize + 1; // _exerciseID - marshalSize = marshalSize + 1; // _pduType - marshalSize = marshalSize + 1; // _protocolFamily - marshalSize = marshalSize + 4; // _timestamp - marshalSize = marshalSize + 2; // _length - marshalSize = marshalSize + 2; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Pdu.h b/src/dis6/Pdu.h deleted file mode 100644 index dcbb7272..00000000 --- a/src/dis6/Pdu.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The superclass for all PDUs. This incorporates the PduHeader record, section 5.2.29. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT Pdu -{ -protected: - /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ - unsigned char _protocolVersion; - - /** Exercise ID */ - unsigned char _exerciseID; - - /** Type of pdu, unique for each PDU class */ - unsigned char _pduType; - - /** value that refers to the protocol family, eg SimulationManagement, et */ - unsigned char _protocolFamily; - - /** Timestamp value */ - unsigned int _timestamp; - - /** Length, in bytes, of the PDU */ - unsigned short _length; - - /** zero-filled array of padding */ - short _padding; - - - public: - Pdu(); - virtual ~Pdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getProtocolVersion() const; - void setProtocolVersion(unsigned char pX); - - unsigned char getExerciseID() const; - void setExerciseID(unsigned char pX); - - unsigned char getPduType() const; - void setPduType(unsigned char pX); - - unsigned char getProtocolFamily() const; - void setProtocolFamily(unsigned char pX); - - unsigned int getTimestamp() const; - void setTimestamp(unsigned int pX); - - unsigned short getLength() const; - void setLength(unsigned short pX); - - short getPadding() const; - void setPadding(short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Pdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/PduContainer.cpp b/src/dis6/PduContainer.cpp deleted file mode 100644 index 781c525e..00000000 --- a/src/dis6/PduContainer.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include - -using namespace DIS; - - -PduContainer::PduContainer(): - _numberOfPdus(0) -{ -} - -PduContainer::~PduContainer() -{ - _pdus.clear(); -} - -int PduContainer::getNumberOfPdus() const -{ - return _pdus.size(); -} - -std::vector& PduContainer::getPdus() -{ - return _pdus; -} - -const std::vector& PduContainer::getPdus() const -{ - return _pdus; -} - -void PduContainer::setPdus(const std::vector& pX) -{ - _pdus = pX; -} - -void PduContainer::marshal(DataStream& dataStream) const -{ - dataStream << ( int )_pdus.size(); - - for(size_t idx = 0; idx < _pdus.size(); idx++) - { - Pdu x = _pdus[idx]; - x.marshal(dataStream); - } - -} - -void PduContainer::unmarshal(DataStream& dataStream) -{ - dataStream >> _numberOfPdus; - - _pdus.clear(); - for(int idx = 0; idx < _numberOfPdus; idx++) - { - Pdu x; - x.unmarshal(dataStream); - _pdus.push_back(x); - } -} - - -bool PduContainer::operator ==(const PduContainer& rhs) const - { - bool ivarsEqual = true; - - - for(size_t idx = 0; idx < _pdus.size(); idx++) - { - if( ! ( _pdus[idx] == rhs._pdus[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int PduContainer::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _numberOfPdus - - for(unsigned long long idx=0; idx < _pdus.size(); idx++) - { - Pdu listElement = _pdus[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/PduContainer.h b/src/dis6/PduContainer.h deleted file mode 100644 index 6c8df6fa..00000000 --- a/src/dis6/PduContainer.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Used for XML compatability. A container that holds PDUs - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT PduContainer -{ -protected: - /** Number of PDUs in the container list */ - int _numberOfPdus; - - /** record sets */ - std::vector _pdus; - - - public: - PduContainer(); - virtual ~PduContainer(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - int getNumberOfPdus() const; - - std::vector& getPdus(); - const std::vector& getPdus() const; - void setPdus(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const PduContainer& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Point.cpp b/src/dis6/Point.cpp deleted file mode 100644 index aa7fad08..00000000 --- a/src/dis6/Point.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -Point::Point(): - _x(0.0), - _y(0.0) -{ -} - -Point::~Point() -{ -} - -float Point::getX() const -{ - return _x; -} - -void Point::setX(float pX) -{ - _x = pX; -} - -float Point::getY() const -{ - return _y; -} - -void Point::setY(float pX) -{ - _y = pX; -} - -void Point::marshal(DataStream& dataStream) const -{ - dataStream << _x; - dataStream << _y; -} - -void Point::unmarshal(DataStream& dataStream) -{ - dataStream >> _x; - dataStream >> _y; -} - - -bool Point::operator ==(const Point& rhs) const - { - bool ivarsEqual = true; - - if( ! (_x == rhs._x) ) ivarsEqual = false; - if( ! (_y == rhs._y) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Point::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _x - marshalSize = marshalSize + 4; // _y - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/PointObjectStatePdu.cpp b/src/dis6/PointObjectStatePdu.cpp deleted file mode 100644 index 7c2e4804..00000000 --- a/src/dis6/PointObjectStatePdu.cpp +++ /dev/null @@ -1,288 +0,0 @@ -#include - -using namespace DIS; - - -PointObjectStatePdu::PointObjectStatePdu() : SyntheticEnvironmentFamilyPdu(), - _objectID(), - _referencedObjectID(), - _updateNumber(0), - _forceID(0), - _modifications(0), - _objectType(), - _objectLocation(), - _objectOrientation(), - _objectAppearance(0.0), - _requesterID(), - _receivingID(), - _pad2(0) -{ - setPduType( 43 ); -} - -PointObjectStatePdu::~PointObjectStatePdu() -{ -} - -EntityID& PointObjectStatePdu::getObjectID() -{ - return _objectID; -} - -const EntityID& PointObjectStatePdu::getObjectID() const -{ - return _objectID; -} - -void PointObjectStatePdu::setObjectID(const EntityID &pX) -{ - _objectID = pX; -} - -EntityID& PointObjectStatePdu::getReferencedObjectID() -{ - return _referencedObjectID; -} - -const EntityID& PointObjectStatePdu::getReferencedObjectID() const -{ - return _referencedObjectID; -} - -void PointObjectStatePdu::setReferencedObjectID(const EntityID &pX) -{ - _referencedObjectID = pX; -} - -unsigned short PointObjectStatePdu::getUpdateNumber() const -{ - return _updateNumber; -} - -void PointObjectStatePdu::setUpdateNumber(unsigned short pX) -{ - _updateNumber = pX; -} - -unsigned char PointObjectStatePdu::getForceID() const -{ - return _forceID; -} - -void PointObjectStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char PointObjectStatePdu::getModifications() const -{ - return _modifications; -} - -void PointObjectStatePdu::setModifications(unsigned char pX) -{ - _modifications = pX; -} - -ObjectType& PointObjectStatePdu::getObjectType() -{ - return _objectType; -} - -const ObjectType& PointObjectStatePdu::getObjectType() const -{ - return _objectType; -} - -void PointObjectStatePdu::setObjectType(const ObjectType &pX) -{ - _objectType = pX; -} - -Vector3Double& PointObjectStatePdu::getObjectLocation() -{ - return _objectLocation; -} - -const Vector3Double& PointObjectStatePdu::getObjectLocation() const -{ - return _objectLocation; -} - -void PointObjectStatePdu::setObjectLocation(const Vector3Double &pX) -{ - _objectLocation = pX; -} - -Orientation& PointObjectStatePdu::getObjectOrientation() -{ - return _objectOrientation; -} - -const Orientation& PointObjectStatePdu::getObjectOrientation() const -{ - return _objectOrientation; -} - -void PointObjectStatePdu::setObjectOrientation(const Orientation &pX) -{ - _objectOrientation = pX; -} - -double PointObjectStatePdu::getObjectAppearance() const -{ - return _objectAppearance; -} - -void PointObjectStatePdu::setObjectAppearance(double pX) -{ - _objectAppearance = pX; -} - -SimulationAddress& PointObjectStatePdu::getRequesterID() -{ - return _requesterID; -} - -const SimulationAddress& PointObjectStatePdu::getRequesterID() const -{ - return _requesterID; -} - -void PointObjectStatePdu::setRequesterID(const SimulationAddress &pX) -{ - _requesterID = pX; -} - -SimulationAddress& PointObjectStatePdu::getReceivingID() -{ - return _receivingID; -} - -const SimulationAddress& PointObjectStatePdu::getReceivingID() const -{ - return _receivingID; -} - -void PointObjectStatePdu::setReceivingID(const SimulationAddress &pX) -{ - _receivingID = pX; -} - -unsigned int PointObjectStatePdu::getPad2() const -{ - return _pad2; -} - -void PointObjectStatePdu::setPad2(unsigned int pX) -{ - _pad2 = pX; -} - -void PointObjectStatePdu::marshal(DataStream& dataStream) const -{ - SyntheticEnvironmentFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _objectID.marshal(dataStream); - _referencedObjectID.marshal(dataStream); - dataStream << _updateNumber; - dataStream << _forceID; - dataStream << _modifications; - _objectType.marshal(dataStream); - _objectLocation.marshal(dataStream); - _objectOrientation.marshal(dataStream); - dataStream << _objectAppearance; - _requesterID.marshal(dataStream); - _receivingID.marshal(dataStream); - dataStream << _pad2; -} - -void PointObjectStatePdu::unmarshal(DataStream& dataStream) -{ - SyntheticEnvironmentFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _objectID.unmarshal(dataStream); - _referencedObjectID.unmarshal(dataStream); - dataStream >> _updateNumber; - dataStream >> _forceID; - dataStream >> _modifications; - _objectType.unmarshal(dataStream); - _objectLocation.unmarshal(dataStream); - _objectOrientation.unmarshal(dataStream); - dataStream >> _objectAppearance; - _requesterID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - dataStream >> _pad2; -} - - -bool PointObjectStatePdu::operator ==(const PointObjectStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); - - if( ! (_objectID == rhs._objectID) ) ivarsEqual = false; - if( ! (_referencedObjectID == rhs._referencedObjectID) ) ivarsEqual = false; - if( ! (_updateNumber == rhs._updateNumber) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_modifications == rhs._modifications) ) ivarsEqual = false; - if( ! (_objectType == rhs._objectType) ) ivarsEqual = false; - if( ! (_objectLocation == rhs._objectLocation) ) ivarsEqual = false; - if( ! (_objectOrientation == rhs._objectOrientation) ) ivarsEqual = false; - if( ! (_objectAppearance == rhs._objectAppearance) ) ivarsEqual = false; - if( ! (_requesterID == rhs._requesterID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - - return ivarsEqual; - } - -int PointObjectStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID - marshalSize = marshalSize + _referencedObjectID.getMarshalledSize(); // _referencedObjectID - marshalSize = marshalSize + 2; // _updateNumber - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _modifications - marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType - marshalSize = marshalSize + _objectLocation.getMarshalledSize(); // _objectLocation - marshalSize = marshalSize + _objectOrientation.getMarshalledSize(); // _objectOrientation - marshalSize = marshalSize + 8; // _objectAppearance - marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + 4; // _pad2 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/PointObjectStatePdu.h b/src/dis6/PointObjectStatePdu.h deleted file mode 100644 index 114cde1c..00000000 --- a/src/dis6/PointObjectStatePdu.h +++ /dev/null @@ -1,149 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.11.3: Inormation abut the addition or modification of a synthecic enviroment object that is anchored to the terrain with a single point. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT PointObjectStatePdu : public SyntheticEnvironmentFamilyPdu -{ -protected: - /** Object in synthetic environment */ - EntityID _objectID; - - /** Object with which this point object is associated */ - EntityID _referencedObjectID; - - /** unique update number of each state transition of an object */ - unsigned short _updateNumber; - - /** force ID */ - unsigned char _forceID; - - /** modifications */ - unsigned char _modifications; - - /** Object type */ - ObjectType _objectType; - - /** Object location */ - Vector3Double _objectLocation; - - /** Object orientation */ - Orientation _objectOrientation; - - /** Object apperance */ - double _objectAppearance; - - /** requesterID */ - SimulationAddress _requesterID; - - /** receiver ID */ - SimulationAddress _receivingID; - - /** padding */ - unsigned int _pad2; - - - public: - PointObjectStatePdu(); - virtual ~PointObjectStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getObjectID(); - const EntityID& getObjectID() const; - void setObjectID(const EntityID &pX); - - EntityID& getReferencedObjectID(); - const EntityID& getReferencedObjectID() const; - void setReferencedObjectID(const EntityID &pX); - - unsigned short getUpdateNumber() const; - void setUpdateNumber(unsigned short pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getModifications() const; - void setModifications(unsigned char pX); - - ObjectType& getObjectType(); - const ObjectType& getObjectType() const; - void setObjectType(const ObjectType &pX); - - Vector3Double& getObjectLocation(); - const Vector3Double& getObjectLocation() const; - void setObjectLocation(const Vector3Double &pX); - - Orientation& getObjectOrientation(); - const Orientation& getObjectOrientation() const; - void setObjectOrientation(const Orientation &pX); - - double getObjectAppearance() const; - void setObjectAppearance(double pX); - - SimulationAddress& getRequesterID(); - const SimulationAddress& getRequesterID() const; - void setRequesterID(const SimulationAddress &pX); - - SimulationAddress& getReceivingID(); - const SimulationAddress& getReceivingID() const; - void setReceivingID(const SimulationAddress &pX); - - unsigned int getPad2() const; - void setPad2(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const PointObjectStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/PropulsionSystemData.cpp b/src/dis6/PropulsionSystemData.cpp deleted file mode 100644 index 029ce8d8..00000000 --- a/src/dis6/PropulsionSystemData.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -PropulsionSystemData::PropulsionSystemData(): - _powerSetting(0.0), - _engineRpm(0.0) -{ -} - -PropulsionSystemData::~PropulsionSystemData() -{ -} - -float PropulsionSystemData::getPowerSetting() const -{ - return _powerSetting; -} - -void PropulsionSystemData::setPowerSetting(float pX) -{ - _powerSetting = pX; -} - -float PropulsionSystemData::getEngineRpm() const -{ - return _engineRpm; -} - -void PropulsionSystemData::setEngineRpm(float pX) -{ - _engineRpm = pX; -} - -void PropulsionSystemData::marshal(DataStream& dataStream) const -{ - dataStream << _powerSetting; - dataStream << _engineRpm; -} - -void PropulsionSystemData::unmarshal(DataStream& dataStream) -{ - dataStream >> _powerSetting; - dataStream >> _engineRpm; -} - - -bool PropulsionSystemData::operator ==(const PropulsionSystemData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_powerSetting == rhs._powerSetting) ) ivarsEqual = false; - if( ! (_engineRpm == rhs._engineRpm) ) ivarsEqual = false; - - return ivarsEqual; - } - -int PropulsionSystemData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _powerSetting - marshalSize = marshalSize + 4; // _engineRpm - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/PropulsionSystemData.h b/src/dis6/PropulsionSystemData.h deleted file mode 100644 index 1ce1d228..00000000 --- a/src/dis6/PropulsionSystemData.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Data about a propulsion system - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT PropulsionSystemData -{ -protected: - /** powerSetting */ - float _powerSetting; - - /** engine RPMs */ - float _engineRpm; - - - public: - PropulsionSystemData(); - virtual ~PropulsionSystemData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getPowerSetting() const; - void setPowerSetting(float pX); - - float getEngineRpm() const; - void setEngineRpm(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const PropulsionSystemData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RadioCommunicationsFamilyPdu.cpp b/src/dis6/RadioCommunicationsFamilyPdu.cpp deleted file mode 100644 index 6259b0ab..00000000 --- a/src/dis6/RadioCommunicationsFamilyPdu.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include - -using namespace DIS; - - -RadioCommunicationsFamilyPdu::RadioCommunicationsFamilyPdu() : Pdu(), - _entityId(), - _radioId(0) -{ - setProtocolFamily( 4 ); -} - -RadioCommunicationsFamilyPdu::~RadioCommunicationsFamilyPdu() -{ -} - -EntityID& RadioCommunicationsFamilyPdu::getEntityId() -{ - return _entityId; -} - -const EntityID& RadioCommunicationsFamilyPdu::getEntityId() const -{ - return _entityId; -} - -void RadioCommunicationsFamilyPdu::setEntityId(const EntityID &pX) -{ - _entityId = pX; -} - -unsigned short RadioCommunicationsFamilyPdu::getRadioId() const -{ - return _radioId; -} - -void RadioCommunicationsFamilyPdu::setRadioId(unsigned short pX) -{ - _radioId = pX; -} - -void RadioCommunicationsFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first - _entityId.marshal(dataStream); - dataStream << _radioId; -} - -void RadioCommunicationsFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _entityId.unmarshal(dataStream); - dataStream >> _radioId; -} - - -bool RadioCommunicationsFamilyPdu::operator ==(const RadioCommunicationsFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - if( ! (_entityId == rhs._entityId) ) ivarsEqual = false; - if( ! (_radioId == rhs._radioId) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RadioCommunicationsFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - marshalSize = marshalSize + _entityId.getMarshalledSize(); // _entityId - marshalSize = marshalSize + 2; // _radioId - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RadioCommunicationsFamilyPdu.h b/src/dis6/RadioCommunicationsFamilyPdu.h deleted file mode 100644 index f2910b79..00000000 --- a/src/dis6/RadioCommunicationsFamilyPdu.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.8. Abstract superclass for radio communications PDUs. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT RadioCommunicationsFamilyPdu : public Pdu -{ -protected: - /** ID of the entitythat is the source of the communication */ - EntityID _entityId; - - /** particular radio within an entity */ - unsigned short _radioId; - - - public: - RadioCommunicationsFamilyPdu(); - virtual ~RadioCommunicationsFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityId(); - const EntityID& getEntityId() const; - void setEntityId(const EntityID &pX); - - unsigned short getRadioId() const; - void setRadioId(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RadioCommunicationsFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RadioEntityType.cpp b/src/dis6/RadioEntityType.cpp deleted file mode 100644 index fa63bc14..00000000 --- a/src/dis6/RadioEntityType.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -RadioEntityType::RadioEntityType(): - _entityKind(0), - _domain(0), - _country(0), - _category(0), - _nomenclatureVersion(0), - _nomenclature(0) -{ -} - -RadioEntityType::~RadioEntityType() -{ -} - -unsigned char RadioEntityType::getEntityKind() const -{ - return _entityKind; -} - -void RadioEntityType::setEntityKind(unsigned char pX) -{ - _entityKind = pX; -} - -unsigned char RadioEntityType::getDomain() const -{ - return _domain; -} - -void RadioEntityType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short RadioEntityType::getCountry() const -{ - return _country; -} - -void RadioEntityType::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char RadioEntityType::getCategory() const -{ - return _category; -} - -void RadioEntityType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char RadioEntityType::getNomenclatureVersion() const -{ - return _nomenclatureVersion; -} - -void RadioEntityType::setNomenclatureVersion(unsigned char pX) -{ - _nomenclatureVersion = pX; -} - -unsigned short RadioEntityType::getNomenclature() const -{ - return _nomenclature; -} - -void RadioEntityType::setNomenclature(unsigned short pX) -{ - _nomenclature = pX; -} - -void RadioEntityType::marshal(DataStream& dataStream) const -{ - dataStream << _entityKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _nomenclatureVersion; - dataStream << _nomenclature; -} - -void RadioEntityType::unmarshal(DataStream& dataStream) -{ - dataStream >> _entityKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _nomenclatureVersion; - dataStream >> _nomenclature; -} - - -bool RadioEntityType::operator ==(const RadioEntityType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityKind == rhs._entityKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_nomenclatureVersion == rhs._nomenclatureVersion) ) ivarsEqual = false; - if( ! (_nomenclature == rhs._nomenclature) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RadioEntityType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _entityKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _nomenclatureVersion - marshalSize = marshalSize + 2; // _nomenclature - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RadioEntityType.h b/src/dis6/RadioEntityType.h deleted file mode 100644 index 2b5b8ba5..00000000 --- a/src/dis6/RadioEntityType.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.25. Identifies the type of radio - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT RadioEntityType -{ -protected: - /** Kind of entity */ - unsigned char _entityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** specific info based on subcategory field */ - unsigned char _nomenclatureVersion; - - unsigned short _nomenclature; - - - public: - RadioEntityType(); - virtual ~RadioEntityType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getEntityKind() const; - void setEntityKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getNomenclatureVersion() const; - void setNomenclatureVersion(unsigned char pX); - - unsigned short getNomenclature() const; - void setNomenclature(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RadioEntityType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ReceiverPdu.cpp b/src/dis6/ReceiverPdu.cpp deleted file mode 100644 index 25c03713..00000000 --- a/src/dis6/ReceiverPdu.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include - -using namespace DIS; - - -ReceiverPdu::ReceiverPdu() : RadioCommunicationsFamilyPdu(), - _receiverState(0), - _padding1(0), - _receivedPower(0.0), - _transmitterEntityId(), - _transmitterRadioId(0) -{ - setPduType( 27 ); -} - -ReceiverPdu::~ReceiverPdu() -{ -} - -unsigned short ReceiverPdu::getReceiverState() const -{ - return _receiverState; -} - -void ReceiverPdu::setReceiverState(unsigned short pX) -{ - _receiverState = pX; -} - -unsigned short ReceiverPdu::getPadding1() const -{ - return _padding1; -} - -void ReceiverPdu::setPadding1(unsigned short pX) -{ - _padding1 = pX; -} - -float ReceiverPdu::getReceivedPower() const -{ - return _receivedPower; -} - -void ReceiverPdu::setReceivedPower(float pX) -{ - _receivedPower = pX; -} - -EntityID& ReceiverPdu::getTransmitterEntityId() -{ - return _transmitterEntityId; -} - -const EntityID& ReceiverPdu::getTransmitterEntityId() const -{ - return _transmitterEntityId; -} - -void ReceiverPdu::setTransmitterEntityId(const EntityID &pX) -{ - _transmitterEntityId = pX; -} - -unsigned short ReceiverPdu::getTransmitterRadioId() const -{ - return _transmitterRadioId; -} - -void ReceiverPdu::setTransmitterRadioId(unsigned short pX) -{ - _transmitterRadioId = pX; -} - -void ReceiverPdu::marshal(DataStream& dataStream) const -{ - RadioCommunicationsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _receiverState; - dataStream << _padding1; - dataStream << _receivedPower; - _transmitterEntityId.marshal(dataStream); - dataStream << _transmitterRadioId; -} - -void ReceiverPdu::unmarshal(DataStream& dataStream) -{ - RadioCommunicationsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _receiverState; - dataStream >> _padding1; - dataStream >> _receivedPower; - _transmitterEntityId.unmarshal(dataStream); - dataStream >> _transmitterRadioId; -} - - -bool ReceiverPdu::operator ==(const ReceiverPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); - - if( ! (_receiverState == rhs._receiverState) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_receivedPower == rhs._receivedPower) ) ivarsEqual = false; - if( ! (_transmitterEntityId == rhs._transmitterEntityId) ) ivarsEqual = false; - if( ! (_transmitterRadioId == rhs._transmitterRadioId) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ReceiverPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _receiverState - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 4; // _receivedPoser - marshalSize = marshalSize + _transmitterEntityId.getMarshalledSize(); // _transmitterEntityId - marshalSize = marshalSize + 2; // _transmitterRadioId - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ReceiverPdu.h b/src/dis6/ReceiverPdu.h deleted file mode 100644 index d5a3e45b..00000000 --- a/src/dis6/ReceiverPdu.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.8.3. Communication of a receiver state. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ReceiverPdu : public RadioCommunicationsFamilyPdu -{ -protected: - /** encoding scheme used, and enumeration */ - unsigned short _receiverState; - - /** padding */ - unsigned short _padding1; - - /** received power */ - float _receivedPower; - - /** ID of transmitter */ - EntityID _transmitterEntityId; - - /** ID of transmitting radio */ - unsigned short _transmitterRadioId; - - - public: - ReceiverPdu(); - virtual ~ReceiverPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getReceiverState() const; - void setReceiverState(unsigned short pX); - - unsigned short getPadding1() const; - void setPadding1(unsigned short pX); - - float getReceivedPower() const; - void setReceivedPower(float pX); - - EntityID& getTransmitterEntityId(); - const EntityID& getTransmitterEntityId() const; - void setTransmitterEntityId(const EntityID &pX); - - unsigned short getTransmitterRadioId() const; - void setTransmitterRadioId(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ReceiverPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RecordQueryReliablePdu.cpp b/src/dis6/RecordQueryReliablePdu.cpp deleted file mode 100644 index f5254e09..00000000 --- a/src/dis6/RecordQueryReliablePdu.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include - -using namespace DIS; - - -RecordQueryReliablePdu::RecordQueryReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requestID(0), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _eventType(0), - _time(0), - _numberOfRecords(0) -{ - setPduType( 63 ); -} - -RecordQueryReliablePdu::~RecordQueryReliablePdu() -{ - _recordIDs.clear(); -} - -unsigned int RecordQueryReliablePdu::getRequestID() const -{ - return _requestID; -} - -void RecordQueryReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned char RecordQueryReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void RecordQueryReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short RecordQueryReliablePdu::getPad1() const -{ - return _pad1; -} - -void RecordQueryReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char RecordQueryReliablePdu::getPad2() const -{ - return _pad2; -} - -void RecordQueryReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned short RecordQueryReliablePdu::getEventType() const -{ - return _eventType; -} - -void RecordQueryReliablePdu::setEventType(unsigned short pX) -{ - _eventType = pX; -} - -unsigned int RecordQueryReliablePdu::getTime() const -{ - return _time; -} - -void RecordQueryReliablePdu::setTime(unsigned int pX) -{ - _time = pX; -} - -unsigned int RecordQueryReliablePdu::getNumberOfRecords() const -{ - return _recordIDs.size(); -} - -std::vector& RecordQueryReliablePdu::getRecordIDs() -{ - return _recordIDs; -} - -const std::vector& RecordQueryReliablePdu::getRecordIDs() const -{ - return _recordIDs; -} - -void RecordQueryReliablePdu::setRecordIDs(const std::vector& pX) -{ - _recordIDs = pX; -} - -void RecordQueryReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _eventType; - dataStream << _time; - dataStream << ( unsigned int )_recordIDs.size(); - - for(size_t idx = 0; idx < _recordIDs.size(); idx++) - { - FourByteChunk x = _recordIDs[idx]; - x.marshal(dataStream); - } - -} - -void RecordQueryReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _eventType; - dataStream >> _time; - dataStream >> _numberOfRecords; - - _recordIDs.clear(); - for(size_t idx = 0; idx < _numberOfRecords; idx++) - { - FourByteChunk x; - x.unmarshal(dataStream); - _recordIDs.push_back(x); - } -} - - -bool RecordQueryReliablePdu::operator ==(const RecordQueryReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_eventType == rhs._eventType) ) ivarsEqual = false; - if( ! (_time == rhs._time) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _recordIDs.size(); idx++) - { - if( ! ( _recordIDs[idx] == rhs._recordIDs[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int RecordQueryReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 2; // _eventType - marshalSize = marshalSize + 4; // _time - marshalSize = marshalSize + 4; // _numberOfRecords - - for(unsigned long long idx=0; idx < _recordIDs.size(); idx++) - { - FourByteChunk listElement = _recordIDs[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RecordQueryReliablePdu.h b/src/dis6/RecordQueryReliablePdu.h deleted file mode 100644 index 1ce1279b..00000000 --- a/src/dis6/RecordQueryReliablePdu.h +++ /dev/null @@ -1,113 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.13: A request for one or more records of data from an entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT RecordQueryReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** request ID */ - unsigned int _requestID; - - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding. The spec is unclear and contradictory here. */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** event type */ - unsigned short _eventType; - - /** time */ - unsigned int _time; - - /** numberOfRecords */ - unsigned int _numberOfRecords; - - /** record IDs */ - std::vector _recordIDs; - - - public: - RecordQueryReliablePdu(); - virtual ~RecordQueryReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned short getEventType() const; - void setEventType(unsigned short pX); - - unsigned int getTime() const; - void setTime(unsigned int pX); - - unsigned int getNumberOfRecords() const; - - std::vector& getRecordIDs(); - const std::vector& getRecordIDs() const; - void setRecordIDs(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RecordQueryReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RecordSet.cpp b/src/dis6/RecordSet.cpp deleted file mode 100644 index 84a343cc..00000000 --- a/src/dis6/RecordSet.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -RecordSet::RecordSet(): - _recordID(0), - _recordSetSerialNumber(0), - _recordLength(0), - _recordCount(0), - _recordValues(0), - _pad4(0) -{ -} - -RecordSet::~RecordSet() -{ -} - -unsigned int RecordSet::getRecordID() const -{ - return _recordID; -} - -void RecordSet::setRecordID(unsigned int pX) -{ - _recordID = pX; -} - -unsigned int RecordSet::getRecordSetSerialNumber() const -{ - return _recordSetSerialNumber; -} - -void RecordSet::setRecordSetSerialNumber(unsigned int pX) -{ - _recordSetSerialNumber = pX; -} - -unsigned short RecordSet::getRecordLength() const -{ - return _recordLength; -} - -void RecordSet::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned short RecordSet::getRecordCount() const -{ - return _recordCount; -} - -void RecordSet::setRecordCount(unsigned short pX) -{ - _recordCount = pX; -} - -unsigned short RecordSet::getRecordValues() const -{ - return _recordValues; -} - -void RecordSet::setRecordValues(unsigned short pX) -{ - _recordValues = pX; -} - -unsigned char RecordSet::getPad4() const -{ - return _pad4; -} - -void RecordSet::setPad4(unsigned char pX) -{ - _pad4 = pX; -} - -void RecordSet::marshal(DataStream& dataStream) const -{ - dataStream << _recordID; - dataStream << _recordSetSerialNumber; - dataStream << _recordLength; - dataStream << _recordCount; - dataStream << _recordValues; - dataStream << _pad4; -} - -void RecordSet::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordID; - dataStream >> _recordSetSerialNumber; - dataStream >> _recordLength; - dataStream >> _recordCount; - dataStream >> _recordValues; - dataStream >> _pad4; -} - - -bool RecordSet::operator ==(const RecordSet& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordID == rhs._recordID) ) ivarsEqual = false; - if( ! (_recordSetSerialNumber == rhs._recordSetSerialNumber) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_recordCount == rhs._recordCount) ) ivarsEqual = false; - if( ! (_recordValues == rhs._recordValues) ) ivarsEqual = false; - if( ! (_pad4 == rhs._pad4) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RecordSet::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordID - marshalSize = marshalSize + 4; // _recordSetSerialNumber - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 2; // _recordCount - marshalSize = marshalSize + 2; // _recordValues - marshalSize = marshalSize + 1; // _pad4 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RecordSet.h b/src/dis6/RecordSet.h deleted file mode 100644 index 6ece35fe..00000000 --- a/src/dis6/RecordSet.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Record sets, used in transfer control request PDU - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT RecordSet -{ -protected: - /** record ID */ - unsigned int _recordID; - - /** record set serial number */ - unsigned int _recordSetSerialNumber; - - /** record length */ - unsigned short _recordLength; - - /** record count */ - unsigned short _recordCount; - - /** ^^^This is wrong--variable sized data records */ - unsigned short _recordValues; - - /** ^^^This is wrong--variable sized padding */ - unsigned char _pad4; - - - public: - RecordSet(); - virtual ~RecordSet(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordID() const; - void setRecordID(unsigned int pX); - - unsigned int getRecordSetSerialNumber() const; - void setRecordSetSerialNumber(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned short getRecordCount() const; - void setRecordCount(unsigned short pX); - - unsigned short getRecordValues() const; - void setRecordValues(unsigned short pX); - - unsigned char getPad4() const; - void setPad4(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RecordSet& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Relationship.cpp b/src/dis6/Relationship.cpp deleted file mode 100644 index e7b35abf..00000000 --- a/src/dis6/Relationship.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -Relationship::Relationship(): - _nature(0), - _position(0) -{ -} - -Relationship::~Relationship() -{ -} - -unsigned short Relationship::getNature() const -{ - return _nature; -} - -void Relationship::setNature(unsigned short pX) -{ - _nature = pX; -} - -unsigned short Relationship::getPosition() const -{ - return _position; -} - -void Relationship::setPosition(unsigned short pX) -{ - _position = pX; -} - -void Relationship::marshal(DataStream& dataStream) const -{ - dataStream << _nature; - dataStream << _position; -} - -void Relationship::unmarshal(DataStream& dataStream) -{ - dataStream >> _nature; - dataStream >> _position; -} - - -bool Relationship::operator ==(const Relationship& rhs) const - { - bool ivarsEqual = true; - - if( ! (_nature == rhs._nature) ) ivarsEqual = false; - if( ! (_position == rhs._position) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Relationship::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _nature - marshalSize = marshalSize + 2; // _position - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Relationship.h b/src/dis6/Relationship.h deleted file mode 100644 index b61daf08..00000000 --- a/src/dis6/Relationship.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.2.56. Purpose for joinging two entities - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT Relationship -{ -protected: - /** Nature of join */ - unsigned short _nature; - - /** position of join */ - unsigned short _position; - - - public: - Relationship(); - virtual ~Relationship(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getNature() const; - void setNature(unsigned short pX); - - unsigned short getPosition() const; - void setPosition(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Relationship& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RemoveEntityPdu.cpp b/src/dis6/RemoveEntityPdu.cpp deleted file mode 100644 index 2f9e3afe..00000000 --- a/src/dis6/RemoveEntityPdu.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include - -using namespace DIS; - - -RemoveEntityPdu::RemoveEntityPdu() : SimulationManagementFamilyPdu(), - _requestID(0) -{ - setPduType( 12 ); -} - -RemoveEntityPdu::~RemoveEntityPdu() -{ -} - -unsigned int RemoveEntityPdu::getRequestID() const -{ - return _requestID; -} - -void RemoveEntityPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void RemoveEntityPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; -} - -void RemoveEntityPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; -} - - -bool RemoveEntityPdu::operator ==(const RemoveEntityPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RemoveEntityPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RemoveEntityPdu.h b/src/dis6/RemoveEntityPdu.h deleted file mode 100644 index 31ffee76..00000000 --- a/src/dis6/RemoveEntityPdu.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.2. Remove an entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT RemoveEntityPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for the request */ - unsigned int _requestID; - - - public: - RemoveEntityPdu(); - virtual ~RemoveEntityPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RemoveEntityPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RemoveEntityReliablePdu.cpp b/src/dis6/RemoveEntityReliablePdu.cpp deleted file mode 100644 index f07e35ec..00000000 --- a/src/dis6/RemoveEntityReliablePdu.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include - -using namespace DIS; - - -RemoveEntityReliablePdu::RemoveEntityReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0) -{ - setPduType( 52 ); -} - -RemoveEntityReliablePdu::~RemoveEntityReliablePdu() -{ -} - -unsigned char RemoveEntityReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void RemoveEntityReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short RemoveEntityReliablePdu::getPad1() const -{ - return _pad1; -} - -void RemoveEntityReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char RemoveEntityReliablePdu::getPad2() const -{ - return _pad2; -} - -void RemoveEntityReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int RemoveEntityReliablePdu::getRequestID() const -{ - return _requestID; -} - -void RemoveEntityReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void RemoveEntityReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; -} - -void RemoveEntityReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; -} - - -bool RemoveEntityReliablePdu::operator ==(const RemoveEntityReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RemoveEntityReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RemoveEntityReliablePdu.h b/src/dis6/RemoveEntityReliablePdu.h deleted file mode 100644 index 30082496..00000000 --- a/src/dis6/RemoveEntityReliablePdu.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.2: Removal of an entity , reliable. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT RemoveEntityReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Request ID */ - unsigned int _requestID; - - - public: - RemoveEntityReliablePdu(); - virtual ~RemoveEntityReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RemoveEntityReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RepairCompletePdu.cpp b/src/dis6/RepairCompletePdu.cpp deleted file mode 100644 index c2afc9be..00000000 --- a/src/dis6/RepairCompletePdu.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include - -using namespace DIS; - - -RepairCompletePdu::RepairCompletePdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _repairingEntityID(), - _repair(0), - _padding2(0) -{ - setPduType( 9 ); -} - -RepairCompletePdu::~RepairCompletePdu() -{ -} - -EntityID& RepairCompletePdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& RepairCompletePdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void RepairCompletePdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& RepairCompletePdu::getRepairingEntityID() -{ - return _repairingEntityID; -} - -const EntityID& RepairCompletePdu::getRepairingEntityID() const -{ - return _repairingEntityID; -} - -void RepairCompletePdu::setRepairingEntityID(const EntityID &pX) -{ - _repairingEntityID = pX; -} - -unsigned short RepairCompletePdu::getRepair() const -{ - return _repair; -} - -void RepairCompletePdu::setRepair(unsigned short pX) -{ - _repair = pX; -} - -short RepairCompletePdu::getPadding2() const -{ - return _padding2; -} - -void RepairCompletePdu::setPadding2(short pX) -{ - _padding2 = pX; -} - -void RepairCompletePdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _repairingEntityID.marshal(dataStream); - dataStream << _repair; - dataStream << _padding2; -} - -void RepairCompletePdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _repairingEntityID.unmarshal(dataStream); - dataStream >> _repair; - dataStream >> _padding2; -} - - -bool RepairCompletePdu::operator ==(const RepairCompletePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_repairingEntityID == rhs._repairingEntityID) ) ivarsEqual = false; - if( ! (_repair == rhs._repair) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RepairCompletePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _repairingEntityID.getMarshalledSize(); // _repairingEntityID - marshalSize = marshalSize + 2; // _repair - marshalSize = marshalSize + 2; // _padding2 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RepairCompletePdu.h b/src/dis6/RepairCompletePdu.h deleted file mode 100644 index 589da732..00000000 --- a/src/dis6/RepairCompletePdu.h +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.2.5.5. Repair is complete. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT RepairCompletePdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is receiving service */ - EntityID _receivingEntityID; - - /** Entity that is supplying */ - EntityID _repairingEntityID; - - /** Enumeration for type of repair */ - unsigned short _repair; - - /** padding, number prevents conflict with superclass ivar name */ - short _padding2; - - - public: - RepairCompletePdu(); - virtual ~RepairCompletePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getRepairingEntityID(); - const EntityID& getRepairingEntityID() const; - void setRepairingEntityID(const EntityID &pX); - - unsigned short getRepair() const; - void setRepair(unsigned short pX); - - short getPadding2() const; - void setPadding2(short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RepairCompletePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RepairResponsePdu.cpp b/src/dis6/RepairResponsePdu.cpp deleted file mode 100644 index f41da6cd..00000000 --- a/src/dis6/RepairResponsePdu.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include - -using namespace DIS; - - -RepairResponsePdu::RepairResponsePdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _repairingEntityID(), - _repairResult(0), - _padding1(0), - _padding2(0) -{ - setPduType( 10 ); -} - -RepairResponsePdu::~RepairResponsePdu() -{ -} - -EntityID& RepairResponsePdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& RepairResponsePdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void RepairResponsePdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& RepairResponsePdu::getRepairingEntityID() -{ - return _repairingEntityID; -} - -const EntityID& RepairResponsePdu::getRepairingEntityID() const -{ - return _repairingEntityID; -} - -void RepairResponsePdu::setRepairingEntityID(const EntityID &pX) -{ - _repairingEntityID = pX; -} - -unsigned char RepairResponsePdu::getRepairResult() const -{ - return _repairResult; -} - -void RepairResponsePdu::setRepairResult(unsigned char pX) -{ - _repairResult = pX; -} - -short RepairResponsePdu::getPadding1() const -{ - return _padding1; -} - -void RepairResponsePdu::setPadding1(short pX) -{ - _padding1 = pX; -} - -char RepairResponsePdu::getPadding2() const -{ - return _padding2; -} - -void RepairResponsePdu::setPadding2(char pX) -{ - _padding2 = pX; -} - -void RepairResponsePdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _repairingEntityID.marshal(dataStream); - dataStream << _repairResult; - dataStream << _padding1; - dataStream << _padding2; -} - -void RepairResponsePdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _repairingEntityID.unmarshal(dataStream); - dataStream >> _repairResult; - dataStream >> _padding1; - dataStream >> _padding2; -} - - -bool RepairResponsePdu::operator ==(const RepairResponsePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_repairingEntityID == rhs._repairingEntityID) ) ivarsEqual = false; - if( ! (_repairResult == rhs._repairResult) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RepairResponsePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _repairingEntityID.getMarshalledSize(); // _repairingEntityID - marshalSize = marshalSize + 1; // _repairResult - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/RepairResponsePdu.h b/src/dis6/RepairResponsePdu.h deleted file mode 100644 index 3dfeb9da..00000000 --- a/src/dis6/RepairResponsePdu.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.2.5.6. Sent after repair complete PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT RepairResponsePdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is receiving service */ - EntityID _receivingEntityID; - - /** Entity that is supplying */ - EntityID _repairingEntityID; - - /** Result of repair operation */ - unsigned char _repairResult; - - /** padding */ - short _padding1; - - /** padding */ - char _padding2; - - - public: - RepairResponsePdu(); - virtual ~RepairResponsePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getRepairingEntityID(); - const EntityID& getRepairingEntityID() const; - void setRepairingEntityID(const EntityID &pX); - - unsigned char getRepairResult() const; - void setRepairResult(unsigned char pX); - - short getPadding1() const; - void setPadding1(short pX); - - char getPadding2() const; - void setPadding2(char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RepairResponsePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ResupplyCancelPdu.cpp b/src/dis6/ResupplyCancelPdu.cpp deleted file mode 100644 index 741256cc..00000000 --- a/src/dis6/ResupplyCancelPdu.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -using namespace DIS; - - -ResupplyCancelPdu::ResupplyCancelPdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _supplyingEntityID() -{ - setPduType( 8 ); -} - -ResupplyCancelPdu::~ResupplyCancelPdu() -{ -} - -EntityID& ResupplyCancelPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& ResupplyCancelPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void ResupplyCancelPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& ResupplyCancelPdu::getSupplyingEntityID() -{ - return _supplyingEntityID; -} - -const EntityID& ResupplyCancelPdu::getSupplyingEntityID() const -{ - return _supplyingEntityID; -} - -void ResupplyCancelPdu::setSupplyingEntityID(const EntityID &pX) -{ - _supplyingEntityID = pX; -} - -void ResupplyCancelPdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _supplyingEntityID.marshal(dataStream); -} - -void ResupplyCancelPdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _supplyingEntityID.unmarshal(dataStream); -} - - -bool ResupplyCancelPdu::operator ==(const ResupplyCancelPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_supplyingEntityID == rhs._supplyingEntityID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ResupplyCancelPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ResupplyCancelPdu.h b/src/dis6/ResupplyCancelPdu.h deleted file mode 100644 index a36a67c2..00000000 --- a/src/dis6/ResupplyCancelPdu.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.2.5.4. Cancel of resupply by either the receiving or supplying entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ResupplyCancelPdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is receiving service */ - EntityID _receivingEntityID; - - /** Entity that is supplying */ - EntityID _supplyingEntityID; - - - public: - ResupplyCancelPdu(); - virtual ~ResupplyCancelPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getSupplyingEntityID(); - const EntityID& getSupplyingEntityID() const; - void setSupplyingEntityID(const EntityID &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ResupplyCancelPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ResupplyOfferPdu.cpp b/src/dis6/ResupplyOfferPdu.cpp deleted file mode 100644 index 908e9d52..00000000 --- a/src/dis6/ResupplyOfferPdu.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include - -using namespace DIS; - - -ResupplyOfferPdu::ResupplyOfferPdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _supplyingEntityID(), - _numberOfSupplyTypes(0), - _padding1(0), - _padding2(0) -{ - setPduType( 6 ); -} - -ResupplyOfferPdu::~ResupplyOfferPdu() -{ - _supplies.clear(); -} - -EntityID& ResupplyOfferPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& ResupplyOfferPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void ResupplyOfferPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& ResupplyOfferPdu::getSupplyingEntityID() -{ - return _supplyingEntityID; -} - -const EntityID& ResupplyOfferPdu::getSupplyingEntityID() const -{ - return _supplyingEntityID; -} - -void ResupplyOfferPdu::setSupplyingEntityID(const EntityID &pX) -{ - _supplyingEntityID = pX; -} - -unsigned char ResupplyOfferPdu::getNumberOfSupplyTypes() const -{ - return _supplies.size(); -} - -short ResupplyOfferPdu::getPadding1() const -{ - return _padding1; -} - -void ResupplyOfferPdu::setPadding1(short pX) -{ - _padding1 = pX; -} - -char ResupplyOfferPdu::getPadding2() const -{ - return _padding2; -} - -void ResupplyOfferPdu::setPadding2(char pX) -{ - _padding2 = pX; -} - -std::vector& ResupplyOfferPdu::getSupplies() -{ - return _supplies; -} - -const std::vector& ResupplyOfferPdu::getSupplies() const -{ - return _supplies; -} - -void ResupplyOfferPdu::setSupplies(const std::vector& pX) -{ - _supplies = pX; -} - -void ResupplyOfferPdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _supplyingEntityID.marshal(dataStream); - dataStream << ( unsigned char )_supplies.size(); - dataStream << _padding1; - dataStream << _padding2; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - SupplyQuantity x = _supplies[idx]; - x.marshal(dataStream); - } - -} - -void ResupplyOfferPdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _supplyingEntityID.unmarshal(dataStream); - dataStream >> _numberOfSupplyTypes; - dataStream >> _padding1; - dataStream >> _padding2; - - _supplies.clear(); - for(size_t idx = 0; idx < _numberOfSupplyTypes; idx++) - { - SupplyQuantity x; - x.unmarshal(dataStream); - _supplies.push_back(x); - } -} - - -bool ResupplyOfferPdu::operator ==(const ResupplyOfferPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_supplyingEntityID == rhs._supplyingEntityID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - if( ! ( _supplies[idx] == rhs._supplies[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ResupplyOfferPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID - marshalSize = marshalSize + 1; // _numberOfSupplyTypes - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - - for(unsigned long long idx=0; idx < _supplies.size(); idx++) - { - SupplyQuantity listElement = _supplies[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ResupplyOfferPdu.h b/src/dis6/ResupplyOfferPdu.h deleted file mode 100644 index ac4ea4f6..00000000 --- a/src/dis6/ResupplyOfferPdu.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.5.2. Information about a request for supplies. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ResupplyOfferPdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is receiving service */ - EntityID _receivingEntityID; - - /** Entity that is supplying */ - EntityID _supplyingEntityID; - - /** how many supplies are being offered */ - unsigned char _numberOfSupplyTypes; - - /** padding */ - short _padding1; - - /** padding */ - char _padding2; - - std::vector _supplies; - - - public: - ResupplyOfferPdu(); - virtual ~ResupplyOfferPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getSupplyingEntityID(); - const EntityID& getSupplyingEntityID() const; - void setSupplyingEntityID(const EntityID &pX); - - unsigned char getNumberOfSupplyTypes() const; - - short getPadding1() const; - void setPadding1(short pX); - - char getPadding2() const; - void setPadding2(char pX); - - std::vector& getSupplies(); - const std::vector& getSupplies() const; - void setSupplies(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ResupplyOfferPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ResupplyReceivedPdu.cpp b/src/dis6/ResupplyReceivedPdu.cpp deleted file mode 100644 index 163ecad2..00000000 --- a/src/dis6/ResupplyReceivedPdu.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include - -using namespace DIS; - - -ResupplyReceivedPdu::ResupplyReceivedPdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _supplyingEntityID(), - _numberOfSupplyTypes(0), - _padding1(0), - _padding2(0) -{ - setPduType( 7 ); -} - -ResupplyReceivedPdu::~ResupplyReceivedPdu() -{ - _supplies.clear(); -} - -EntityID& ResupplyReceivedPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& ResupplyReceivedPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void ResupplyReceivedPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& ResupplyReceivedPdu::getSupplyingEntityID() -{ - return _supplyingEntityID; -} - -const EntityID& ResupplyReceivedPdu::getSupplyingEntityID() const -{ - return _supplyingEntityID; -} - -void ResupplyReceivedPdu::setSupplyingEntityID(const EntityID &pX) -{ - _supplyingEntityID = pX; -} - -unsigned char ResupplyReceivedPdu::getNumberOfSupplyTypes() const -{ - return _supplies.size(); -} - -short ResupplyReceivedPdu::getPadding1() const -{ - return _padding1; -} - -void ResupplyReceivedPdu::setPadding1(short pX) -{ - _padding1 = pX; -} - -char ResupplyReceivedPdu::getPadding2() const -{ - return _padding2; -} - -void ResupplyReceivedPdu::setPadding2(char pX) -{ - _padding2 = pX; -} - -std::vector& ResupplyReceivedPdu::getSupplies() -{ - return _supplies; -} - -const std::vector& ResupplyReceivedPdu::getSupplies() const -{ - return _supplies; -} - -void ResupplyReceivedPdu::setSupplies(const std::vector& pX) -{ - _supplies = pX; -} - -void ResupplyReceivedPdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _supplyingEntityID.marshal(dataStream); - dataStream << ( unsigned char )_supplies.size(); - dataStream << _padding1; - dataStream << _padding2; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - SupplyQuantity x = _supplies[idx]; - x.marshal(dataStream); - } - -} - -void ResupplyReceivedPdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _supplyingEntityID.unmarshal(dataStream); - dataStream >> _numberOfSupplyTypes; - dataStream >> _padding1; - dataStream >> _padding2; - - _supplies.clear(); - for(size_t idx = 0; idx < _numberOfSupplyTypes; idx++) - { - SupplyQuantity x; - x.unmarshal(dataStream); - _supplies.push_back(x); - } -} - - -bool ResupplyReceivedPdu::operator ==(const ResupplyReceivedPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_supplyingEntityID == rhs._supplyingEntityID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - if( ! ( _supplies[idx] == rhs._supplies[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ResupplyReceivedPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID - marshalSize = marshalSize + 1; // _numberOfSupplyTypes - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - - for(unsigned long long idx=0; idx < _supplies.size(); idx++) - { - SupplyQuantity listElement = _supplies[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ResupplyReceivedPdu.h b/src/dis6/ResupplyReceivedPdu.h deleted file mode 100644 index b6867908..00000000 --- a/src/dis6/ResupplyReceivedPdu.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.5.3. Receipt of supplies is communiated. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ResupplyReceivedPdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is receiving service */ - EntityID _receivingEntityID; - - /** Entity that is supplying */ - EntityID _supplyingEntityID; - - /** how many supplies are being offered */ - unsigned char _numberOfSupplyTypes; - - /** padding */ - short _padding1; - - /** padding */ - char _padding2; - - std::vector _supplies; - - - public: - ResupplyReceivedPdu(); - virtual ~ResupplyReceivedPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getSupplyingEntityID(); - const EntityID& getSupplyingEntityID() const; - void setSupplyingEntityID(const EntityID &pX); - - unsigned char getNumberOfSupplyTypes() const; - - short getPadding1() const; - void setPadding1(short pX); - - char getPadding2() const; - void setPadding2(char pX); - - std::vector& getSupplies(); - const std::vector& getSupplies() const; - void setSupplies(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ResupplyReceivedPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SeesPdu.cpp b/src/dis6/SeesPdu.cpp deleted file mode 100644 index 053dc92b..00000000 --- a/src/dis6/SeesPdu.cpp +++ /dev/null @@ -1,244 +0,0 @@ -#include - -using namespace DIS; - - -SeesPdu::SeesPdu() : DistributedEmissionsFamilyPdu(), - _orginatingEntityID(), - _infraredSignatureRepresentationIndex(0), - _acousticSignatureRepresentationIndex(0), - _radarCrossSectionSignatureRepresentationIndex(0), - _numberOfPropulsionSystems(0), - _numberOfVectoringNozzleSystems(0) -{ - setPduType( 30 ); -} - -SeesPdu::~SeesPdu() -{ - _propulsionSystemData.clear(); - _vectoringSystemData.clear(); -} - -EntityID& SeesPdu::getOrginatingEntityID() -{ - return _orginatingEntityID; -} - -const EntityID& SeesPdu::getOrginatingEntityID() const -{ - return _orginatingEntityID; -} - -void SeesPdu::setOrginatingEntityID(const EntityID &pX) -{ - _orginatingEntityID = pX; -} - -unsigned short SeesPdu::getInfraredSignatureRepresentationIndex() const -{ - return _infraredSignatureRepresentationIndex; -} - -void SeesPdu::setInfraredSignatureRepresentationIndex(unsigned short pX) -{ - _infraredSignatureRepresentationIndex = pX; -} - -unsigned short SeesPdu::getAcousticSignatureRepresentationIndex() const -{ - return _acousticSignatureRepresentationIndex; -} - -void SeesPdu::setAcousticSignatureRepresentationIndex(unsigned short pX) -{ - _acousticSignatureRepresentationIndex = pX; -} - -unsigned short SeesPdu::getRadarCrossSectionSignatureRepresentationIndex() const -{ - return _radarCrossSectionSignatureRepresentationIndex; -} - -void SeesPdu::setRadarCrossSectionSignatureRepresentationIndex(unsigned short pX) -{ - _radarCrossSectionSignatureRepresentationIndex = pX; -} - -unsigned short SeesPdu::getNumberOfPropulsionSystems() const -{ - return _propulsionSystemData.size(); -} - -unsigned short SeesPdu::getNumberOfVectoringNozzleSystems() const -{ - return _vectoringSystemData.size(); -} - -std::vector& SeesPdu::getPropulsionSystemData() -{ - return _propulsionSystemData; -} - -const std::vector& SeesPdu::getPropulsionSystemData() const -{ - return _propulsionSystemData; -} - -void SeesPdu::setPropulsionSystemData(const std::vector& pX) -{ - _propulsionSystemData = pX; -} - -std::vector& SeesPdu::getVectoringSystemData() -{ - return _vectoringSystemData; -} - -const std::vector& SeesPdu::getVectoringSystemData() const -{ - return _vectoringSystemData; -} - -void SeesPdu::setVectoringSystemData(const std::vector& pX) -{ - _vectoringSystemData = pX; -} - -void SeesPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _orginatingEntityID.marshal(dataStream); - dataStream << _infraredSignatureRepresentationIndex; - dataStream << _acousticSignatureRepresentationIndex; - dataStream << _radarCrossSectionSignatureRepresentationIndex; - dataStream << ( unsigned short )_propulsionSystemData.size(); - dataStream << ( unsigned short )_vectoringSystemData.size(); - - for(size_t idx = 0; idx < _propulsionSystemData.size(); idx++) - { - PropulsionSystemData x = _propulsionSystemData[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _vectoringSystemData.size(); idx++) - { - VectoringNozzleSystemData x = _vectoringSystemData[idx]; - x.marshal(dataStream); - } - -} - -void SeesPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _orginatingEntityID.unmarshal(dataStream); - dataStream >> _infraredSignatureRepresentationIndex; - dataStream >> _acousticSignatureRepresentationIndex; - dataStream >> _radarCrossSectionSignatureRepresentationIndex; - dataStream >> _numberOfPropulsionSystems; - dataStream >> _numberOfVectoringNozzleSystems; - - _propulsionSystemData.clear(); - for(size_t idx = 0; idx < _numberOfPropulsionSystems; idx++) - { - PropulsionSystemData x; - x.unmarshal(dataStream); - _propulsionSystemData.push_back(x); - } - - _vectoringSystemData.clear(); - for(size_t idx = 0; idx < _numberOfVectoringNozzleSystems; idx++) - { - VectoringNozzleSystemData x; - x.unmarshal(dataStream); - _vectoringSystemData.push_back(x); - } -} - - -bool SeesPdu::operator ==(const SeesPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_orginatingEntityID == rhs._orginatingEntityID) ) ivarsEqual = false; - if( ! (_infraredSignatureRepresentationIndex == rhs._infraredSignatureRepresentationIndex) ) ivarsEqual = false; - if( ! (_acousticSignatureRepresentationIndex == rhs._acousticSignatureRepresentationIndex) ) ivarsEqual = false; - if( ! (_radarCrossSectionSignatureRepresentationIndex == rhs._radarCrossSectionSignatureRepresentationIndex) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _propulsionSystemData.size(); idx++) - { - if( ! ( _propulsionSystemData[idx] == rhs._propulsionSystemData[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _vectoringSystemData.size(); idx++) - { - if( ! ( _vectoringSystemData[idx] == rhs._vectoringSystemData[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int SeesPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID - marshalSize = marshalSize + 2; // _infraredSignatureRepresentationIndex - marshalSize = marshalSize + 2; // _acousticSignatureRepresentationIndex - marshalSize = marshalSize + 2; // _radarCrossSectionSignatureRepresentationIndex - marshalSize = marshalSize + 2; // _numberOfPropulsionSystems - marshalSize = marshalSize + 2; // _numberOfVectoringNozzleSystems - - for(unsigned long long idx=0; idx < _propulsionSystemData.size(); idx++) - { - PropulsionSystemData listElement = _propulsionSystemData[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _vectoringSystemData.size(); idx++) - { - VectoringNozzleSystemData listElement = _vectoringSystemData[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SeesPdu.h b/src/dis6/SeesPdu.h deleted file mode 100644 index 1d1c5d57..00000000 --- a/src/dis6/SeesPdu.h +++ /dev/null @@ -1,116 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7.5. SEES PDU, supplemental emissions entity state information. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SeesPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** Originating entity ID */ - EntityID _orginatingEntityID; - - /** IR Signature representation index */ - unsigned short _infraredSignatureRepresentationIndex; - - /** acoustic Signature representation index */ - unsigned short _acousticSignatureRepresentationIndex; - - /** radar cross section representation index */ - unsigned short _radarCrossSectionSignatureRepresentationIndex; - - /** how many propulsion systems */ - unsigned short _numberOfPropulsionSystems; - - /** how many vectoring nozzle systems */ - unsigned short _numberOfVectoringNozzleSystems; - - /** variable length list of propulsion system data */ - std::vector _propulsionSystemData; - - /** variable length list of vectoring system data */ - std::vector _vectoringSystemData; - - - public: - SeesPdu(); - virtual ~SeesPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOrginatingEntityID(); - const EntityID& getOrginatingEntityID() const; - void setOrginatingEntityID(const EntityID &pX); - - unsigned short getInfraredSignatureRepresentationIndex() const; - void setInfraredSignatureRepresentationIndex(unsigned short pX); - - unsigned short getAcousticSignatureRepresentationIndex() const; - void setAcousticSignatureRepresentationIndex(unsigned short pX); - - unsigned short getRadarCrossSectionSignatureRepresentationIndex() const; - void setRadarCrossSectionSignatureRepresentationIndex(unsigned short pX); - - unsigned short getNumberOfPropulsionSystems() const; - - unsigned short getNumberOfVectoringNozzleSystems() const; - - std::vector& getPropulsionSystemData(); - const std::vector& getPropulsionSystemData() const; - void setPropulsionSystemData(const std::vector& pX); - - std::vector& getVectoringSystemData(); - const std::vector& getVectoringSystemData() const; - void setVectoringSystemData(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SeesPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ServiceRequestPdu.cpp b/src/dis6/ServiceRequestPdu.cpp deleted file mode 100644 index 2a47f0ae..00000000 --- a/src/dis6/ServiceRequestPdu.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include - -using namespace DIS; - - -ServiceRequestPdu::ServiceRequestPdu() : LogisticsFamilyPdu(), - _requestingEntityID(), - _servicingEntityID(), - _serviceTypeRequested(0), - _numberOfSupplyTypes(0), - _serviceRequestPadding(0) -{ - setPduType( 5 ); -} - -ServiceRequestPdu::~ServiceRequestPdu() -{ - _supplies.clear(); -} - -EntityID& ServiceRequestPdu::getRequestingEntityID() -{ - return _requestingEntityID; -} - -const EntityID& ServiceRequestPdu::getRequestingEntityID() const -{ - return _requestingEntityID; -} - -void ServiceRequestPdu::setRequestingEntityID(const EntityID &pX) -{ - _requestingEntityID = pX; -} - -EntityID& ServiceRequestPdu::getServicingEntityID() -{ - return _servicingEntityID; -} - -const EntityID& ServiceRequestPdu::getServicingEntityID() const -{ - return _servicingEntityID; -} - -void ServiceRequestPdu::setServicingEntityID(const EntityID &pX) -{ - _servicingEntityID = pX; -} - -unsigned char ServiceRequestPdu::getServiceTypeRequested() const -{ - return _serviceTypeRequested; -} - -void ServiceRequestPdu::setServiceTypeRequested(unsigned char pX) -{ - _serviceTypeRequested = pX; -} - -unsigned char ServiceRequestPdu::getNumberOfSupplyTypes() const -{ - return _supplies.size(); -} - -short ServiceRequestPdu::getServiceRequestPadding() const -{ - return _serviceRequestPadding; -} - -void ServiceRequestPdu::setServiceRequestPadding(short pX) -{ - _serviceRequestPadding = pX; -} - -std::vector& ServiceRequestPdu::getSupplies() -{ - return _supplies; -} - -const std::vector& ServiceRequestPdu::getSupplies() const -{ - return _supplies; -} - -void ServiceRequestPdu::setSupplies(const std::vector& pX) -{ - _supplies = pX; -} - -void ServiceRequestPdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _requestingEntityID.marshal(dataStream); - _servicingEntityID.marshal(dataStream); - dataStream << _serviceTypeRequested; - dataStream << ( unsigned char )_supplies.size(); - dataStream << _serviceRequestPadding; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - SupplyQuantity x = _supplies[idx]; - x.marshal(dataStream); - } - -} - -void ServiceRequestPdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _requestingEntityID.unmarshal(dataStream); - _servicingEntityID.unmarshal(dataStream); - dataStream >> _serviceTypeRequested; - dataStream >> _numberOfSupplyTypes; - dataStream >> _serviceRequestPadding; - - _supplies.clear(); - for(size_t idx = 0; idx < _numberOfSupplyTypes; idx++) - { - SupplyQuantity x; - x.unmarshal(dataStream); - _supplies.push_back(x); - } -} - - -bool ServiceRequestPdu::operator ==(const ServiceRequestPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_requestingEntityID == rhs._requestingEntityID) ) ivarsEqual = false; - if( ! (_servicingEntityID == rhs._servicingEntityID) ) ivarsEqual = false; - if( ! (_serviceTypeRequested == rhs._serviceTypeRequested) ) ivarsEqual = false; - if( ! (_serviceRequestPadding == rhs._serviceRequestPadding) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - if( ! ( _supplies[idx] == rhs._supplies[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ServiceRequestPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _requestingEntityID.getMarshalledSize(); // _requestingEntityID - marshalSize = marshalSize + _servicingEntityID.getMarshalledSize(); // _servicingEntityID - marshalSize = marshalSize + 1; // _serviceTypeRequested - marshalSize = marshalSize + 1; // _numberOfSupplyTypes - marshalSize = marshalSize + 2; // _serviceRequestPadding - - for(unsigned long long idx=0; idx < _supplies.size(); idx++) - { - SupplyQuantity listElement = _supplies[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ServiceRequestPdu.h b/src/dis6/ServiceRequestPdu.h deleted file mode 100644 index 37712391..00000000 --- a/src/dis6/ServiceRequestPdu.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.5.1. Information about a request for supplies. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ServiceRequestPdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is requesting service */ - EntityID _requestingEntityID; - - /** Entity that is providing the service */ - EntityID _servicingEntityID; - - /** type of service requested */ - unsigned char _serviceTypeRequested; - - /** How many requested */ - unsigned char _numberOfSupplyTypes; - - /** padding */ - short _serviceRequestPadding; - - std::vector _supplies; - - - public: - ServiceRequestPdu(); - virtual ~ServiceRequestPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getRequestingEntityID(); - const EntityID& getRequestingEntityID() const; - void setRequestingEntityID(const EntityID &pX); - - EntityID& getServicingEntityID(); - const EntityID& getServicingEntityID() const; - void setServicingEntityID(const EntityID &pX); - - unsigned char getServiceTypeRequested() const; - void setServiceTypeRequested(unsigned char pX); - - unsigned char getNumberOfSupplyTypes() const; - - short getServiceRequestPadding() const; - void setServiceRequestPadding(short pX); - - std::vector& getSupplies(); - const std::vector& getSupplies() const; - void setSupplies(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ServiceRequestPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SetDataPdu.cpp b/src/dis6/SetDataPdu.cpp deleted file mode 100644 index 791ff762..00000000 --- a/src/dis6/SetDataPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -SetDataPdu::SetDataPdu() : SimulationManagementFamilyPdu(), - _requestID(0), - _padding1(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 19 ); -} - -SetDataPdu::~SetDataPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int SetDataPdu::getRequestID() const -{ - return _requestID; -} - -void SetDataPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int SetDataPdu::getPadding1() const -{ - return _padding1; -} - -void SetDataPdu::setPadding1(unsigned int pX) -{ - _padding1 = pX; -} - -unsigned int SetDataPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int SetDataPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& SetDataPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& SetDataPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void SetDataPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& SetDataPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& SetDataPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void SetDataPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void SetDataPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _padding1; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void SetDataPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _padding1; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool SetDataPdu::operator ==(const SetDataPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int SetDataPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _padding1 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SetDataPdu.h b/src/dis6/SetDataPdu.h deleted file mode 100644 index 8c2f7716..00000000 --- a/src/dis6/SetDataPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6.9. Change state information with the data contained in this. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SetDataPdu : public SimulationManagementFamilyPdu -{ -protected: - /** ID of request */ - unsigned int _requestID; - - /** padding */ - unsigned int _padding1; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - SetDataPdu(); - virtual ~SetDataPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getPadding1() const; - void setPadding1(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SetDataPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SetDataReliablePdu.cpp b/src/dis6/SetDataReliablePdu.cpp deleted file mode 100644 index 494d1151..00000000 --- a/src/dis6/SetDataReliablePdu.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include - -using namespace DIS; - - -SetDataReliablePdu::SetDataReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 59 ); -} - -SetDataReliablePdu::~SetDataReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned char SetDataReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void SetDataReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short SetDataReliablePdu::getPad1() const -{ - return _pad1; -} - -void SetDataReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char SetDataReliablePdu::getPad2() const -{ - return _pad2; -} - -void SetDataReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int SetDataReliablePdu::getRequestID() const -{ - return _requestID; -} - -void SetDataReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int SetDataReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int SetDataReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& SetDataReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& SetDataReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void SetDataReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& SetDataReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& SetDataReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void SetDataReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void SetDataReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void SetDataReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool SetDataReliablePdu::operator ==(const SetDataReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int SetDataReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SetDataReliablePdu.h b/src/dis6/SetDataReliablePdu.h deleted file mode 100644 index c496ef67..00000000 --- a/src/dis6/SetDataReliablePdu.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.9: initializing or chaning internal state information, reliable. Needs manual intervention to fix padding on variable datums. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SetDataReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Request ID */ - unsigned int _requestID; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - SetDataReliablePdu(); - virtual ~SetDataReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SetDataReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SetRecordReliablePdu.cpp b/src/dis6/SetRecordReliablePdu.cpp deleted file mode 100644 index 98d44c87..00000000 --- a/src/dis6/SetRecordReliablePdu.cpp +++ /dev/null @@ -1,186 +0,0 @@ -#include - -using namespace DIS; - - -SetRecordReliablePdu::SetRecordReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requestID(0), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _numberOfRecordSets(0) -{ - setPduType( 64 ); -} - -SetRecordReliablePdu::~SetRecordReliablePdu() -{ - _recordSets.clear(); -} - -unsigned int SetRecordReliablePdu::getRequestID() const -{ - return _requestID; -} - -void SetRecordReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned char SetRecordReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void SetRecordReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short SetRecordReliablePdu::getPad1() const -{ - return _pad1; -} - -void SetRecordReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char SetRecordReliablePdu::getPad2() const -{ - return _pad2; -} - -void SetRecordReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int SetRecordReliablePdu::getNumberOfRecordSets() const -{ - return _recordSets.size(); -} - -std::vector& SetRecordReliablePdu::getRecordSets() -{ - return _recordSets; -} - -const std::vector& SetRecordReliablePdu::getRecordSets() const -{ - return _recordSets; -} - -void SetRecordReliablePdu::setRecordSets(const std::vector& pX) -{ - _recordSets = pX; -} - -void SetRecordReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << ( unsigned int )_recordSets.size(); - - for(size_t idx = 0; idx < _recordSets.size(); idx++) - { - RecordSet x = _recordSets[idx]; - x.marshal(dataStream); - } - -} - -void SetRecordReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _numberOfRecordSets; - - _recordSets.clear(); - for(size_t idx = 0; idx < _numberOfRecordSets; idx++) - { - RecordSet x; - x.unmarshal(dataStream); - _recordSets.push_back(x); - } -} - - -bool SetRecordReliablePdu::operator ==(const SetRecordReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _recordSets.size(); idx++) - { - if( ! ( _recordSets[idx] == rhs._recordSets[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int SetRecordReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _numberOfRecordSets - - for(unsigned long long idx=0; idx < _recordSets.size(); idx++) - { - RecordSet listElement = _recordSets[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SetRecordReliablePdu.h b/src/dis6/SetRecordReliablePdu.h deleted file mode 100644 index 7ed85078..00000000 --- a/src/dis6/SetRecordReliablePdu.h +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.14: Initializing or changing internal parameter info. Needs manual intervention to fix padding in recrod set PDUs. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SetRecordReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** request ID */ - unsigned int _requestID; - - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding. The spec is unclear and contradictory here. */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Number of record sets in list */ - unsigned int _numberOfRecordSets; - - /** record sets */ - std::vector _recordSets; - - - public: - SetRecordReliablePdu(); - virtual ~SetRecordReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getNumberOfRecordSets() const; - - std::vector& getRecordSets(); - const std::vector& getRecordSets() const; - void setRecordSets(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SetRecordReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ShaftRPMs.cpp b/src/dis6/ShaftRPMs.cpp deleted file mode 100644 index b1c06112..00000000 --- a/src/dis6/ShaftRPMs.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -ShaftRPMs::ShaftRPMs(): - _currentShaftRPMs(0), - _orderedShaftRPMs(0), - _shaftRPMRateOfChange(0.0) -{ -} - -ShaftRPMs::~ShaftRPMs() -{ -} - -short ShaftRPMs::getCurrentShaftRPMs() const -{ - return _currentShaftRPMs; -} - -void ShaftRPMs::setCurrentShaftRPMs(short pX) -{ - _currentShaftRPMs = pX; -} - -short ShaftRPMs::getOrderedShaftRPMs() const -{ - return _orderedShaftRPMs; -} - -void ShaftRPMs::setOrderedShaftRPMs(short pX) -{ - _orderedShaftRPMs = pX; -} - -float ShaftRPMs::getShaftRPMRateOfChange() const -{ - return _shaftRPMRateOfChange; -} - -void ShaftRPMs::setShaftRPMRateOfChange(float pX) -{ - _shaftRPMRateOfChange = pX; -} - -void ShaftRPMs::marshal(DataStream& dataStream) const -{ - dataStream << _currentShaftRPMs; - dataStream << _orderedShaftRPMs; - dataStream << _shaftRPMRateOfChange; -} - -void ShaftRPMs::unmarshal(DataStream& dataStream) -{ - dataStream >> _currentShaftRPMs; - dataStream >> _orderedShaftRPMs; - dataStream >> _shaftRPMRateOfChange; -} - - -bool ShaftRPMs::operator ==(const ShaftRPMs& rhs) const - { - bool ivarsEqual = true; - - if( ! (_currentShaftRPMs == rhs._currentShaftRPMs) ) ivarsEqual = false; - if( ! (_orderedShaftRPMs == rhs._orderedShaftRPMs) ) ivarsEqual = false; - if( ! (_shaftRPMRateOfChange == rhs._shaftRPMRateOfChange) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ShaftRPMs::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _currentShaftRPMs - marshalSize = marshalSize + 2; // _orderedShaftRPMs - marshalSize = marshalSize + 4; // _shaftRPMRateOfChange - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ShaftRPMs.h b/src/dis6/ShaftRPMs.h deleted file mode 100644 index eed83091..00000000 --- a/src/dis6/ShaftRPMs.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Shaft RPMs, used in underwater acoustic clacluations. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT ShaftRPMs -{ -protected: - /** Current shaft RPMs */ - short _currentShaftRPMs; - - /** ordered shaft rpms */ - short _orderedShaftRPMs; - - /** rate of change of shaft RPMs */ - float _shaftRPMRateOfChange; - - - public: - ShaftRPMs(); - virtual ~ShaftRPMs(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - short getCurrentShaftRPMs() const; - void setCurrentShaftRPMs(short pX); - - short getOrderedShaftRPMs() const; - void setOrderedShaftRPMs(short pX); - - float getShaftRPMRateOfChange() const; - void setShaftRPMRateOfChange(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ShaftRPMs& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SignalPdu.cpp b/src/dis6/SignalPdu.cpp deleted file mode 100644 index 57ef309e..00000000 --- a/src/dis6/SignalPdu.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include "dis6/SignalPdu.h" - -using namespace DIS; - -SignalPdu::SignalPdu() - : RadioCommunicationsFamilyPdu(), _encodingScheme(0), _tdlType(0), - _sampleRate(0), _dataLength(0), _samples(0) { - setPduType(26); -} - -SignalPdu::~SignalPdu() { _data.clear(); } - -unsigned short SignalPdu::getEncodingScheme() const { return _encodingScheme; } - -void SignalPdu::setEncodingScheme(unsigned short pX) { _encodingScheme = pX; } - -unsigned short SignalPdu::getTdlType() const { return _tdlType; } - -void SignalPdu::setTdlType(unsigned short pX) { _tdlType = pX; } - -unsigned int SignalPdu::getSampleRate() const { return _sampleRate; } - -void SignalPdu::setSampleRate(unsigned int pX) { _sampleRate = pX; } - -short SignalPdu::getDataLength() const { return _data.size(); } - -short SignalPdu::getSamples() const { return _samples; } - -void SignalPdu::setSamples(short pX) { _samples = pX; } - -std::vector &SignalPdu::getData() { return _data; } - -const std::vector &SignalPdu::getData() const { return _data; } - -void SignalPdu::setData(const std::vector &pX) { _data = pX; } - -void SignalPdu::marshal(DataStream &dataStream) const { - RadioCommunicationsFamilyPdu::marshal( - dataStream); // Marshal information in superclass first - dataStream << _encodingScheme; - dataStream << _tdlType; - dataStream << _sampleRate; - dataStream << (short)_data.size(); - dataStream << _samples; - for (auto byte : _data) { - dataStream << byte; - } -} - -void SignalPdu::unmarshal(DataStream &dataStream) { - RadioCommunicationsFamilyPdu::unmarshal( - dataStream); // unmarshal information in superclass first - dataStream >> _encodingScheme; - dataStream >> _tdlType; - dataStream >> _sampleRate; - dataStream >> _dataLength; - dataStream >> _samples; - - _data.clear(); - for (auto idx = 0; idx < _dataLength; ++idx) { - uint8_t x; - dataStream >> x; - _data.push_back(x); - } -} - -bool SignalPdu::operator==(const SignalPdu &rhs) const { - auto ivarsEqual = true; - - ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs) && - _encodingScheme == rhs._encodingScheme && - _tdlType == rhs._tdlType && _sampleRate == rhs._sampleRate && - _samples == rhs._samples && _data == rhs._data; - - return ivarsEqual; -} - -int SignalPdu::getMarshalledSize() const { - auto marshalSize = 0; - - marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); - marshalSize += 2; // _encodingScheme - marshalSize += 2; // _tdlType - marshalSize += 4; // _sampleRate - marshalSize += 2; // _dataLength - marshalSize += 2; // _samples - marshalSize += _data.size(); - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SignalPdu.h b/src/dis6/SignalPdu.h deleted file mode 100644 index a0ee3889..00000000 --- a/src/dis6/SignalPdu.h +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#include "dis6/RadioCommunicationsFamilyPdu.h" -#include "dis6/opendis6_export.h" -#include "dis6/utils/DataStream.h" -#include -#include - -namespace DIS { -// Section 5.3.8.2. Detailed information about a radio transmitter. This PDU -// requires manually written code to complete. The encodingScheme field -// can be used in multiple ways, which requires hand-written code to -// finish. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All -// rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SignalPdu : public RadioCommunicationsFamilyPdu { -protected: - /** encoding scheme used, and enumeration */ - unsigned short _encodingScheme; - - /** tdl type */ - unsigned short _tdlType; - - /** sample rate */ - unsigned int _sampleRate; - - /** length od data */ - short _dataLength; - - /** number of samples */ - short _samples; - - /** list of eight bit values */ - std::vector _data; - -public: - SignalPdu(); - virtual ~SignalPdu(); - - virtual void marshal(DataStream &dataStream) const; - virtual void unmarshal(DataStream &dataStream); - - unsigned short getEncodingScheme() const; - void setEncodingScheme(unsigned short pX); - - unsigned short getTdlType() const; - void setTdlType(unsigned short pX); - - unsigned int getSampleRate() const; - void setSampleRate(unsigned int pX); - - short getDataLength() const; - - short getSamples() const; - void setSamples(short pX); - - std::vector &getData(); - const std::vector &getData() const; - void setData(const std::vector &pX); - - virtual int getMarshalledSize() const; - - bool operator==(const SignalPdu &rhs) const; -}; -} // namespace DIS - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SimulationAddress.cpp b/src/dis6/SimulationAddress.cpp deleted file mode 100644 index ef20c1b6..00000000 --- a/src/dis6/SimulationAddress.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -SimulationAddress::SimulationAddress(): - _site(0), - _application(0) -{ -} - -SimulationAddress::~SimulationAddress() -{ -} - -unsigned short SimulationAddress::getSite() const -{ - return _site; -} - -void SimulationAddress::setSite(unsigned short pX) -{ - _site = pX; -} - -unsigned short SimulationAddress::getApplication() const -{ - return _application; -} - -void SimulationAddress::setApplication(unsigned short pX) -{ - _application = pX; -} - -void SimulationAddress::marshal(DataStream& dataStream) const -{ - dataStream << _site; - dataStream << _application; -} - -void SimulationAddress::unmarshal(DataStream& dataStream) -{ - dataStream >> _site; - dataStream >> _application; -} - - -bool SimulationAddress::operator ==(const SimulationAddress& rhs) const - { - bool ivarsEqual = true; - - if( ! (_site == rhs._site) ) ivarsEqual = false; - if( ! (_application == rhs._application) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SimulationAddress::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _site - marshalSize = marshalSize + 2; // _application - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SimulationAddress.h b/src/dis6/SimulationAddress.h deleted file mode 100644 index e26f0577..00000000 --- a/src/dis6/SimulationAddress.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.14.1. A Simulation Address record shall consist of the Site Identification number and the Application Identification number. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SimulationAddress -{ -protected: - /** The site ID */ - unsigned short _site; - - /** The application ID */ - unsigned short _application; - - - public: - SimulationAddress(); - virtual ~SimulationAddress(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSite() const; - void setSite(unsigned short pX); - - unsigned short getApplication() const; - void setApplication(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SimulationAddress& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SimulationManagementFamilyPdu.cpp b/src/dis6/SimulationManagementFamilyPdu.cpp deleted file mode 100644 index 31417b1b..00000000 --- a/src/dis6/SimulationManagementFamilyPdu.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -using namespace DIS; - - -SimulationManagementFamilyPdu::SimulationManagementFamilyPdu() : Pdu(), - _originatingEntityID(), - _receivingEntityID() -{ - setProtocolFamily( 5 ); -} - -SimulationManagementFamilyPdu::~SimulationManagementFamilyPdu() -{ -} - -EntityID& SimulationManagementFamilyPdu::getOriginatingEntityID() -{ - return _originatingEntityID; -} - -const EntityID& SimulationManagementFamilyPdu::getOriginatingEntityID() const -{ - return _originatingEntityID; -} - -void SimulationManagementFamilyPdu::setOriginatingEntityID(const EntityID &pX) -{ - _originatingEntityID = pX; -} - -EntityID& SimulationManagementFamilyPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& SimulationManagementFamilyPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void SimulationManagementFamilyPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -void SimulationManagementFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first - _originatingEntityID.marshal(dataStream); - _receivingEntityID.marshal(dataStream); -} - -void SimulationManagementFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingEntityID.unmarshal(dataStream); - _receivingEntityID.unmarshal(dataStream); -} - - -bool SimulationManagementFamilyPdu::operator ==(const SimulationManagementFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - if( ! (_originatingEntityID == rhs._originatingEntityID) ) ivarsEqual = false; - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SimulationManagementFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingEntityID.getMarshalledSize(); // _originatingEntityID - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SimulationManagementFamilyPdu.h b/src/dis6/SimulationManagementFamilyPdu.h deleted file mode 100644 index 380f47e6..00000000 --- a/src/dis6/SimulationManagementFamilyPdu.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.6. Abstract superclass for PDUs relating to the simulation itself. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SimulationManagementFamilyPdu : public Pdu -{ -protected: - /** Entity that is sending message */ - EntityID _originatingEntityID; - - /** Entity that is intended to receive message */ - EntityID _receivingEntityID; - - - public: - SimulationManagementFamilyPdu(); - virtual ~SimulationManagementFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingEntityID(); - const EntityID& getOriginatingEntityID() const; - void setOriginatingEntityID(const EntityID &pX); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SimulationManagementFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SimulationManagementWithReliabilityFamilyPdu.cpp b/src/dis6/SimulationManagementWithReliabilityFamilyPdu.cpp deleted file mode 100644 index ce3624a3..00000000 --- a/src/dis6/SimulationManagementWithReliabilityFamilyPdu.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -using namespace DIS; - - -SimulationManagementWithReliabilityFamilyPdu::SimulationManagementWithReliabilityFamilyPdu() : Pdu(), - _originatingEntityID(), - _receivingEntityID() -{ - setProtocolFamily( 10 ); -} - -SimulationManagementWithReliabilityFamilyPdu::~SimulationManagementWithReliabilityFamilyPdu() -{ -} - -EntityID& SimulationManagementWithReliabilityFamilyPdu::getOriginatingEntityID() -{ - return _originatingEntityID; -} - -const EntityID& SimulationManagementWithReliabilityFamilyPdu::getOriginatingEntityID() const -{ - return _originatingEntityID; -} - -void SimulationManagementWithReliabilityFamilyPdu::setOriginatingEntityID(const EntityID &pX) -{ - _originatingEntityID = pX; -} - -EntityID& SimulationManagementWithReliabilityFamilyPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& SimulationManagementWithReliabilityFamilyPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void SimulationManagementWithReliabilityFamilyPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -void SimulationManagementWithReliabilityFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first - _originatingEntityID.marshal(dataStream); - _receivingEntityID.marshal(dataStream); -} - -void SimulationManagementWithReliabilityFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingEntityID.unmarshal(dataStream); - _receivingEntityID.unmarshal(dataStream); -} - - -bool SimulationManagementWithReliabilityFamilyPdu::operator ==(const SimulationManagementWithReliabilityFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - if( ! (_originatingEntityID == rhs._originatingEntityID) ) ivarsEqual = false; - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingEntityID.getMarshalledSize(); // _originatingEntityID - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SimulationManagementWithReliabilityFamilyPdu.h b/src/dis6/SimulationManagementWithReliabilityFamilyPdu.h deleted file mode 100644 index b4c8aff2..00000000 --- a/src/dis6/SimulationManagementWithReliabilityFamilyPdu.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12: Abstract superclass for reliable simulation management PDUs - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SimulationManagementWithReliabilityFamilyPdu : public Pdu -{ -protected: - /** Object originatig the request */ - EntityID _originatingEntityID; - - /** Object with which this point object is associated */ - EntityID _receivingEntityID; - - - public: - SimulationManagementWithReliabilityFamilyPdu(); - virtual ~SimulationManagementWithReliabilityFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingEntityID(); - const EntityID& getOriginatingEntityID() const; - void setOriginatingEntityID(const EntityID &pX); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SimulationManagementWithReliabilityFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SixByteChunk.cpp b/src/dis6/SixByteChunk.cpp deleted file mode 100644 index e6aaf57c..00000000 --- a/src/dis6/SixByteChunk.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -using namespace DIS; - - -SixByteChunk::SixByteChunk() -{ - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 6; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - -} - -SixByteChunk::~SixByteChunk() -{ -} - -char* SixByteChunk::getOtherParameters() -{ - return _otherParameters; -} - -const char* SixByteChunk::getOtherParameters() const -{ - return _otherParameters; -} - -void SixByteChunk::setOtherParameters(const char* x) -{ - for(int i = 0; i < 6; i++) - { - _otherParameters[i] = x[i]; - } -} - -void SixByteChunk::marshal(DataStream& dataStream) const -{ - - for(size_t idx = 0; idx < 6; idx++) - { - dataStream << _otherParameters[idx]; - } - -} - -void SixByteChunk::unmarshal(DataStream& dataStream) -{ - - for(size_t idx = 0; idx < 6; idx++) - { - dataStream >> _otherParameters[idx]; - } - -} - - -bool SixByteChunk::operator ==(const SixByteChunk& rhs) const - { - bool ivarsEqual = true; - - - for(unsigned char idx = 0; idx < 6; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int SixByteChunk::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 6 * 1; // _otherParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SphericalHarmonicAntennaPattern.cpp b/src/dis6/SphericalHarmonicAntennaPattern.cpp deleted file mode 100644 index 4d76dc09..00000000 --- a/src/dis6/SphericalHarmonicAntennaPattern.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include - -using namespace DIS; - - -SphericalHarmonicAntennaPattern::SphericalHarmonicAntennaPattern(): - _order(0) -{ -} - -SphericalHarmonicAntennaPattern::~SphericalHarmonicAntennaPattern() -{ -} - -char SphericalHarmonicAntennaPattern::getOrder() const -{ - return _order; -} - -void SphericalHarmonicAntennaPattern::setOrder(char pX) -{ - _order = pX; -} - -void SphericalHarmonicAntennaPattern::marshal(DataStream& dataStream) const -{ - dataStream << _order; -} - -void SphericalHarmonicAntennaPattern::unmarshal(DataStream& dataStream) -{ - dataStream >> _order; -} - - -bool SphericalHarmonicAntennaPattern::operator ==(const SphericalHarmonicAntennaPattern& rhs) const - { - bool ivarsEqual = true; - - if( ! (_order == rhs._order) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SphericalHarmonicAntennaPattern::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _order - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SphericalHarmonicAntennaPattern.h b/src/dis6/SphericalHarmonicAntennaPattern.h deleted file mode 100644 index a3bc5097..00000000 --- a/src/dis6/SphericalHarmonicAntennaPattern.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.4.3. Used when the antenna pattern type in the transmitter pdu is of value 2. Specified the direction and radiation pattern from a radio transmitter's antenna. NOTE: this class must be hand-coded to clean up some implementation details. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SphericalHarmonicAntennaPattern -{ -protected: - char _order; - - - public: - SphericalHarmonicAntennaPattern(); - virtual ~SphericalHarmonicAntennaPattern(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - char getOrder() const; - void setOrder(char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SphericalHarmonicAntennaPattern& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/StartResumePdu.cpp b/src/dis6/StartResumePdu.cpp deleted file mode 100644 index d2b61445..00000000 --- a/src/dis6/StartResumePdu.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include - -using namespace DIS; - - -StartResumePdu::StartResumePdu() : SimulationManagementFamilyPdu(), - _realWorldTime(), - _simulationTime(), - _requestID(0) -{ - setPduType( 13 ); -} - -StartResumePdu::~StartResumePdu() -{ -} - -ClockTime& StartResumePdu::getRealWorldTime() -{ - return _realWorldTime; -} - -const ClockTime& StartResumePdu::getRealWorldTime() const -{ - return _realWorldTime; -} - -void StartResumePdu::setRealWorldTime(const ClockTime &pX) -{ - _realWorldTime = pX; -} - -ClockTime& StartResumePdu::getSimulationTime() -{ - return _simulationTime; -} - -const ClockTime& StartResumePdu::getSimulationTime() const -{ - return _simulationTime; -} - -void StartResumePdu::setSimulationTime(const ClockTime &pX) -{ - _simulationTime = pX; -} - -unsigned int StartResumePdu::getRequestID() const -{ - return _requestID; -} - -void StartResumePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void StartResumePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _realWorldTime.marshal(dataStream); - _simulationTime.marshal(dataStream); - dataStream << _requestID; -} - -void StartResumePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _realWorldTime.unmarshal(dataStream); - _simulationTime.unmarshal(dataStream); - dataStream >> _requestID; -} - - -bool StartResumePdu::operator ==(const StartResumePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_realWorldTime == rhs._realWorldTime) ) ivarsEqual = false; - if( ! (_simulationTime == rhs._simulationTime) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StartResumePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime - marshalSize = marshalSize + _simulationTime.getMarshalledSize(); // _simulationTime - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/StartResumePdu.h b/src/dis6/StartResumePdu.h deleted file mode 100644 index ebe8ccc8..00000000 --- a/src/dis6/StartResumePdu.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.2.6.3. Start or resume an exercise. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT StartResumePdu : public SimulationManagementFamilyPdu -{ -protected: - /** UTC time at which the simulation shall start or resume */ - ClockTime _realWorldTime; - - /** Simulation clock time at which the simulation shall start or resume */ - ClockTime _simulationTime; - - /** Identifier for the request */ - unsigned int _requestID; - - - public: - StartResumePdu(); - virtual ~StartResumePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - ClockTime& getRealWorldTime(); - const ClockTime& getRealWorldTime() const; - void setRealWorldTime(const ClockTime &pX); - - ClockTime& getSimulationTime(); - const ClockTime& getSimulationTime() const; - void setSimulationTime(const ClockTime &pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StartResumePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/StartResumeReliablePdu.cpp b/src/dis6/StartResumeReliablePdu.cpp deleted file mode 100644 index 650b243d..00000000 --- a/src/dis6/StartResumeReliablePdu.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include - -using namespace DIS; - - -StartResumeReliablePdu::StartResumeReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _realWorldTime(), - _simulationTime(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0) -{ - setPduType( 53 ); -} - -StartResumeReliablePdu::~StartResumeReliablePdu() -{ -} - -ClockTime& StartResumeReliablePdu::getRealWorldTime() -{ - return _realWorldTime; -} - -const ClockTime& StartResumeReliablePdu::getRealWorldTime() const -{ - return _realWorldTime; -} - -void StartResumeReliablePdu::setRealWorldTime(const ClockTime &pX) -{ - _realWorldTime = pX; -} - -ClockTime& StartResumeReliablePdu::getSimulationTime() -{ - return _simulationTime; -} - -const ClockTime& StartResumeReliablePdu::getSimulationTime() const -{ - return _simulationTime; -} - -void StartResumeReliablePdu::setSimulationTime(const ClockTime &pX) -{ - _simulationTime = pX; -} - -unsigned char StartResumeReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void StartResumeReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short StartResumeReliablePdu::getPad1() const -{ - return _pad1; -} - -void StartResumeReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char StartResumeReliablePdu::getPad2() const -{ - return _pad2; -} - -void StartResumeReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int StartResumeReliablePdu::getRequestID() const -{ - return _requestID; -} - -void StartResumeReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void StartResumeReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _realWorldTime.marshal(dataStream); - _simulationTime.marshal(dataStream); - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; -} - -void StartResumeReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _realWorldTime.unmarshal(dataStream); - _simulationTime.unmarshal(dataStream); - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; -} - - -bool StartResumeReliablePdu::operator ==(const StartResumeReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_realWorldTime == rhs._realWorldTime) ) ivarsEqual = false; - if( ! (_simulationTime == rhs._simulationTime) ) ivarsEqual = false; - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StartResumeReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime - marshalSize = marshalSize + _simulationTime.getMarshalledSize(); // _simulationTime - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/StartResumeReliablePdu.h b/src/dis6/StartResumeReliablePdu.h deleted file mode 100644 index 3e5c797f..00000000 --- a/src/dis6/StartResumeReliablePdu.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.3: Start resume simulation, relaible. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT StartResumeReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** time in real world for this operation to happen */ - ClockTime _realWorldTime; - - /** time in simulation for the simulation to resume */ - ClockTime _simulationTime; - - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Request ID */ - unsigned int _requestID; - - - public: - StartResumeReliablePdu(); - virtual ~StartResumeReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - ClockTime& getRealWorldTime(); - const ClockTime& getRealWorldTime() const; - void setRealWorldTime(const ClockTime &pX); - - ClockTime& getSimulationTime(); - const ClockTime& getSimulationTime() const; - void setSimulationTime(const ClockTime &pX); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StartResumeReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/StopFreezePdu.cpp b/src/dis6/StopFreezePdu.cpp deleted file mode 100644 index c54d93fb..00000000 --- a/src/dis6/StopFreezePdu.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include - -using namespace DIS; - - -StopFreezePdu::StopFreezePdu() : SimulationManagementFamilyPdu(), - _realWorldTime(), - _reason(0), - _frozenBehavior(0), - _padding1(0), - _requestID(0) -{ - setPduType( 14 ); -} - -StopFreezePdu::~StopFreezePdu() -{ -} - -ClockTime& StopFreezePdu::getRealWorldTime() -{ - return _realWorldTime; -} - -const ClockTime& StopFreezePdu::getRealWorldTime() const -{ - return _realWorldTime; -} - -void StopFreezePdu::setRealWorldTime(const ClockTime &pX) -{ - _realWorldTime = pX; -} - -unsigned char StopFreezePdu::getReason() const -{ - return _reason; -} - -void StopFreezePdu::setReason(unsigned char pX) -{ - _reason = pX; -} - -unsigned char StopFreezePdu::getFrozenBehavior() const -{ - return _frozenBehavior; -} - -void StopFreezePdu::setFrozenBehavior(unsigned char pX) -{ - _frozenBehavior = pX; -} - -short StopFreezePdu::getPadding1() const -{ - return _padding1; -} - -void StopFreezePdu::setPadding1(short pX) -{ - _padding1 = pX; -} - -unsigned int StopFreezePdu::getRequestID() const -{ - return _requestID; -} - -void StopFreezePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -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; -} - - -bool StopFreezePdu::operator ==(const StopFreezePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_realWorldTime == rhs._realWorldTime) ) ivarsEqual = false; - if( ! (_reason == rhs._reason) ) ivarsEqual = false; - if( ! (_frozenBehavior == rhs._frozenBehavior) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StopFreezePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime - marshalSize = marshalSize + 1; // _reason - marshalSize = marshalSize + 1; // _frozenBehavior - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/StopFreezePdu.h b/src/dis6/StopFreezePdu.h deleted file mode 100644 index 78eae2fa..00000000 --- a/src/dis6/StopFreezePdu.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.2.3.4. Stop or freeze an exercise. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT StopFreezePdu : public SimulationManagementFamilyPdu -{ -protected: - /** UTC time at which the simulation shall stop or freeze */ - ClockTime _realWorldTime; - - /** Reason the simulation was stopped or frozen */ - unsigned char _reason; - - /** Internal behavior of the simulation and its appearance while frozento the other participants */ - unsigned char _frozenBehavior; - - /** padding */ - short _padding1; - - /** Request ID that is unique */ - unsigned int _requestID; - - - public: - StopFreezePdu(); - virtual ~StopFreezePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - ClockTime& getRealWorldTime(); - const ClockTime& getRealWorldTime() const; - void setRealWorldTime(const ClockTime &pX); - - unsigned char getReason() const; - void setReason(unsigned char pX); - - unsigned char getFrozenBehavior() const; - void setFrozenBehavior(unsigned char pX); - - short getPadding1() const; - void setPadding1(short pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StopFreezePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/StopFreezeReliablePdu.cpp b/src/dis6/StopFreezeReliablePdu.cpp deleted file mode 100644 index 3eccfb64..00000000 --- a/src/dis6/StopFreezeReliablePdu.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#include - -using namespace DIS; - - -StopFreezeReliablePdu::StopFreezeReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _realWorldTime(), - _reason(0), - _frozenBehavior(0), - _requiredReliablityService(0), - _pad1(0), - _requestID(0) -{ - setPduType( 54 ); -} - -StopFreezeReliablePdu::~StopFreezeReliablePdu() -{ -} - -ClockTime& StopFreezeReliablePdu::getRealWorldTime() -{ - return _realWorldTime; -} - -const ClockTime& StopFreezeReliablePdu::getRealWorldTime() const -{ - return _realWorldTime; -} - -void StopFreezeReliablePdu::setRealWorldTime(const ClockTime &pX) -{ - _realWorldTime = pX; -} - -unsigned char StopFreezeReliablePdu::getReason() const -{ - return _reason; -} - -void StopFreezeReliablePdu::setReason(unsigned char pX) -{ - _reason = pX; -} - -unsigned char StopFreezeReliablePdu::getFrozenBehavior() const -{ - return _frozenBehavior; -} - -void StopFreezeReliablePdu::setFrozenBehavior(unsigned char pX) -{ - _frozenBehavior = pX; -} - -unsigned char StopFreezeReliablePdu::getRequiredReliablityService() const -{ - return _requiredReliablityService; -} - -void StopFreezeReliablePdu::setRequiredReliablityService(unsigned char pX) -{ - _requiredReliablityService = pX; -} - -unsigned char StopFreezeReliablePdu::getPad1() const -{ - return _pad1; -} - -void StopFreezeReliablePdu::setPad1(unsigned char pX) -{ - _pad1 = pX; -} - -unsigned int StopFreezeReliablePdu::getRequestID() const -{ - return _requestID; -} - -void StopFreezeReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void StopFreezeReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _realWorldTime.marshal(dataStream); - dataStream << _reason; - dataStream << _frozenBehavior; - dataStream << _requiredReliablityService; - dataStream << _pad1; - dataStream << _requestID; -} - -void StopFreezeReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _realWorldTime.unmarshal(dataStream); - dataStream >> _reason; - dataStream >> _frozenBehavior; - dataStream >> _requiredReliablityService; - dataStream >> _pad1; - dataStream >> _requestID; -} - - -bool StopFreezeReliablePdu::operator ==(const StopFreezeReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_realWorldTime == rhs._realWorldTime) ) ivarsEqual = false; - if( ! (_reason == rhs._reason) ) ivarsEqual = false; - if( ! (_frozenBehavior == rhs._frozenBehavior) ) ivarsEqual = false; - if( ! (_requiredReliablityService == rhs._requiredReliablityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StopFreezeReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime - marshalSize = marshalSize + 1; // _reason - marshalSize = marshalSize + 1; // _frozenBehavior - marshalSize = marshalSize + 1; // _requiredReliablityService - marshalSize = marshalSize + 1; // _pad1 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/StopFreezeReliablePdu.h b/src/dis6/StopFreezeReliablePdu.h deleted file mode 100644 index edff740d..00000000 --- a/src/dis6/StopFreezeReliablePdu.h +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.4: Stop freeze simulation, relaible. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT StopFreezeReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** time in real world for this operation to happen */ - ClockTime _realWorldTime; - - /** Reason for stopping/freezing simulation */ - unsigned char _reason; - - /** internal behvior of the simulation while frozen */ - unsigned char _frozenBehavior; - - /** reliablity level */ - unsigned char _requiredReliablityService; - - /** padding */ - unsigned char _pad1; - - /** Request ID */ - unsigned int _requestID; - - - public: - StopFreezeReliablePdu(); - virtual ~StopFreezeReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - ClockTime& getRealWorldTime(); - const ClockTime& getRealWorldTime() const; - void setRealWorldTime(const ClockTime &pX); - - unsigned char getReason() const; - void setReason(unsigned char pX); - - unsigned char getFrozenBehavior() const; - void setFrozenBehavior(unsigned char pX); - - unsigned char getRequiredReliablityService() const; - void setRequiredReliablityService(unsigned char pX); - - unsigned char getPad1() const; - void setPad1(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StopFreezeReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SupplyQuantity.cpp b/src/dis6/SupplyQuantity.cpp deleted file mode 100644 index b54a4574..00000000 --- a/src/dis6/SupplyQuantity.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -SupplyQuantity::SupplyQuantity(): - _supplyType(), - _quantity(0) -{ -} - -SupplyQuantity::~SupplyQuantity() -{ -} - -EntityType& SupplyQuantity::getSupplyType() -{ - return _supplyType; -} - -const EntityType& SupplyQuantity::getSupplyType() const -{ - return _supplyType; -} - -void SupplyQuantity::setSupplyType(const EntityType &pX) -{ - _supplyType = pX; -} - -unsigned char SupplyQuantity::getQuantity() const -{ - return _quantity; -} - -void SupplyQuantity::setQuantity(unsigned char pX) -{ - _quantity = pX; -} - -void SupplyQuantity::marshal(DataStream& dataStream) const -{ - _supplyType.marshal(dataStream); - dataStream << _quantity; -} - -void SupplyQuantity::unmarshal(DataStream& dataStream) -{ - _supplyType.unmarshal(dataStream); - dataStream >> _quantity; -} - - -bool SupplyQuantity::operator ==(const SupplyQuantity& rhs) const - { - bool ivarsEqual = true; - - if( ! (_supplyType == rhs._supplyType) ) ivarsEqual = false; - if( ! (_quantity == rhs._quantity) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SupplyQuantity::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _supplyType.getMarshalledSize(); // _supplyType - marshalSize = marshalSize + 1; // _quantity - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SupplyQuantity.h b/src/dis6/SupplyQuantity.h deleted file mode 100644 index 6c8c47c9..00000000 --- a/src/dis6/SupplyQuantity.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.2.30. A supply, and the amount of that supply. Similar to an entity kind but with the addition of a quantity. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SupplyQuantity -{ -protected: - /** Type of supply */ - EntityType _supplyType; - - /** quantity to be supplied */ - unsigned char _quantity; - - - public: - SupplyQuantity(); - virtual ~SupplyQuantity(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getSupplyType(); - const EntityType& getSupplyType() const; - void setSupplyType(const EntityType &pX); - - unsigned char getQuantity() const; - void setQuantity(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SupplyQuantity& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SyntheticEnvironmentFamilyPdu.cpp b/src/dis6/SyntheticEnvironmentFamilyPdu.cpp deleted file mode 100644 index 89fae3aa..00000000 --- a/src/dis6/SyntheticEnvironmentFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -SyntheticEnvironmentFamilyPdu::SyntheticEnvironmentFamilyPdu() : Pdu() - -{ - setProtocolFamily( 9 ); -} - -SyntheticEnvironmentFamilyPdu::~SyntheticEnvironmentFamilyPdu() -{ -} - -void SyntheticEnvironmentFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void SyntheticEnvironmentFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool SyntheticEnvironmentFamilyPdu::operator ==(const SyntheticEnvironmentFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int SyntheticEnvironmentFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SyntheticEnvironmentFamilyPdu.h b/src/dis6/SyntheticEnvironmentFamilyPdu.h deleted file mode 100644 index b9e2b779..00000000 --- a/src/dis6/SyntheticEnvironmentFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.11: Abstract superclass for synthetic environment PDUs - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SyntheticEnvironmentFamilyPdu : public Pdu -{ -protected: - - public: - SyntheticEnvironmentFamilyPdu(); - virtual ~SyntheticEnvironmentFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SyntheticEnvironmentFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SystemID.cpp b/src/dis6/SystemID.cpp deleted file mode 100644 index 938521c8..00000000 --- a/src/dis6/SystemID.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -SystemID::SystemID(): - _systemType(0), - _systemName(0), - _systemMode(0), - _changeOptions(0) -{ -} - -SystemID::~SystemID() -{ -} - -unsigned short SystemID::getSystemType() const -{ - return _systemType; -} - -void SystemID::setSystemType(unsigned short pX) -{ - _systemType = pX; -} - -unsigned short SystemID::getSystemName() const -{ - return _systemName; -} - -void SystemID::setSystemName(unsigned short pX) -{ - _systemName = pX; -} - -unsigned char SystemID::getSystemMode() const -{ - return _systemMode; -} - -void SystemID::setSystemMode(unsigned char pX) -{ - _systemMode = pX; -} - -unsigned char SystemID::getChangeOptions() const -{ - return _changeOptions; -} - -void SystemID::setChangeOptions(unsigned char pX) -{ - _changeOptions = pX; -} - -void SystemID::marshal(DataStream& dataStream) const -{ - dataStream << _systemType; - dataStream << _systemName; - dataStream << _systemMode; - dataStream << _changeOptions; -} - -void SystemID::unmarshal(DataStream& dataStream) -{ - dataStream >> _systemType; - dataStream >> _systemName; - dataStream >> _systemMode; - dataStream >> _changeOptions; -} - - -bool SystemID::operator ==(const SystemID& rhs) const - { - bool ivarsEqual = true; - - if( ! (_systemType == rhs._systemType) ) ivarsEqual = false; - if( ! (_systemName == rhs._systemName) ) ivarsEqual = false; - if( ! (_systemMode == rhs._systemMode) ) ivarsEqual = false; - if( ! (_changeOptions == rhs._changeOptions) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SystemID::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _systemType - marshalSize = marshalSize + 2; // _systemName - marshalSize = marshalSize + 1; // _systemMode - marshalSize = marshalSize + 1; // _changeOptions - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SystemID.h b/src/dis6/SystemID.h deleted file mode 100644 index c4e26627..00000000 --- a/src/dis6/SystemID.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 5.2.58. Used in IFF ATC PDU - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT SystemID -{ -protected: - /** System Type */ - unsigned short _systemType; - - /** System name, an enumeration */ - unsigned short _systemName; - - /** System mode */ - unsigned char _systemMode; - - /** Change Options */ - unsigned char _changeOptions; - - - public: - SystemID(); - virtual ~SystemID(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSystemType() const; - void setSystemType(unsigned short pX); - - unsigned short getSystemName() const; - void setSystemName(unsigned short pX); - - unsigned char getSystemMode() const; - void setSystemMode(unsigned char pX); - - unsigned char getChangeOptions() const; - void setChangeOptions(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SystemID& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/TrackJamTarget.cpp b/src/dis6/TrackJamTarget.cpp deleted file mode 100644 index 837b5833..00000000 --- a/src/dis6/TrackJamTarget.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include - -using namespace DIS; - - -TrackJamTarget::TrackJamTarget(): - _trackJam(), - _emitterID(0), - _beamID(0) -{ -} - -TrackJamTarget::~TrackJamTarget() -{ -} - -EntityID& TrackJamTarget::getTrackJam() -{ - return _trackJam; -} - -const EntityID& TrackJamTarget::getTrackJam() const -{ - return _trackJam; -} - -void TrackJamTarget::setTrackJam(const EntityID &pX) -{ - _trackJam = pX; -} - -unsigned char TrackJamTarget::getEmitterID() const -{ - return _emitterID; -} - -void TrackJamTarget::setEmitterID(unsigned char pX) -{ - _emitterID = pX; -} - -unsigned char TrackJamTarget::getBeamID() const -{ - return _beamID; -} - -void TrackJamTarget::setBeamID(unsigned char pX) -{ - _beamID = pX; -} - -void TrackJamTarget::marshal(DataStream& dataStream) const -{ - _trackJam.marshal(dataStream); - dataStream << _emitterID; - dataStream << _beamID; -} - -void TrackJamTarget::unmarshal(DataStream& dataStream) -{ - _trackJam.unmarshal(dataStream); - dataStream >> _emitterID; - dataStream >> _beamID; -} - - -bool TrackJamTarget::operator ==(const TrackJamTarget& rhs) const - { - bool ivarsEqual = true; - - if( ! (_trackJam == rhs._trackJam) ) ivarsEqual = false; - if( ! (_emitterID == rhs._emitterID) ) ivarsEqual = false; - if( ! (_beamID == rhs._beamID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int TrackJamTarget::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _trackJam.getMarshalledSize(); // _trackJam - marshalSize = marshalSize + 1; // _emitterID - marshalSize = marshalSize + 1; // _beamID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/TrackJamTarget.h b/src/dis6/TrackJamTarget.h deleted file mode 100644 index 5bde9629..00000000 --- a/src/dis6/TrackJamTarget.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// One track/jam target - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT TrackJamTarget -{ -protected: - /** track/jam target */ - EntityID _trackJam; - - /** Emitter ID */ - unsigned char _emitterID; - - /** beam ID */ - unsigned char _beamID; - - - public: - TrackJamTarget(); - virtual ~TrackJamTarget(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getTrackJam(); - const EntityID& getTrackJam() const; - void setTrackJam(const EntityID &pX); - - unsigned char getEmitterID() const; - void setEmitterID(unsigned char pX); - - unsigned char getBeamID() const; - void setBeamID(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const TrackJamTarget& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/TransferControlRequestPdu.cpp b/src/dis6/TransferControlRequestPdu.cpp deleted file mode 100644 index 0d98ee3d..00000000 --- a/src/dis6/TransferControlRequestPdu.cpp +++ /dev/null @@ -1,231 +0,0 @@ -#include - -using namespace DIS; - - -TransferControlRequestPdu::TransferControlRequestPdu() : EntityManagementFamilyPdu(), - _orginatingEntityID(), - _recevingEntityID(), - _requestID(0), - _requiredReliabilityService(0), - _tranferType(0), - _transferEntityID(), - _numberOfRecordSets(0) -{ - setPduType( 35 ); -} - -TransferControlRequestPdu::~TransferControlRequestPdu() -{ - _recordSets.clear(); -} - -EntityID& TransferControlRequestPdu::getOrginatingEntityID() -{ - return _orginatingEntityID; -} - -const EntityID& TransferControlRequestPdu::getOrginatingEntityID() const -{ - return _orginatingEntityID; -} - -void TransferControlRequestPdu::setOrginatingEntityID(const EntityID &pX) -{ - _orginatingEntityID = pX; -} - -EntityID& TransferControlRequestPdu::getRecevingEntityID() -{ - return _recevingEntityID; -} - -const EntityID& TransferControlRequestPdu::getRecevingEntityID() const -{ - return _recevingEntityID; -} - -void TransferControlRequestPdu::setRecevingEntityID(const EntityID &pX) -{ - _recevingEntityID = pX; -} - -unsigned int TransferControlRequestPdu::getRequestID() const -{ - return _requestID; -} - -void TransferControlRequestPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned char TransferControlRequestPdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void TransferControlRequestPdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned char TransferControlRequestPdu::getTranferType() const -{ - return _tranferType; -} - -void TransferControlRequestPdu::setTranferType(unsigned char pX) -{ - _tranferType = pX; -} - -EntityID& TransferControlRequestPdu::getTransferEntityID() -{ - return _transferEntityID; -} - -const EntityID& TransferControlRequestPdu::getTransferEntityID() const -{ - return _transferEntityID; -} - -void TransferControlRequestPdu::setTransferEntityID(const EntityID &pX) -{ - _transferEntityID = pX; -} - -unsigned char TransferControlRequestPdu::getNumberOfRecordSets() const -{ - return _recordSets.size(); -} - -std::vector& TransferControlRequestPdu::getRecordSets() -{ - return _recordSets; -} - -const std::vector& TransferControlRequestPdu::getRecordSets() const -{ - return _recordSets; -} - -void TransferControlRequestPdu::setRecordSets(const std::vector& pX) -{ - _recordSets = pX; -} - -void TransferControlRequestPdu::marshal(DataStream& dataStream) const -{ - EntityManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _orginatingEntityID.marshal(dataStream); - _recevingEntityID.marshal(dataStream); - dataStream << _requestID; - dataStream << _requiredReliabilityService; - dataStream << _tranferType; - _transferEntityID.marshal(dataStream); - dataStream << ( unsigned char )_recordSets.size(); - - for(size_t idx = 0; idx < _recordSets.size(); idx++) - { - RecordSet x = _recordSets[idx]; - x.marshal(dataStream); - } - -} - -void TransferControlRequestPdu::unmarshal(DataStream& dataStream) -{ - EntityManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _orginatingEntityID.unmarshal(dataStream); - _recevingEntityID.unmarshal(dataStream); - dataStream >> _requestID; - dataStream >> _requiredReliabilityService; - dataStream >> _tranferType; - _transferEntityID.unmarshal(dataStream); - dataStream >> _numberOfRecordSets; - - _recordSets.clear(); - for(size_t idx = 0; idx < _numberOfRecordSets; idx++) - { - RecordSet x; - x.unmarshal(dataStream); - _recordSets.push_back(x); - } -} - - -bool TransferControlRequestPdu::operator ==(const TransferControlRequestPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); - - if( ! (_orginatingEntityID == rhs._orginatingEntityID) ) ivarsEqual = false; - if( ! (_recevingEntityID == rhs._recevingEntityID) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_tranferType == rhs._tranferType) ) ivarsEqual = false; - if( ! (_transferEntityID == rhs._transferEntityID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _recordSets.size(); idx++) - { - if( ! ( _recordSets[idx] == rhs._recordSets[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int TransferControlRequestPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID - marshalSize = marshalSize + _recevingEntityID.getMarshalledSize(); // _recevingEntityID - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 1; // _tranferType - marshalSize = marshalSize + _transferEntityID.getMarshalledSize(); // _transferEntityID - marshalSize = marshalSize + 1; // _numberOfRecordSets - - for(unsigned long long idx=0; idx < _recordSets.size(); idx++) - { - RecordSet listElement = _recordSets[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/TransferControlRequestPdu.h b/src/dis6/TransferControlRequestPdu.h deleted file mode 100644 index 53770a7d..00000000 --- a/src/dis6/TransferControlRequestPdu.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.9.3 Information initiating the dyanic allocation and control of simulation entities between two simulation applications. Requires manual cleanup. The padding between record sets is variable. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT TransferControlRequestPdu : public EntityManagementFamilyPdu -{ -protected: - /** ID of entity originating request */ - EntityID _orginatingEntityID; - - /** ID of entity receiving request */ - EntityID _recevingEntityID; - - /** ID ofrequest */ - unsigned int _requestID; - - /** required level of reliabliity service. */ - unsigned char _requiredReliabilityService; - - /** type of transfer desired */ - unsigned char _tranferType; - - /** The entity for which control is being requested to transfer */ - EntityID _transferEntityID; - - /** number of record sets to transfer */ - unsigned char _numberOfRecordSets; - - /** ^^^This is wrong--the RecordSet class needs more work */ - std::vector _recordSets; - - - public: - TransferControlRequestPdu(); - virtual ~TransferControlRequestPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOrginatingEntityID(); - const EntityID& getOrginatingEntityID() const; - void setOrginatingEntityID(const EntityID &pX); - - EntityID& getRecevingEntityID(); - const EntityID& getRecevingEntityID() const; - void setRecevingEntityID(const EntityID &pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned char getTranferType() const; - void setTranferType(unsigned char pX); - - EntityID& getTransferEntityID(); - const EntityID& getTransferEntityID() const; - void setTransferEntityID(const EntityID &pX); - - unsigned char getNumberOfRecordSets() const; - - std::vector& getRecordSets(); - const std::vector& getRecordSets() const; - void setRecordSets(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const TransferControlRequestPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/TransmitterPdu.cpp b/src/dis6/TransmitterPdu.cpp deleted file mode 100644 index b8d455fe..00000000 --- a/src/dis6/TransmitterPdu.cpp +++ /dev/null @@ -1,424 +0,0 @@ -#include - -using namespace DIS; - - -TransmitterPdu::TransmitterPdu() : RadioCommunicationsFamilyPdu(), - _radioEntityType(), - _transmitState(0), - _inputSource(0), - _padding1(0), - _antennaLocation(), - _relativeAntennaLocation(), - _antennaPatternType(0), - _antennaPatternCount(0), - _frequency(0), - _transmitFrequencyBandwidth(0.0), - _power(0.0), - _modulationType(), - _cryptoSystem(0), - _cryptoKeyId(0), - _modulationParameterCount(0), - _padding2(0), - _padding3(0) -{ - setPduType( 25 ); -} - -TransmitterPdu::~TransmitterPdu() -{ - _modulationParametersList.clear(); - _antennaPatternList.clear(); -} - -RadioEntityType& TransmitterPdu::getRadioEntityType() -{ - return _radioEntityType; -} - -const RadioEntityType& TransmitterPdu::getRadioEntityType() const -{ - return _radioEntityType; -} - -void TransmitterPdu::setRadioEntityType(const RadioEntityType &pX) -{ - _radioEntityType = pX; -} - -unsigned char TransmitterPdu::getTransmitState() const -{ - return _transmitState; -} - -void TransmitterPdu::setTransmitState(unsigned char pX) -{ - _transmitState = pX; -} - -unsigned char TransmitterPdu::getInputSource() const -{ - return _inputSource; -} - -void TransmitterPdu::setInputSource(unsigned char pX) -{ - _inputSource = pX; -} - -unsigned short TransmitterPdu::getPadding1() const -{ - return _padding1; -} - -void TransmitterPdu::setPadding1(unsigned short pX) -{ - _padding1 = pX; -} - -Vector3Double& TransmitterPdu::getAntennaLocation() -{ - return _antennaLocation; -} - -const Vector3Double& TransmitterPdu::getAntennaLocation() const -{ - return _antennaLocation; -} - -void TransmitterPdu::setAntennaLocation(const Vector3Double &pX) -{ - _antennaLocation = pX; -} - -Vector3Float& TransmitterPdu::getRelativeAntennaLocation() -{ - return _relativeAntennaLocation; -} - -const Vector3Float& TransmitterPdu::getRelativeAntennaLocation() const -{ - return _relativeAntennaLocation; -} - -void TransmitterPdu::setRelativeAntennaLocation(const Vector3Float &pX) -{ - _relativeAntennaLocation = pX; -} - -unsigned short TransmitterPdu::getAntennaPatternType() const -{ - return _antennaPatternType; -} - -void TransmitterPdu::setAntennaPatternType(unsigned short pX) -{ - _antennaPatternType = pX; -} - -unsigned short TransmitterPdu::getAntennaPatternCount() const -{ - return _antennaPatternList.size(); -} - -unsigned long long TransmitterPdu::getFrequency() const -{ - return _frequency; -} - -void TransmitterPdu::setFrequency(unsigned long long pX) -{ - _frequency = pX; -} - -float TransmitterPdu::getTransmitFrequencyBandwidth() const -{ - return _transmitFrequencyBandwidth; -} - -void TransmitterPdu::setTransmitFrequencyBandwidth(float pX) -{ - _transmitFrequencyBandwidth = pX; -} - -float TransmitterPdu::getPower() const -{ - return _power; -} - -void TransmitterPdu::setPower(float pX) -{ - _power = pX; -} - -ModulationType& TransmitterPdu::getModulationType() -{ - return _modulationType; -} - -const ModulationType& TransmitterPdu::getModulationType() const -{ - return _modulationType; -} - -void TransmitterPdu::setModulationType(const ModulationType &pX) -{ - _modulationType = pX; -} - -unsigned short TransmitterPdu::getCryptoSystem() const -{ - return _cryptoSystem; -} - -void TransmitterPdu::setCryptoSystem(unsigned short pX) -{ - _cryptoSystem = pX; -} - -unsigned short TransmitterPdu::getCryptoKeyId() const -{ - return _cryptoKeyId; -} - -void TransmitterPdu::setCryptoKeyId(unsigned short pX) -{ - _cryptoKeyId = pX; -} - -unsigned char TransmitterPdu::getModulationParameterCount() const -{ - return _modulationParametersList.size(); -} - -unsigned short TransmitterPdu::getPadding2() const -{ - return _padding2; -} - -void TransmitterPdu::setPadding2(unsigned short pX) -{ - _padding2 = pX; -} - -unsigned char TransmitterPdu::getPadding3() const -{ - return _padding3; -} - -void TransmitterPdu::setPadding3(unsigned char pX) -{ - _padding3 = pX; -} - -std::vector& TransmitterPdu::getModulationParametersList() -{ - return _modulationParametersList; -} - -const std::vector& TransmitterPdu::getModulationParametersList() const -{ - return _modulationParametersList; -} - -void TransmitterPdu::setModulationParametersList(const std::vector& pX) -{ - _modulationParametersList = pX; -} - -std::vector& TransmitterPdu::getAntennaPatternList() -{ - return _antennaPatternList; -} - -const std::vector& TransmitterPdu::getAntennaPatternList() const -{ - return _antennaPatternList; -} - -void TransmitterPdu::setAntennaPatternList(const std::vector& pX) -{ - _antennaPatternList = pX; -} - -void TransmitterPdu::marshal(DataStream& dataStream) const -{ - RadioCommunicationsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _radioEntityType.marshal(dataStream); - dataStream << _transmitState; - dataStream << _inputSource; - dataStream << _padding1; - _antennaLocation.marshal(dataStream); - _relativeAntennaLocation.marshal(dataStream); - dataStream << _antennaPatternType; - dataStream << ( unsigned short )_antennaPatternList.size(); - dataStream << _frequency; - dataStream << _transmitFrequencyBandwidth; - dataStream << _power; - _modulationType.marshal(dataStream); - dataStream << _cryptoSystem; - dataStream << _cryptoKeyId; - dataStream << ( unsigned char )_modulationParametersList.size(); - dataStream << _padding2; - dataStream << _padding3; - - for(size_t idx = 0; idx < _modulationParametersList.size(); idx++) - { - Vector3Float x = _modulationParametersList[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _antennaPatternList.size(); idx++) - { - Vector3Float x = _antennaPatternList[idx]; - x.marshal(dataStream); - } - -} - -void TransmitterPdu::unmarshal(DataStream& dataStream) -{ - RadioCommunicationsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _radioEntityType.unmarshal(dataStream); - dataStream >> _transmitState; - dataStream >> _inputSource; - dataStream >> _padding1; - _antennaLocation.unmarshal(dataStream); - _relativeAntennaLocation.unmarshal(dataStream); - dataStream >> _antennaPatternType; - dataStream >> _antennaPatternCount; - dataStream >> _frequency; - dataStream >> _transmitFrequencyBandwidth; - dataStream >> _power; - _modulationType.unmarshal(dataStream); - dataStream >> _cryptoSystem; - dataStream >> _cryptoKeyId; - dataStream >> _modulationParameterCount; - dataStream >> _padding2; - dataStream >> _padding3; - - _modulationParametersList.clear(); - for(size_t idx = 0; idx < _modulationParameterCount; idx++) - { - Vector3Float x; - x.unmarshal(dataStream); - _modulationParametersList.push_back(x); - } - - _antennaPatternList.clear(); - for(size_t idx = 0; idx < _antennaPatternCount; idx++) - { - Vector3Float x; - x.unmarshal(dataStream); - _antennaPatternList.push_back(x); - } -} - - -bool TransmitterPdu::operator ==(const TransmitterPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); - - if( ! (_radioEntityType == rhs._radioEntityType) ) ivarsEqual = false; - if( ! (_transmitState == rhs._transmitState) ) ivarsEqual = false; - if( ! (_inputSource == rhs._inputSource) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_antennaLocation == rhs._antennaLocation) ) ivarsEqual = false; - if( ! (_relativeAntennaLocation == rhs._relativeAntennaLocation) ) ivarsEqual = false; - if( ! (_antennaPatternType == rhs._antennaPatternType) ) ivarsEqual = false; - if( ! (_frequency == rhs._frequency) ) ivarsEqual = false; - if( ! (_transmitFrequencyBandwidth == rhs._transmitFrequencyBandwidth) ) ivarsEqual = false; - if( ! (_power == rhs._power) ) ivarsEqual = false; - if( ! (_modulationType == rhs._modulationType) ) ivarsEqual = false; - if( ! (_cryptoSystem == rhs._cryptoSystem) ) ivarsEqual = false; - if( ! (_cryptoKeyId == rhs._cryptoKeyId) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_padding3 == rhs._padding3) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _modulationParametersList.size(); idx++) - { - if( ! ( _modulationParametersList[idx] == rhs._modulationParametersList[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _antennaPatternList.size(); idx++) - { - if( ! ( _antennaPatternList[idx] == rhs._antennaPatternList[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int TransmitterPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _radioEntityType.getMarshalledSize(); // _radioEntityType - marshalSize = marshalSize + 1; // _transmitState - marshalSize = marshalSize + 1; // _inputSource - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + _antennaLocation.getMarshalledSize(); // _antennaLocation - marshalSize = marshalSize + _relativeAntennaLocation.getMarshalledSize(); // _relativeAntennaLocation - marshalSize = marshalSize + 2; // _antennaPatternType - marshalSize = marshalSize + 2; // _antennaPatternCount - marshalSize = marshalSize + 8; // _frequency - marshalSize = marshalSize + 4; // _transmitFrequencyBandwidth - marshalSize = marshalSize + 4; // _power - marshalSize = marshalSize + _modulationType.getMarshalledSize(); // _modulationType - marshalSize = marshalSize + 2; // _cryptoSystem - marshalSize = marshalSize + 2; // _cryptoKeyId - marshalSize = marshalSize + 1; // _modulationParameterCount - marshalSize = marshalSize + 2; // _padding2 - marshalSize = marshalSize + 1; // _padding3 - - for(unsigned long long idx=0; idx < _modulationParametersList.size(); idx++) - { - Vector3Float listElement = _modulationParametersList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _antennaPatternList.size(); idx++) - { - Vector3Float listElement = _antennaPatternList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/TransmitterPdu.h b/src/dis6/TransmitterPdu.h deleted file mode 100644 index 72c399a2..00000000 --- a/src/dis6/TransmitterPdu.h +++ /dev/null @@ -1,188 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.8.1. Detailed information about a radio transmitter. This PDU requires manually written code to complete, since the modulation parameters are of variable length. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT TransmitterPdu : public RadioCommunicationsFamilyPdu -{ -protected: - /** linear accelleration of entity */ - RadioEntityType _radioEntityType; - - /** transmit state */ - unsigned char _transmitState; - - /** input source */ - unsigned char _inputSource; - - /** padding */ - unsigned short _padding1; - - /** Location of antenna */ - Vector3Double _antennaLocation; - - /** relative location of antenna */ - Vector3Float _relativeAntennaLocation; - - /** antenna pattern type */ - unsigned short _antennaPatternType; - - /** atenna pattern length */ - unsigned short _antennaPatternCount; - - /** frequency */ - unsigned long long _frequency; - - /** transmit frequency Bandwidth */ - float _transmitFrequencyBandwidth; - - /** transmission power */ - float _power; - - /** modulation */ - ModulationType _modulationType; - - /** crypto system enumeration */ - unsigned short _cryptoSystem; - - /** crypto system key identifer */ - unsigned short _cryptoKeyId; - - /** how many modulation parameters we have */ - unsigned char _modulationParameterCount; - - /** padding2 */ - unsigned short _padding2; - - /** padding3 */ - unsigned char _padding3; - - /** variable length list of modulation parameters */ - std::vector _modulationParametersList; - - /** variable length list of antenna pattern records */ - std::vector _antennaPatternList; - - - public: - TransmitterPdu(); - virtual ~TransmitterPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - RadioEntityType& getRadioEntityType(); - const RadioEntityType& getRadioEntityType() const; - void setRadioEntityType(const RadioEntityType &pX); - - unsigned char getTransmitState() const; - void setTransmitState(unsigned char pX); - - unsigned char getInputSource() const; - void setInputSource(unsigned char pX); - - unsigned short getPadding1() const; - void setPadding1(unsigned short pX); - - Vector3Double& getAntennaLocation(); - const Vector3Double& getAntennaLocation() const; - void setAntennaLocation(const Vector3Double &pX); - - Vector3Float& getRelativeAntennaLocation(); - const Vector3Float& getRelativeAntennaLocation() const; - void setRelativeAntennaLocation(const Vector3Float &pX); - - unsigned short getAntennaPatternType() const; - void setAntennaPatternType(unsigned short pX); - - unsigned short getAntennaPatternCount() const; - - unsigned long long getFrequency() const; - void setFrequency(unsigned long long pX); - - float getTransmitFrequencyBandwidth() const; - void setTransmitFrequencyBandwidth(float pX); - - float getPower() const; - void setPower(float pX); - - ModulationType& getModulationType(); - const ModulationType& getModulationType() const; - void setModulationType(const ModulationType &pX); - - unsigned short getCryptoSystem() const; - void setCryptoSystem(unsigned short pX); - - unsigned short getCryptoKeyId() const; - void setCryptoKeyId(unsigned short pX); - - unsigned char getModulationParameterCount() const; - - unsigned short getPadding2() const; - void setPadding2(unsigned short pX); - - unsigned char getPadding3() const; - void setPadding3(unsigned char pX); - - std::vector& getModulationParametersList(); - const std::vector& getModulationParametersList() const; - void setModulationParametersList(const std::vector& pX); - - std::vector& getAntennaPatternList(); - const std::vector& getAntennaPatternList() const; - void setAntennaPatternList(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const TransmitterPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/TwoByteChunk.cpp b/src/dis6/TwoByteChunk.cpp deleted file mode 100644 index 325b95a9..00000000 --- a/src/dis6/TwoByteChunk.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -using namespace DIS; - - -TwoByteChunk::TwoByteChunk() -{ - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 2; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - -} - -TwoByteChunk::~TwoByteChunk() -{ -} - -char* TwoByteChunk::getOtherParameters() -{ - return _otherParameters; -} - -const char* TwoByteChunk::getOtherParameters() const -{ - return _otherParameters; -} - -void TwoByteChunk::setOtherParameters(const char* x) -{ - for(int i = 0; i < 2; i++) - { - _otherParameters[i] = x[i]; - } -} - -void TwoByteChunk::marshal(DataStream& dataStream) const -{ - - for(size_t idx = 0; idx < 2; idx++) - { - dataStream << _otherParameters[idx]; - } - -} - -void TwoByteChunk::unmarshal(DataStream& dataStream) -{ - - for(size_t idx = 0; idx < 2; idx++) - { - dataStream >> _otherParameters[idx]; - } - -} - - -bool TwoByteChunk::operator ==(const TwoByteChunk& rhs) const - { - bool ivarsEqual = true; - - - for(unsigned char idx = 0; idx < 2; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int TwoByteChunk::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2 * 1; // _otherParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/TwoByteChunk.h b/src/dis6/TwoByteChunk.h deleted file mode 100644 index ef773f0e..00000000 --- a/src/dis6/TwoByteChunk.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 16 bit piece of data - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT TwoByteChunk -{ -protected: - /** two bytes of arbitrary data */ - char _otherParameters[2]; - - - public: - TwoByteChunk(); - virtual ~TwoByteChunk(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const TwoByteChunk& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/UaPdu.cpp b/src/dis6/UaPdu.cpp deleted file mode 100644 index ef2d5fb8..00000000 --- a/src/dis6/UaPdu.cpp +++ /dev/null @@ -1,332 +0,0 @@ -#include - -using namespace DIS; - - -UaPdu::UaPdu() : DistributedEmissionsFamilyPdu(), - _emittingEntityID(), - _eventID(), - _stateChangeIndicator(0), - _pad(0), - _passiveParameterIndex(0), - _propulsionPlantConfiguration(0), - _numberOfShafts(0), - _numberOfAPAs(0), - _numberOfUAEmitterSystems(0) -{ - setPduType( 29 ); -} - -UaPdu::~UaPdu() -{ - _shaftRPMs.clear(); - _apaData.clear(); - _emitterSystems.clear(); -} - -EntityID& UaPdu::getEmittingEntityID() -{ - return _emittingEntityID; -} - -const EntityID& UaPdu::getEmittingEntityID() const -{ - return _emittingEntityID; -} - -void UaPdu::setEmittingEntityID(const EntityID &pX) -{ - _emittingEntityID = pX; -} - -EventID& UaPdu::getEventID() -{ - return _eventID; -} - -const EventID& UaPdu::getEventID() const -{ - return _eventID; -} - -void UaPdu::setEventID(const EventID &pX) -{ - _eventID = pX; -} - -char UaPdu::getStateChangeIndicator() const -{ - return _stateChangeIndicator; -} - -void UaPdu::setStateChangeIndicator(char pX) -{ - _stateChangeIndicator = pX; -} - -char UaPdu::getPad() const -{ - return _pad; -} - -void UaPdu::setPad(char pX) -{ - _pad = pX; -} - -unsigned short UaPdu::getPassiveParameterIndex() const -{ - return _passiveParameterIndex; -} - -void UaPdu::setPassiveParameterIndex(unsigned short pX) -{ - _passiveParameterIndex = pX; -} - -unsigned char UaPdu::getPropulsionPlantConfiguration() const -{ - return _propulsionPlantConfiguration; -} - -void UaPdu::setPropulsionPlantConfiguration(unsigned char pX) -{ - _propulsionPlantConfiguration = pX; -} - -unsigned char UaPdu::getNumberOfShafts() const -{ - return _shaftRPMs.size(); -} - -unsigned char UaPdu::getNumberOfAPAs() const -{ - return _apaData.size(); -} - -unsigned char UaPdu::getNumberOfUAEmitterSystems() const -{ - return _emitterSystems.size(); -} - -std::vector& UaPdu::getShaftRPMs() -{ - return _shaftRPMs; -} - -const std::vector& UaPdu::getShaftRPMs() const -{ - return _shaftRPMs; -} - -void UaPdu::setShaftRPMs(const std::vector& pX) -{ - _shaftRPMs = pX; -} - -std::vector& UaPdu::getApaData() -{ - return _apaData; -} - -const std::vector& UaPdu::getApaData() const -{ - return _apaData; -} - -void UaPdu::setApaData(const std::vector& pX) -{ - _apaData = pX; -} - -std::vector& UaPdu::getEmitterSystems() -{ - return _emitterSystems; -} - -const std::vector& UaPdu::getEmitterSystems() const -{ - return _emitterSystems; -} - -void UaPdu::setEmitterSystems(const std::vector& pX) -{ - _emitterSystems = pX; -} - -void UaPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _emittingEntityID.marshal(dataStream); - _eventID.marshal(dataStream); - dataStream << _stateChangeIndicator; - dataStream << _pad; - dataStream << _passiveParameterIndex; - dataStream << _propulsionPlantConfiguration; - dataStream << ( unsigned char )_shaftRPMs.size(); - dataStream << ( unsigned char )_apaData.size(); - dataStream << ( unsigned char )_emitterSystems.size(); - - for(size_t idx = 0; idx < _shaftRPMs.size(); idx++) - { - ShaftRPMs x = _shaftRPMs[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _apaData.size(); idx++) - { - ApaData x = _apaData[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _emitterSystems.size(); idx++) - { - AcousticEmitterSystemData x = _emitterSystems[idx]; - x.marshal(dataStream); - } - -} - -void UaPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _emittingEntityID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - dataStream >> _stateChangeIndicator; - dataStream >> _pad; - dataStream >> _passiveParameterIndex; - dataStream >> _propulsionPlantConfiguration; - dataStream >> _numberOfShafts; - dataStream >> _numberOfAPAs; - dataStream >> _numberOfUAEmitterSystems; - - _shaftRPMs.clear(); - for(size_t idx = 0; idx < _numberOfShafts; idx++) - { - ShaftRPMs x; - x.unmarshal(dataStream); - _shaftRPMs.push_back(x); - } - - _apaData.clear(); - for(size_t idx = 0; idx < _numberOfAPAs; idx++) - { - ApaData x; - x.unmarshal(dataStream); - _apaData.push_back(x); - } - - _emitterSystems.clear(); - for(size_t idx = 0; idx < _numberOfUAEmitterSystems; idx++) - { - AcousticEmitterSystemData x; - x.unmarshal(dataStream); - _emitterSystems.push_back(x); - } -} - - -bool UaPdu::operator ==(const UaPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_emittingEntityID == rhs._emittingEntityID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_stateChangeIndicator == rhs._stateChangeIndicator) ) ivarsEqual = false; - if( ! (_pad == rhs._pad) ) ivarsEqual = false; - if( ! (_passiveParameterIndex == rhs._passiveParameterIndex) ) ivarsEqual = false; - if( ! (_propulsionPlantConfiguration == rhs._propulsionPlantConfiguration) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _shaftRPMs.size(); idx++) - { - if( ! ( _shaftRPMs[idx] == rhs._shaftRPMs[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _apaData.size(); idx++) - { - if( ! ( _apaData[idx] == rhs._apaData[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _emitterSystems.size(); idx++) - { - if( ! ( _emitterSystems[idx] == rhs._emitterSystems[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int UaPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + 1; // _stateChangeIndicator - marshalSize = marshalSize + 1; // _pad - marshalSize = marshalSize + 2; // _passiveParameterIndex - marshalSize = marshalSize + 1; // _propulsionPlantConfiguration - marshalSize = marshalSize + 1; // _numberOfShafts - marshalSize = marshalSize + 1; // _numberOfAPAs - marshalSize = marshalSize + 1; // _numberOfUAEmitterSystems - - for(unsigned long long idx=0; idx < _shaftRPMs.size(); idx++) - { - ShaftRPMs listElement = _shaftRPMs[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _apaData.size(); idx++) - { - ApaData listElement = _apaData[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _emitterSystems.size(); idx++) - { - AcousticEmitterSystemData listElement = _emitterSystems[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/UaPdu.h b/src/dis6/UaPdu.h deleted file mode 100644 index a92b8719..00000000 --- a/src/dis6/UaPdu.h +++ /dev/null @@ -1,142 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7.3. Information about underwater acoustic emmissions. This requires manual cleanup. The beam data records should ALL be a the finish, rather than attached to each emitter system. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT UaPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** ID of the entity that is the source of the emission */ - EntityID _emittingEntityID; - - /** ID of event */ - EventID _eventID; - - /** This field shall be used to indicate whether the data in the UA PDU represent a state update or data that have changed since issuance of the last UA PDU */ - char _stateChangeIndicator; - - /** padding */ - char _pad; - - /** This field indicates which database record (or file) shall be used in the definition of passive signature (unintentional) emissions of the entity. The indicated database record (or file) shall define all noise generated as a function of propulsion plant configurations and associated auxiliaries. */ - unsigned short _passiveParameterIndex; - - /** This field shall specify the entity propulsion plant configuration. This field is used to determine the passive signature characteristics of an entity. */ - unsigned char _propulsionPlantConfiguration; - - /** This field shall represent the number of shafts on a platform */ - unsigned char _numberOfShafts; - - /** This field shall indicate the number of APAs described in the current UA PDU */ - unsigned char _numberOfAPAs; - - /** This field shall specify the number of UA emitter systems being described in the current UA PDU */ - unsigned char _numberOfUAEmitterSystems; - - /** shaft RPM values */ - std::vector _shaftRPMs; - - /** apaData */ - std::vector _apaData; - - std::vector _emitterSystems; - - - public: - UaPdu(); - virtual ~UaPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEmittingEntityID(); - const EntityID& getEmittingEntityID() const; - void setEmittingEntityID(const EntityID &pX); - - EventID& getEventID(); - const EventID& getEventID() const; - void setEventID(const EventID &pX); - - char getStateChangeIndicator() const; - void setStateChangeIndicator(char pX); - - char getPad() const; - void setPad(char pX); - - unsigned short getPassiveParameterIndex() const; - void setPassiveParameterIndex(unsigned short pX); - - unsigned char getPropulsionPlantConfiguration() const; - void setPropulsionPlantConfiguration(unsigned char pX); - - unsigned char getNumberOfShafts() const; - - unsigned char getNumberOfAPAs() const; - - unsigned char getNumberOfUAEmitterSystems() const; - - std::vector& getShaftRPMs(); - const std::vector& getShaftRPMs() const; - void setShaftRPMs(const std::vector& pX); - - std::vector& getApaData(); - const std::vector& getApaData() const; - void setApaData(const std::vector& pX); - - std::vector& getEmitterSystems(); - const std::vector& getEmitterSystems() const; - void setEmitterSystems(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const UaPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/VariableDatum.cpp b/src/dis6/VariableDatum.cpp deleted file mode 100644 index 0873890b..00000000 --- a/src/dis6/VariableDatum.cpp +++ /dev/null @@ -1,178 +0,0 @@ -#include -#include - -using namespace DIS; - - -VariableDatum::VariableDatum(): - _variableDatumID(0), - _variableDatumLength(0), - _variableDatums(static_cast(STATIC_ARRAY_LENGTH), char(0)), // can (theoretically) throw - _arrayLength(0) -{ - -} - -VariableDatum::~VariableDatum() -{ - //delete [] _variableDatums; -} - -unsigned int VariableDatum::getVariableDatumID() const -{ - return _variableDatumID; -} - -void VariableDatum::setVariableDatumID(unsigned int pX) -{ - _variableDatumID = pX; -} - -unsigned int VariableDatum::getVariableDatumLength() const -{ - return _variableDatumLength; -} - -void VariableDatum::setVariableDatumLength(unsigned int pX) -{ - _variableDatumLength = pX; -} - -char* VariableDatum::getVariableDatums() // a bit dangerous. we could just return a ref to _variableDatums -{ - return _variableDatums.data(); -} - -const char* VariableDatum::getVariableDatums() const -{ - return _variableDatums.data(); -} - -void VariableDatum::setVariableDatums(const char* x, const unsigned int length) -{ - // convert and store length as bits - _variableDatumLength = length * 8; - - // Figure out _arrayLength (including padding to force whole 8 byte chunks) - unsigned int chunks = length / 8; - int remainder = length % 8; - if(remainder > 0) - chunks++; - _arrayLength = chunks * 8; - - // .resize() might (theoretically) throw. want to catch? : what to do? zombie datum? - if(_variableDatums.size() < length) - _variableDatums.resize(length); - - for(unsigned int i = 0; i < length; i++) - { - _variableDatums[i] = x[i]; - } - for(unsigned long i = length; i < _variableDatums.size(); i++) - { - _variableDatums[i] = 0; - } -} - -void VariableDatum::marshal(DataStream& dataStream) const -{ - dataStream << _variableDatumID; - dataStream << _variableDatumLength; - - for(unsigned int idx = 0; idx < _arrayLength; idx++) - { - dataStream << _variableDatums[idx]; - } - -} - -void VariableDatum::unmarshal(DataStream& dataStream) -{ - dataStream >> _variableDatumID; - dataStream >> _variableDatumLength; - - int byteLength = _variableDatumLength / 8; - int chunks = byteLength / 8; - if(byteLength % 8 > 0) - chunks++; - _arrayLength = chunks * 8; - - //std::cout << "Variable datum #" << (int)_variableDatumID << " arrayLength=" << (int)_arrayLength << " "; - - // .resize() might (theoretically) throw. want to catch? : what to do? zombie datum? - if(_variableDatums.size() < _arrayLength) - _variableDatums.resize(_arrayLength); - - for(unsigned int idx = 0; idx < _arrayLength; idx++) - { - dataStream >> _variableDatums[idx]; - //std::cout << (int)_variableDatums[idx] << " "; - } - //std::cout << std::endl; - for(unsigned long long idx = _arrayLength; idx < _variableDatums.size(); idx++) - { - _variableDatums[idx] = 0; - } - //std::cout << " Created and copied data to new _variableDatums array" << std::endl; - -} - -bool VariableDatum::operator ==(const VariableDatum& rhs) const -{ - bool ivarsEqual = true; - - if( ! (_variableDatumID == rhs._variableDatumID) ) ivarsEqual = false; - if( ! (_variableDatumLength == rhs._variableDatumLength) ) ivarsEqual = false; - if( ! (_variableDatums.size() == rhs._variableDatums.size()) ) ivarsEqual = false; - else { - for(std::size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if(!(_variableDatums[idx] == rhs._variableDatums[idx]) ) {ivarsEqual = false; break; } - } - } - - return ivarsEqual; -} - -unsigned int VariableDatum::getMarshalledSize() const -{ - unsigned int marshalSize = 0; - - marshalSize = marshalSize + 4; // _variableDatumID - marshalSize = marshalSize + 4; // _variableDatumLength - - marshalSize = marshalSize + _arrayLength; - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/VariableDatum.h b/src/dis6/VariableDatum.h deleted file mode 100644 index f78249fa..00000000 --- a/src/dis6/VariableDatum.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include -#include -#include - -// length in bytes for the variable data. This should be a dynamically allocated array. -#define STATIC_ARRAY_LENGTH 128 - -namespace DIS -{ -// Section 5.2.32. Variable Datum Record - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT VariableDatum -{ -protected: - /** ID of the variable datum */ - unsigned int _variableDatumID; - - /** length of the variable datums */ - unsigned int _variableDatumLength; - - /** The variable datum data.*/ - std::vector _variableDatums; - unsigned int _arrayLength; - - - public: - VariableDatum(); - virtual ~VariableDatum(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getVariableDatumID() const; - void setVariableDatumID(unsigned int pX); - - unsigned int getVariableDatumLength() const; - void setVariableDatumLength(unsigned int pX); - - char* getVariableDatums(); - const char* getVariableDatums() const; - void setVariableDatums(const char* pX, const unsigned int length); - - -virtual unsigned int getMarshalledSize() const; - - bool operator ==(const VariableDatum& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Vector3Double.cpp b/src/dis6/Vector3Double.cpp deleted file mode 100644 index 9c9ad740..00000000 --- a/src/dis6/Vector3Double.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -Vector3Double::Vector3Double(): - _x(0.0), - _y(0.0), - _z(0.0) -{ -} - -Vector3Double::~Vector3Double() -{ -} - -double Vector3Double::getX() const -{ - return _x; -} - -void Vector3Double::setX(double pX) -{ - _x = pX; -} - -double Vector3Double::getY() const -{ - return _y; -} - -void Vector3Double::setY(double pX) -{ - _y = pX; -} - -double Vector3Double::getZ() const -{ - return _z; -} - -void Vector3Double::setZ(double pX) -{ - _z = pX; -} - -void Vector3Double::marshal(DataStream& dataStream) const -{ - dataStream << _x; - dataStream << _y; - dataStream << _z; -} - -void Vector3Double::unmarshal(DataStream& dataStream) -{ - dataStream >> _x; - dataStream >> _y; - dataStream >> _z; -} - - -bool Vector3Double::operator ==(const Vector3Double& rhs) const - { - bool ivarsEqual = true; - - if( ! (_x == rhs._x) ) ivarsEqual = false; - if( ! (_y == rhs._y) ) ivarsEqual = false; - if( ! (_z == rhs._z) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Vector3Double::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 8; // _x - marshalSize = marshalSize + 8; // _y - marshalSize = marshalSize + 8; // _z - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Vector3Double.h b/src/dis6/Vector3Double.h deleted file mode 100644 index 417d3459..00000000 --- a/src/dis6/Vector3Double.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.3.34. Three double precision floating point values, x, y, and z - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT Vector3Double -{ -protected: - /** X value */ - double _x; - - /** Y value */ - double _y; - - /** Z value */ - double _z; - - - public: - Vector3Double(); - virtual ~Vector3Double(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - double getX() const; - void setX(double pX); - - double getY() const; - void setY(double pX); - - double getZ() const; - void setZ(double pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Vector3Double& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Vector3Float.cpp b/src/dis6/Vector3Float.cpp deleted file mode 100644 index 5988f06a..00000000 --- a/src/dis6/Vector3Float.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -Vector3Float::Vector3Float(): - _x(0.0), - _y(0.0), - _z(0.0) -{ -} - -Vector3Float::~Vector3Float() -{ -} - -float Vector3Float::getX() const -{ - return _x; -} - -void Vector3Float::setX(float pX) -{ - _x = pX; -} - -float Vector3Float::getY() const -{ - return _y; -} - -void Vector3Float::setY(float pX) -{ - _y = pX; -} - -float Vector3Float::getZ() const -{ - return _z; -} - -void Vector3Float::setZ(float pX) -{ - _z = pX; -} - -void Vector3Float::marshal(DataStream& dataStream) const -{ - dataStream << _x; - dataStream << _y; - dataStream << _z; -} - -void Vector3Float::unmarshal(DataStream& dataStream) -{ - dataStream >> _x; - dataStream >> _y; - dataStream >> _z; -} - - -bool Vector3Float::operator ==(const Vector3Float& rhs) const - { - bool ivarsEqual = true; - - if( ! (_x == rhs._x) ) ivarsEqual = false; - if( ! (_y == rhs._y) ) ivarsEqual = false; - if( ! (_z == rhs._z) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Vector3Float::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _x - marshalSize = marshalSize + 4; // _y - marshalSize = marshalSize + 4; // _z - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Vector3Float.h b/src/dis6/Vector3Float.h deleted file mode 100644 index 47f4e16d..00000000 --- a/src/dis6/Vector3Float.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Section 5.2.33. Three floating point values, x, y, and z - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT Vector3Float -{ -protected: - /** X value */ - float _x; - - /** y Value */ - float _y; - - /** Z value */ - float _z; - - - public: - Vector3Float(); - virtual ~Vector3Float(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getX() const; - void setX(float pX); - - float getY() const; - void setY(float pX); - - float getZ() const; - void setZ(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Vector3Float& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/VectoringNozzleSystemData.cpp b/src/dis6/VectoringNozzleSystemData.cpp deleted file mode 100644 index 1b12b8cf..00000000 --- a/src/dis6/VectoringNozzleSystemData.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -VectoringNozzleSystemData::VectoringNozzleSystemData(): - _horizontalDeflectionAngle(0.0), - _verticalDeflectionAngle(0.0) -{ -} - -VectoringNozzleSystemData::~VectoringNozzleSystemData() -{ -} - -float VectoringNozzleSystemData::getHorizontalDeflectionAngle() const -{ - return _horizontalDeflectionAngle; -} - -void VectoringNozzleSystemData::setHorizontalDeflectionAngle(float pX) -{ - _horizontalDeflectionAngle = pX; -} - -float VectoringNozzleSystemData::getVerticalDeflectionAngle() const -{ - return _verticalDeflectionAngle; -} - -void VectoringNozzleSystemData::setVerticalDeflectionAngle(float pX) -{ - _verticalDeflectionAngle = pX; -} - -void VectoringNozzleSystemData::marshal(DataStream& dataStream) const -{ - dataStream << _horizontalDeflectionAngle; - dataStream << _verticalDeflectionAngle; -} - -void VectoringNozzleSystemData::unmarshal(DataStream& dataStream) -{ - dataStream >> _horizontalDeflectionAngle; - dataStream >> _verticalDeflectionAngle; -} - - -bool VectoringNozzleSystemData::operator ==(const VectoringNozzleSystemData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_horizontalDeflectionAngle == rhs._horizontalDeflectionAngle) ) ivarsEqual = false; - if( ! (_verticalDeflectionAngle == rhs._verticalDeflectionAngle) ) ivarsEqual = false; - - return ivarsEqual; - } - -int VectoringNozzleSystemData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _horizontalDeflectionAngle - marshalSize = marshalSize + 4; // _verticalDeflectionAngle - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/VectoringNozzleSystemData.h b/src/dis6/VectoringNozzleSystemData.h deleted file mode 100644 index 837b4d22..00000000 --- a/src/dis6/VectoringNozzleSystemData.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Data about a vectoring nozzle system - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT VectoringNozzleSystemData -{ -protected: - /** horizontal deflection angle */ - float _horizontalDeflectionAngle; - - /** vertical deflection angle */ - float _verticalDeflectionAngle; - - - public: - VectoringNozzleSystemData(); - virtual ~VectoringNozzleSystemData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getHorizontalDeflectionAngle() const; - void setHorizontalDeflectionAngle(float pX); - - float getVerticalDeflectionAngle() const; - void setVerticalDeflectionAngle(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const VectoringNozzleSystemData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/WarfareFamilyPdu.cpp b/src/dis6/WarfareFamilyPdu.cpp deleted file mode 100644 index 21365978..00000000 --- a/src/dis6/WarfareFamilyPdu.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -using namespace DIS; - - -WarfareFamilyPdu::WarfareFamilyPdu() : Pdu(), - _firingEntityID(), - _targetEntityID() -{ - setProtocolFamily( 2 ); -} - -WarfareFamilyPdu::~WarfareFamilyPdu() -{ -} - -EntityID& WarfareFamilyPdu::getFiringEntityID() -{ - return _firingEntityID; -} - -const EntityID& WarfareFamilyPdu::getFiringEntityID() const -{ - return _firingEntityID; -} - -void WarfareFamilyPdu::setFiringEntityID(const EntityID &pX) -{ - _firingEntityID = pX; -} - -EntityID& WarfareFamilyPdu::getTargetEntityID() -{ - return _targetEntityID; -} - -const EntityID& WarfareFamilyPdu::getTargetEntityID() const -{ - return _targetEntityID; -} - -void WarfareFamilyPdu::setTargetEntityID(const EntityID &pX) -{ - _targetEntityID = pX; -} - -void WarfareFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first - _firingEntityID.marshal(dataStream); - _targetEntityID.marshal(dataStream); -} - -void WarfareFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _firingEntityID.unmarshal(dataStream); - _targetEntityID.unmarshal(dataStream); -} - - -bool WarfareFamilyPdu::operator ==(const WarfareFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - if( ! (_firingEntityID == rhs._firingEntityID) ) ivarsEqual = false; - if( ! (_targetEntityID == rhs._targetEntityID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int WarfareFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - marshalSize = marshalSize + _firingEntityID.getMarshalledSize(); // _firingEntityID - marshalSize = marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/WarfareFamilyPdu.h b/src/dis6/WarfareFamilyPdu.h deleted file mode 100644 index 6fda81b9..00000000 --- a/src/dis6/WarfareFamilyPdu.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.4. abstract superclass for fire and detonation pdus that have shared information. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS6_EXPORT WarfareFamilyPdu : public Pdu -{ -protected: - /** ID of the entity that shot */ - EntityID _firingEntityID; - - /** ID of the entity that is being shot at */ - EntityID _targetEntityID; - - - public: - WarfareFamilyPdu(); - virtual ~WarfareFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getFiringEntityID(); - const EntityID& getFiringEntityID() const; - void setFiringEntityID(const EntityID &pX); - - EntityID& getTargetEntityID(); - const EntityID& getTargetEntityID() const; - void setTargetEntityID(const EntityID &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const WarfareFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/ArticulationParameter.cpp b/src/dis6/common/ArticulationParameter.cpp new file mode 100644 index 00000000..3cb2a1de --- /dev/null +++ b/src/dis6/common/ArticulationParameter.cpp @@ -0,0 +1,123 @@ +#include "dis6/common/ArticulationParameter.h" + +namespace dis { + +ArticulationParameter::ArticulationParameter() + : parameter_type_designator_(0), + change_indicator_(0), + part_attached_to_(0), + parameter_type_(0), + parameter_value_(0.0) {} + +uint8_t ArticulationParameter::GetParameterTypeDesignator() const { + return parameter_type_designator_; +} + +void ArticulationParameter::SetParameterTypeDesignator(uint8_t pX) { + parameter_type_designator_ = pX; +} + +uint8_t ArticulationParameter::GetChangeIndicator() const { + return change_indicator_; +} + +void ArticulationParameter::SetChangeIndicator(uint8_t pX) { + change_indicator_ = pX; +} + +uint16_t ArticulationParameter::GetPartAttachedTo() const { + return part_attached_to_; +} + +void ArticulationParameter::SetPartAttachedTo(uint16_t pX) { + part_attached_to_ = pX; +} + +int ArticulationParameter::GetParameterType() const { return parameter_type_; } + +void ArticulationParameter::SetParameterType(int pX) { parameter_type_ = pX; } + +double ArticulationParameter::GetParameterValue() const { + return parameter_value_; +} + +void ArticulationParameter::SetParameterValue(double pX) { + parameter_value_ = pX; +} + +void ArticulationParameter::Marshal(DataStream& dataStream) const { + dataStream << parameter_type_designator_; + dataStream << change_indicator_; + dataStream << part_attached_to_; + dataStream << parameter_type_; + dataStream << parameter_value_; +} + +void ArticulationParameter::Unmarshal(DataStream& dataStream) { + dataStream >> parameter_type_designator_; + dataStream >> change_indicator_; + dataStream >> part_attached_to_; + dataStream >> parameter_type_; + dataStream >> parameter_value_; +} + +bool ArticulationParameter::operator==(const ArticulationParameter& rhs) const { + bool ivars_equal = true; + + if (!(parameter_type_designator_ == rhs.parameter_type_designator_)) { + ivars_equal = false; + } + if (!(change_indicator_ == rhs.change_indicator_)) { + ivars_equal = false; + } + if (!(part_attached_to_ == rhs.part_attached_to_)) { + ivars_equal = false; + } + if (!(parameter_type_ == rhs.parameter_type_)) { + ivars_equal = false; + } + if (!(parameter_value_ == rhs.parameter_value_)) { + ivars_equal = false; + } + + return ivars_equal; +} + +size_t ArticulationParameter::GetMarshalledSize() const { + size_t marshal_size = sizeof(parameter_type_designator_) + + sizeof(change_indicator_) + sizeof(part_attached_to_) + + sizeof(parameter_type_) + sizeof(parameter_value_); + return marshal_size; +} + +} // namespace dis +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/ArticulationParameter.h b/src/dis6/common/ArticulationParameter.h new file mode 100644 index 00000000..766b8ca3 --- /dev/null +++ b/src/dis6/common/ArticulationParameter.h @@ -0,0 +1,91 @@ +#ifndef DIS6_COMMON_ARTICULATIONPARAMETER_H_ +#define DIS6_COMMON_ARTICULATIONPARAMETER_H_ + +#include + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.5. Articulation parameters for movable parts and attached parts +// of an entity. Specifes wether or not a change has occured, the part +// identifcation of the articulated part to which it is attached, and the type +// and value of each parameter. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ArticulationParameter { + protected: + uint8_t parameter_type_designator_; + + uint8_t change_indicator_; + + uint16_t part_attached_to_; + + int parameter_type_; + + double parameter_value_; + + public: + ArticulationParameter(); + ~ArticulationParameter() = default; + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint8_t GetParameterTypeDesignator() const; + void SetParameterTypeDesignator(uint8_t pX); + + [[nodiscard]] uint8_t GetChangeIndicator() const; + void SetChangeIndicator(uint8_t pX); + + [[nodiscard]] uint16_t GetPartAttachedTo() const; + void SetPartAttachedTo(uint16_t pX); + + [[nodiscard]] int GetParameterType() const; + void SetParameterType(int pX); + + [[nodiscard]] double GetParameterValue() const; + void SetParameterValue(double pX); + + [[nodiscard]] size_t GetMarshalledSize() const; + + bool operator==(const ArticulationParameter& rhs) const; +}; + +} // namespace dis + +#endif // DIS6_COMMON_ARTICULATIONPARAMETER_H_ + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/CMakeLists.txt b/src/dis6/common/CMakeLists.txt new file mode 100644 index 00000000..33030f3f --- /dev/null +++ b/src/dis6/common/CMakeLists.txt @@ -0,0 +1,45 @@ +set(common_src + ArticulationParameter.cpp + ClockTime.cpp + EightByteChunk.cpp + EntityID.cpp + EntityType.cpp + EventID.cpp + FixedDatum.cpp + FourByteChunk.cpp + Orientation.cpp + Pdu.cpp + RecordSet.cpp + SimulationAddress.cpp + SixByteChunk.cpp + TwoByteChunk.cpp + VariableDatum.cpp + Vector3Double.cpp + Vector3Float.cpp +) + +set(common_hdr + ArticulationParameter.h + ClockTime.h + EightByteChunk.h + EntityID.h + EntityType.h + EventID.h + FixedDatum.h + FourByteChunk.h + Orientation.h + Pdu.h + RecordSet.h + SimulationAddress.h + SixByteChunk.h + TwoByteChunk.h + VariableDatum.h + Vector3Double.h + Vector3Float.h +) + +target_sources(OpenDIS6 PRIVATE ${common_src}) + +install(FILES ${common_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/common +) diff --git a/src/dis6/common/ClockTime.cpp b/src/dis6/common/ClockTime.cpp new file mode 100644 index 00000000..43c9b0e6 --- /dev/null +++ b/src/dis6/common/ClockTime.cpp @@ -0,0 +1,78 @@ +#include "dis6/common/ClockTime.h" + +namespace dis { +ClockTime::ClockTime() : hour_(0), time_past_hour_(0) {} + +ClockTime::~ClockTime() = default; + +int ClockTime::GetHour() const { return hour_; } + +void ClockTime::SetHour(int pX) { hour_ = pX; } + +uint32_t ClockTime::GetTimePastHour() const { return time_past_hour_; } + +void ClockTime::SetTimePastHour(uint32_t pX) { time_past_hour_ = pX; } + +void ClockTime::Marshal(DataStream& dataStream) const { + dataStream << hour_; + dataStream << time_past_hour_; +} + +void ClockTime::Unmarshal(DataStream& dataStream) { + dataStream >> hour_; + dataStream >> time_past_hour_; +} + +bool ClockTime::operator==(const ClockTime& rhs) const { + bool ivars_equal = true; + + if (!(hour_ == rhs.hour_)) { + ivars_equal = false; + } + if (!(time_past_hour_ == rhs.time_past_hour_)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int ClockTime::GetMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 4; // hour_ + marshal_size = marshal_size + 4; // time_past_hour_ + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/ClockTime.h b/src/dis6/common/ClockTime.h new file mode 100644 index 00000000..e016495a --- /dev/null +++ b/src/dis6/common/ClockTime.h @@ -0,0 +1,70 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.8. Time measurements that exceed one hour. Hours is the number of +// hours since January 1, 1970, UTC + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ClockTime { + protected: + /** Hours in UTC */ + int hour_; // NOLINT + + /** Time past the hour */ + uint32_t time_past_hour_; // NOLINT + + public: + ClockTime(); + virtual ~ClockTime(); + + virtual void Marshal(DataStream& dataStream) const; + virtual void Unmarshal(DataStream& dataStream); + + [[nodiscard]] int GetHour() const; + void SetHour(int pX); + + [[nodiscard]] uint32_t GetTimePastHour() const; + void SetTimePastHour(uint32_t pX); + + [[nodiscard]] virtual int GetMarshalledSize() const; + + bool operator==(const ClockTime& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/EightByteChunk.cpp b/src/dis6/common/EightByteChunk.cpp new file mode 100644 index 00000000..6ea0f29e --- /dev/null +++ b/src/dis6/common/EightByteChunk.cpp @@ -0,0 +1,87 @@ +#include "dis6/common/EightByteChunk.h" + +namespace dis { +EightByteChunk::EightByteChunk() { + // Initialize fixed length array + for (char& other_parameter : other_parameters_) { + other_parameter = 0; + } +} + +EightByteChunk::~EightByteChunk() = default; + +char* EightByteChunk::GetOtherParameters() { return other_parameters_; } + +const char* EightByteChunk::GetOtherParameters() const { + return other_parameters_; +} + +void EightByteChunk::SetOtherParameters(const char* x) { + for (int i = 0; i < 8; i++) { + other_parameters_[i] = x[i]; + } +} + +void EightByteChunk::Marshal(DataStream& dataStream) const { + for (char const other_parameter : other_parameters_) { + dataStream << other_parameter; + } +} + +void EightByteChunk::Unmarshal(DataStream& dataStream) { + for (char& other_parameter : other_parameters_) { + dataStream >> other_parameter; + } +} + +bool EightByteChunk::operator==(const EightByteChunk& rhs) const { + bool ivars_equal = true; + + for (uint8_t idx = 0; idx < 8; idx++) { + if (!(other_parameters_[idx] == rhs.other_parameters_[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int EightByteChunk::GetMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 8 * 1; // other_parameters_ + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/EightByteChunk.h b/src/dis6/common/EightByteChunk.h new file mode 100644 index 00000000..8f996cf2 --- /dev/null +++ b/src/dis6/common/EightByteChunk.h @@ -0,0 +1,64 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// 64 bit piece of data + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EightByteChunk { + protected: + /** Eight bytes of arbitrary data */ + char other_parameters_[8]; // NOLINT + + public: + EightByteChunk(); + virtual ~EightByteChunk(); + + virtual void Marshal(DataStream& dataStream) const; + virtual void Unmarshal(DataStream& dataStream); + + char* GetOtherParameters(); + [[nodiscard]] const char* GetOtherParameters() const; + void SetOtherParameters(const char* pX); + + [[nodiscard]] virtual int GetMarshalledSize() const; + + bool operator==(const EightByteChunk& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/EntityID.cpp b/src/dis6/common/EntityID.cpp new file mode 100644 index 00000000..e2310f19 --- /dev/null +++ b/src/dis6/common/EntityID.cpp @@ -0,0 +1,88 @@ +#include "dis6/common/EntityID.h" + +namespace dis { +EntityID::EntityID() : site_(0), application_(0), entity_(0) {} + +EntityID::~EntityID() = default; + +uint16_t EntityID::GetSite() const { return site_; } + +void EntityID::SetSite(uint16_t pX) { site_ = pX; } + +uint16_t EntityID::GetApplication() const { return application_; } + +void EntityID::SetApplication(uint16_t pX) { application_ = pX; } + +uint16_t EntityID::GetEntity() const { return entity_; } + +void EntityID::SetEntity(uint16_t pX) { entity_ = pX; } + +void EntityID::Marshal(DataStream& dataStream) const { + dataStream << site_; + dataStream << application_; + dataStream << entity_; +} + +void EntityID::Unmarshal(DataStream& dataStream) { + dataStream >> site_; + dataStream >> application_; + dataStream >> entity_; +} + +bool EntityID::operator==(const EntityID& rhs) const { + bool ivars_equal = true; + + if (!(site_ == rhs.site_)) { + ivars_equal = false; + } + if (!(application_ == rhs.application_)) { + ivars_equal = false; + } + if (!(entity_ == rhs.entity_)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int EntityID::GetMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 2; // site_ + marshal_size = marshal_size + 2; // application_ + marshal_size = marshal_size + 2; // entity_ + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/EntityID.h b/src/dis6/common/EntityID.h new file mode 100644 index 00000000..842de79d --- /dev/null +++ b/src/dis6/common/EntityID.h @@ -0,0 +1,88 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Each entity in a given DIS simulation application shall be given an entity +// identifier number unique to all other entities in that application. This +// identifier number is valid for the duration of the exercise; however, entity +// identifier numbers may be reused when all possible numbers have been +// exhausted. No entity shall have an entity identifier number of NO_ENTITY, +// ALL_ENTITIES, or RQST_ASSIGN_ID. The entity iden- tifier number need not be +// registered or retained for future exercises. The entity identifier number +// shall be specified by a 16-bit uint32_teger. An entity identifier +// number equal to zero with valid site and application identification shall +// address a simulation application. An entity identifier number equal to +// ALL_ENTITIES shall mean all entities within the specified site and +// application. An entity identifier number equal to RQST_ASSIGN_ID allows the +// receiver of the create entity to define the entity identifier number of the +// new entity. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EntityID { + protected: + /** The site ID */ + uint16_t site_; // NOLINT + + /** The application ID */ + uint16_t application_; // NOLINT + + /** the entity ID */ + uint16_t entity_; // NOLINT + + public: + EntityID(); + virtual ~EntityID(); + + virtual void Marshal(DataStream& dataStream) const; + virtual void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint16_t GetSite() const; + void SetSite(uint16_t pX); + + [[nodiscard]] uint16_t GetApplication() const; + void SetApplication(uint16_t pX); + + [[nodiscard]] uint16_t GetEntity() const; + void SetEntity(uint16_t pX); + + [[nodiscard]] virtual int GetMarshalledSize() const; + + bool operator==(const EntityID& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/EntityType.cpp b/src/dis6/common/EntityType.cpp new file mode 100644 index 00000000..d9a4874c --- /dev/null +++ b/src/dis6/common/EntityType.cpp @@ -0,0 +1,135 @@ +#include "dis6/common/EntityType.h" + +namespace dis { +EntityType::EntityType() + : _entityKind(0), + domain_(0), + country_(0), + category_(0), + subcategory_(0), + specific_(0), + extra_(0) {} + +EntityType::~EntityType() = default; + +uint8_t EntityType::GetEntityKind() { return GetEntityKind; } + +void EntityType::SetEntityKind(uint8_t pX) { _entityKind = pX; } + +uint8_t EntityType::GetDomain() const { return domain_; } + +void EntityType::SetDomain(uint8_t pX) { domain_ = pX; } + +uint16_t EntityType::GetCountry() const { return country_; } + +void EntityType::SetCountry(uint16_t pX) { country_ = pX; } + +uint8_t EntityType::GetCategory() const { return category_; } + +void EntityType::SetCategory(uint8_t pX) { category_ = pX; } + +uint8_t EntityType::GetSubcategory() const { return subcategory_; } + +void EntityType::SetSubcategory(uint8_t pX) { subcategory_ = pX; } + +uint8_t EntityType::GetSpecific() const { return specific_; } + +void EntityType::SetSpecific(uint8_t pX) { specific_ = pX; } + +uint8_t EntityType::GetExtra() const { return extra_; } + +void EntityType::SetExtra(uint8_t pX) { extra_ = pX; } + +void EntityType::Marshal(DataStream& dataStream) const { + dataStream << entity_kind_; + dataStream << domain_; + dataStream << country_; + dataStream << category_; + dataStream << subcategory_; + dataStream << specific_; + dataStream << extra_; +} + +void EntityType::Unmarshal(DataStream& dataStream) { + dataStream >> entity_kind_; + dataStream >> domain_; + dataStream >> country_; + dataStream >> category_; + dataStream >> subcategory_; + dataStream >> specific_; + dataStream >> extra_; +} + +bool EntityType::operator==(const EntityType& rhs) const { + bool ivars_equal = true; + + if (!(GetEntityKind == rhs.entity_kind_)) { + ivars_equal = false; + } + if (!(_domain == rhs.domain_)) { + ivars_equal = false; + } + if (!(_country == rhs.country_)) { + ivars_equal = false; + } + if (!(_category == rhs.category_)) { + ivars_equal = false; + } + if (!(_subcategory == rhs.subcategory_)) { + ivars_equal = false; + } + if (!(_specific == rhs.specific_)) { + ivars_equal = false; + } + if (!(_extra == rhs.extra_)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int EntityType::GetMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 1; // _entityKind + marshal_size = marshal_size + 1; // _domain + marshal_size = marshal_size + 2; // _country + marshal_size = marshal_size + 1; // _category + marshal_size = marshal_size + 1; // _subcategory + marshal_size = marshal_size + 1; // _specific + marshal_size = marshal_size + 1; // _extra + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/EntityType.h b/src/dis6/common/EntityType.h new file mode 100644 index 00000000..6f587f06 --- /dev/null +++ b/src/dis6/common/EntityType.h @@ -0,0 +1,99 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.16. Identifies the type of entity, including kind of entity, +// domain (surface, subsurface, air, etc) country, category, etc. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EntityType { + protected: + /** Kind of entity */ + uint8_t entity_kind_; // NOLINT + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t domain_; // NOLINT + + /** country to which the design of the entity is attributed */ + uint16_t country_; // NOLINT + + /** category of entity */ + uint8_t category_; // NOLINT + + /** subcategory of entity */ + uint8_t subcategory_; // NOLINT + + /** specific info based on subcategory field */ + uint8_t specific_; // NOLINT + + uint8_t extra_; // NOLINT + + public: + EntityType(); + virtual ~EntityType(); + + virtual void Marshal(DataStream& dataStream) const; + virtual void Unmarshal(DataStream& dataStream); + + [[nodiscard]] static uint8_t GetEntityKind(); + void SetEntityKind(uint8_t pX); + + [[nodiscard]] uint8_t GetDomain() const; + void SetDomain(uint8_t pX); + + [[nodiscard]] uint16_t GetCountry() const; + void SetCountry(uint16_t pX); + + [[nodiscard]] uint8_t GetCategory() const; + void SetCategory(uint8_t pX); + + [[nodiscard]] uint8_t GetSubcategory() const; + void SetSubcategory(uint8_t pX); + + [[nodiscard]] uint8_t GetSpecific() const; + void SetSpecific(uint8_t pX); + + [[nodiscard]] uint8_t GetExtra() const; + void SetExtra(uint8_t pX); + + [[nodiscard]] virtual int GetMarshalledSize() const; + + bool operator==(const EntityType& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/EventID.cpp b/src/dis6/common/EventID.cpp new file mode 100644 index 00000000..3f92c782 --- /dev/null +++ b/src/dis6/common/EventID.cpp @@ -0,0 +1,88 @@ +#include "dis6/common/EventID.h" + +namespace dis { +EventID::EventID() : _site(0), _application(0), _eventNumber(0) {} + +EventID::~EventID() = default; + +uint16_t EventID::getSite() const { return _site; } + +void EventID::setSite(uint16_t pX) { _site = pX; } + +uint16_t EventID::getApplication() const { return _application; } + +void EventID::setApplication(uint16_t pX) { _application = pX; } + +uint16_t EventID::getEventNumber() const { return _eventNumber; } + +void EventID::setEventNumber(uint16_t pX) { _eventNumber = pX; } + +void EventID::Marshal(DataStream& dataStream) const { + dataStream << _site; + dataStream << _application; + dataStream << _eventNumber; +} + +void EventID::Unmarshal(DataStream& dataStream) { + dataStream >> _site; + dataStream >> _application; + dataStream >> _eventNumber; +} + +bool EventID::operator==(const EventID& rhs) const { + bool ivars_equal = true; + + if (!(_site == rhs._site)) { + ivars_equal = false; + } + if (!(_application == rhs._application)) { + ivars_equal = false; + } + if (!(_eventNumber == rhs._eventNumber)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int EventID::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 2; // _site + marshal_size = marshal_size + 2; // _application + marshal_size = marshal_size + 2; // _eventNumber + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/EventID.h b/src/dis6/common/EventID.h new file mode 100644 index 00000000..4565c27b --- /dev/null +++ b/src/dis6/common/EventID.h @@ -0,0 +1,76 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.18. Identifies a unique event in a simulation via the combination +// of three values + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EventID { + protected: + /** The site ID */ + uint16_t _site; + + /** The application ID */ + uint16_t _application; + + /** the number of the event */ + uint16_t _eventNumber; + + public: + EventID(); + virtual ~EventID(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint16_t getSite() const; + void setSite(uint16_t pX); + + uint16_t getApplication() const; + void setApplication(uint16_t pX); + + uint16_t getEventNumber() const; + void setEventNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EventID& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/FixedDatum.cpp b/src/dis6/common/FixedDatum.cpp new file mode 100644 index 00000000..bbbacd5f --- /dev/null +++ b/src/dis6/common/FixedDatum.cpp @@ -0,0 +1,77 @@ +#include "dis6/common/FixedDatum.h" + +using namespace DIS; + +FixedDatum::FixedDatum() : _fixedDatumID(0), _fixedDatumValue(0) {} + +FixedDatum::~FixedDatum() = default; + +uint32_t FixedDatum::getFixedDatumID() const { return _fixedDatumID; } + +void FixedDatum::setFixedDatumID(uint32_t pX) { _fixedDatumID = pX; } + +uint32_t FixedDatum::getFixedDatumValue() const { return _fixedDatumValue; } + +void FixedDatum::setFixedDatumValue(uint32_t pX) { _fixedDatumValue = pX; } + +void FixedDatum::Marshal(DataStream& dataStream) const { + dataStream << _fixedDatumID; + dataStream << _fixedDatumValue; +} + +void FixedDatum::Unmarshal(DataStream& dataStream) { + dataStream >> _fixedDatumID; + dataStream >> _fixedDatumValue; +} + +bool FixedDatum::operator==(const FixedDatum& rhs) const { + bool ivars_equal = true; + + if (!(_fixedDatumID == rhs._fixedDatumID)) { + ivars_equal = false; + } + if (!(_fixedDatumValue == rhs._fixedDatumValue)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int FixedDatum::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 4; // _fixedDatumID + marshal_size = marshal_size + 4; // _fixedDatumValue + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/FixedDatum.h b/src/dis6/common/FixedDatum.h new file mode 100644 index 00000000..667f676c --- /dev/null +++ b/src/dis6/common/FixedDatum.h @@ -0,0 +1,70 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.18. Fixed Datum Record + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class FixedDatum { + protected: + /** ID of the fixed datum */ + uint32_t _fixedDatumID; + + /** Value for the fixed datum */ + uint32_t _fixedDatumValue; + + public: + FixedDatum(); + virtual ~FixedDatum(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint32_t getFixedDatumID() const; + void setFixedDatumID(uint32_t pX); + + uint32_t getFixedDatumValue() const; + void setFixedDatumValue(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FixedDatum& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/FourByteChunk.cpp b/src/dis6/common/FourByteChunk.cpp new file mode 100644 index 00000000..c35d33b5 --- /dev/null +++ b/src/dis6/common/FourByteChunk.cpp @@ -0,0 +1,86 @@ +#include "dis6/common/FourByteChunk.h" + +using namespace DIS; + +FourByteChunk::FourByteChunk() { + // Initialize fixed length array + for (char& other_parameter : _otherParameters) { + other_parameter = 0; + } +} + +FourByteChunk::~FourByteChunk() = default; + +char* FourByteChunk::getOtherParameters() { return _otherParameters; } + +const char* FourByteChunk::getOtherParameters() const { + return _otherParameters; +} + +void FourByteChunk::setOtherParameters(const char* x) { + for (int i = 0; i < 4; i++) { + _otherParameters[i] = x[i]; + } +} + +void FourByteChunk::Marshal(DataStream& dataStream) const { + for (char const other_parameter : _otherParameters) { + dataStream << other_parameter; + } +} + +void FourByteChunk::Unmarshal(DataStream& dataStream) { + for (char const& other_parameter : _otherParameters) { + dataStream >> other_parameter; + } +} + +bool FourByteChunk::operator==(const FourByteChunk& rhs) const { + bool ivars_equal = true; + + for (uint8_t idx = 0; idx < 4; idx++) { + if (!(_otherParameters[idx] == rhs._otherParameters[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int FourByteChunk::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 4 * 1; // _otherParameters + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/FourByteChunk.h b/src/dis6/common/FourByteChunk.h new file mode 100644 index 00000000..a0e22d5a --- /dev/null +++ b/src/dis6/common/FourByteChunk.h @@ -0,0 +1,65 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 32 bit piece of data + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class FourByteChunk { + protected: + /** four bytes of arbitrary data */ + char _otherParameters[4]; + + public: + FourByteChunk(); + virtual ~FourByteChunk(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + char* getOtherParameters(); + const char* getOtherParameters() const; + void setOtherParameters(const char* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FourByteChunk& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/Orientation.cpp b/src/dis6/common/Orientation.cpp new file mode 100644 index 00000000..104587c9 --- /dev/null +++ b/src/dis6/common/Orientation.cpp @@ -0,0 +1,87 @@ +#include "dis6/common/Orientation.h" + +using namespace DIS; + +Orientation::Orientation() : _psi(0.0), _theta(0.0), _phi(0.0) {} + +Orientation::~Orientation() = default; + +float Orientation::getPsi() const { return _psi; } + +void Orientation::setPsi(float pX) { _psi = pX; } + +float Orientation::getTheta() const { return _theta; } + +void Orientation::setTheta(float pX) { _theta = pX; } + +float Orientation::getPhi() const { return _phi; } + +void Orientation::setPhi(float pX) { _phi = pX; } + +void Orientation::Marshal(DataStream& dataStream) const { + dataStream << _psi; + dataStream << _theta; + dataStream << _phi; +} + +void Orientation::Unmarshal(DataStream& dataStream) { + dataStream >> _psi; + dataStream >> _theta; + dataStream >> _phi; +} + +bool Orientation::operator==(const Orientation& rhs) const { + bool ivars_equal = true; + + if (!(_psi == rhs._psi)) { + ivars_equal = false; + } + if (!(_theta == rhs._theta)) { + ivars_equal = false; + } + if (!(_phi == rhs._phi)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int Orientation::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 4; // _psi + marshal_size = marshal_size + 4; // _theta + marshal_size = marshal_size + 4; // _phi + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/Orientation.h b/src/dis6/common/Orientation.h new file mode 100644 index 00000000..3cd23924 --- /dev/null +++ b/src/dis6/common/Orientation.h @@ -0,0 +1,74 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.17. Three floating point values representing an orientation, psi, +// theta, and phi, aka the euler angles, in radians + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class Orientation { + protected: + float _psi; + + float _theta; + + float _phi; + + public: + Orientation(); + virtual ~Orientation(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + float getPsi() const; + void setPsi(float pX); + + float getTheta() const; + void setTheta(float pX); + + float getPhi() const; + void setPhi(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Orientation& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/Pdu.cpp b/src/dis6/common/Pdu.cpp new file mode 100644 index 00000000..210d8a17 --- /dev/null +++ b/src/dis6/common/Pdu.cpp @@ -0,0 +1,135 @@ +#include "dis6/common/Pdu.h" + +namespace dis { +Pdu::Pdu() + : protocol_version_(6), + _exerciseID(0), + _pduType(0), + protocol_family_(0), + timestamp_(0), + length_(0), + padding_(0) {} + +Pdu::~Pdu() = default; + +uint8_t Pdu::GetProtocolVersion() { return _protocolVersion; } + +void Pdu::SetProtocolVersion(uint8_t pX) { protocol_version_ = pX; } + +uint8_t Pdu::GetExerciseId() { return _exerciseID; } + +void Pdu::SetExerciseId(uint8_t pX) { _exerciseID = pX; } + +uint8_t Pdu::GetPduType() { return _pduType; } + +void Pdu::SetPduType(uint8_t pX) { _pduType = pX; } + +uint8_t Pdu::GetProtocolFamily() { return _protocolFamily; } + +void Pdu::SetProtocolFamily(uint8_t pX) { protocol_family_ = pX; } + +uint32_t Pdu::GetTimestamp() const { return timestamp_; } + +void Pdu::SetTimestamp(uint32_t pX) { timestamp_ = pX; } + +uint16_t Pdu::GetLength() const { return this->GetMarshalledSize(); } + +void Pdu::SetLength(uint16_t pX) { length_ = pX; } + +int16_t Pdu::GetPadding() const { return padding_; } + +void Pdu::SetPadding(int16_t pX) { padding_ = pX; } + +void Pdu::Marshal(DataStream& dataStream) const { + dataStream << _protocolVersion; + dataStream << (GetExerciseId != nullptr); + dataStream << _pduType; + dataStream << _protocolFamily; + dataStream << timestamp_; + dataStream << this->getLength(); + dataStream << padding_; +} + +void Pdu::Unmarshal(DataStream& dataStream) { + dataStream >> protocol_version_; + dataStream >> _exerciseID; + dataStream >> _pduType; + dataStream >> protocol_family_; + dataStream >> timestamp_; + dataStream >> _length; + dataStream >> _padding; +} + +bool Pdu::operator==(const Pdu& rhs) const { + bool ivars_equal = true; + + if (!(_protocolVersion == rhs._protocolVersion)) { + ivars_equal = false; + } + if (!(_exerciseID == rhs._exerciseID)) { + ivars_equal = false; + } + if (!(_pduType == rhs._pduType)) { + ivars_equal = false; + } + if (!(_protocolFamily == rhs._protocolFamily)) { + ivars_equal = false; + } + if (!(_timestamp == rhs._timestamp)) { + ivars_equal = false; + } + if (!(_length == rhs._length)) { + ivars_equal = false; + } + if (!(_padding == rhs._padding)) { + ivars_equal = false; + } + + return ivars_equal; +} + +static int Pdu::GetMarshalledSize() { + int marshal_size = 0; + + marshal_size = marshal_size + 1; // _protocolVersion + marshal_size = marshal_size + 1; // _exerciseID + marshal_size = marshal_size + 1; // _pduType + marshal_size = marshal_size + 1; // _protocolFamily + marshal_size = marshal_size + 4; // _timestamp + marshal_size = marshal_size + 2; // _length + marshal_size = marshal_size + 2; // _padding + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/Pdu.h b/src/dis6/common/Pdu.h new file mode 100644 index 00000000..e8603299 --- /dev/null +++ b/src/dis6/common/Pdu.h @@ -0,0 +1,102 @@ +#pragma once + +#include + +#include "dis6/utils/DataStream.h" + +namespace dis { +// The superclass for all PDUs. This incorporates the PduHeader record, +// section 5.2.29. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class Pdu { + protected: + /** The version of the protocol. 5=DIS-1995, 6=DIS-1998. */ + uint8_t protocol_version_; + + /** Exercise ID */ + uint8_t exercise_id_; + + /** Type of pdu, unique for each PDU class */ + uint8_t pdu_type_; + + /** value that refers to the protocol family, eg SimulationManagement, et */ + uint8_t protocol_family_; + + /** Timestamp value */ + uint32_t timestamp_; + + /** Length, in bytes, of the PDU */ + uint16_t length_; + + /** zero-filled array of padding */ + int16_t padding_; + + public: + Pdu(); + virtual ~Pdu(); + + virtual void Marshal(DataStream& dataStream) const; + virtual void Unmarshal(DataStream& dataStream); + + [[nodiscard]] static uint8_t GetProtocolVersion(); + void SetProtocolVersion(uint8_t pX); + + [[nodiscard]] static uint8_t GetExerciseId(); + void SetExerciseId(uint8_t pX); + + [[nodiscard]] static uint8_t GetPduType(); + void SetPduType(uint8_t pX); + + [[nodiscard]] static uint8_t GetProtocolFamily(); + void SetProtocolFamily(uint8_t pX); + + [[nodiscard]] uint32_t GetTimestamp() const; + void SetTimestamp(uint32_t pX); + + [[nodiscard]] uint16_t GetLength() const; + void SetLength(uint16_t pX); + + [[nodiscard]] int16_t GetPadding() const; + void SetPadding(int16_t pX); + + [[nodiscard]] virtual int GetMarshalledSize() const; + + bool operator==(const Pdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/RecordSet.cpp b/src/dis6/common/RecordSet.cpp new file mode 100644 index 00000000..c6367047 --- /dev/null +++ b/src/dis6/common/RecordSet.cpp @@ -0,0 +1,127 @@ +#include "dis6/common/RecordSet.h" + +using namespace DIS; + +RecordSet::RecordSet() + : _recordID(0), + _recordSetSerialNumber(0), + _recordLength(0), + _recordCount(0), + _recordValues(0), + _pad4(0) {} + +RecordSet::~RecordSet() = default; + +uint32_t RecordSet::getRecordID() const { return _recordID; } + +void RecordSet::setRecordID(uint32_t pX) { _recordID = pX; } + +uint32_t RecordSet::getRecordSetSerialNumber() const { + return _recordSetSerialNumber; +} + +void RecordSet::setRecordSetSerialNumber(uint32_t pX) { + _recordSetSerialNumber = pX; +} + +uint16_t RecordSet::getRecordLength() const { return _recordLength; } + +void RecordSet::setRecordLength(uint16_t pX) { _recordLength = pX; } + +uint16_t RecordSet::getRecordCount() const { return _recordCount; } + +void RecordSet::setRecordCount(uint16_t pX) { _recordCount = pX; } + +uint16_t RecordSet::getRecordValues() const { return _recordValues; } + +void RecordSet::setRecordValues(uint16_t pX) { _recordValues = pX; } + +uint8_t RecordSet::getPad4() const { return _pad4; } + +void RecordSet::setPad4(uint8_t pX) { _pad4 = pX; } + +void RecordSet::Marshal(DataStream& dataStream) const { + dataStream << _recordID; + dataStream << _recordSetSerialNumber; + dataStream << _recordLength; + dataStream << _recordCount; + dataStream << _recordValues; + dataStream << _pad4; +} + +void RecordSet::Unmarshal(DataStream& dataStream) { + dataStream >> _recordID; + dataStream >> _recordSetSerialNumber; + dataStream >> _recordLength; + dataStream >> _recordCount; + dataStream >> _recordValues; + dataStream >> _pad4; +} + +bool RecordSet::operator==(const RecordSet& rhs) const { + bool ivars_equal = true; + + if (!(_recordID == rhs._recordID)) { + ivars_equal = false; + } + if (!(_recordSetSerialNumber == rhs._recordSetSerialNumber)) { + ivars_equal = false; + } + if (!(_recordLength == rhs._recordLength)) { + ivars_equal = false; + } + if (!(_recordCount == rhs._recordCount)) { + ivars_equal = false; + } + if (!(_recordValues == rhs._recordValues)) { + ivars_equal = false; + } + if (!(_pad4 == rhs._pad4)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int RecordSet::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 4; // _recordID + marshal_size = marshal_size + 4; // _recordSetSerialNumber + marshal_size = marshal_size + 2; // _recordLength + marshal_size = marshal_size + 2; // _recordCount + marshal_size = marshal_size + 2; // _recordValues + marshal_size = marshal_size + 1; // _pad4 + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/RecordSet.h b/src/dis6/common/RecordSet.h new file mode 100644 index 00000000..496ab2ed --- /dev/null +++ b/src/dis6/common/RecordSet.h @@ -0,0 +1,94 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Record sets, used in transfer control request PDU + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class RecordSet { + protected: + /** record ID */ + uint32_t _recordID; + + /** record set serial number */ + uint32_t _recordSetSerialNumber; + + /** record length */ + uint16_t _recordLength; + + /** record count */ + uint16_t _recordCount; + + /** ^^^This is wrong--variable sized data records */ + uint16_t _recordValues; + + /** ^^^This is wrong--variable sized padding */ + uint8_t _pad4; + + public: + RecordSet(); + virtual ~RecordSet(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint32_t getRecordID() const; + void setRecordID(uint32_t pX); + + uint32_t getRecordSetSerialNumber() const; + void setRecordSetSerialNumber(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint16_t getRecordCount() const; + void setRecordCount(uint16_t pX); + + uint16_t getRecordValues() const; + void setRecordValues(uint16_t pX); + + uint8_t getPad4() const; + void setPad4(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RecordSet& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/SimulationAddress.cpp b/src/dis6/common/SimulationAddress.cpp new file mode 100644 index 00000000..da6c2cd8 --- /dev/null +++ b/src/dis6/common/SimulationAddress.cpp @@ -0,0 +1,77 @@ +#include "dis6/common/SimulationAddress.h" + +using namespace DIS; + +SimulationAddress::SimulationAddress() : _site(0), _application(0) {} + +SimulationAddress::~SimulationAddress() = default; + +uint16_t SimulationAddress::getSite() const { return _site; } + +void SimulationAddress::setSite(uint16_t pX) { _site = pX; } + +uint16_t SimulationAddress::getApplication() const { return _application; } + +void SimulationAddress::setApplication(uint16_t pX) { _application = pX; } + +void SimulationAddress::Marshal(DataStream& dataStream) const { + dataStream << _site; + dataStream << _application; +} + +void SimulationAddress::Unmarshal(DataStream& dataStream) { + dataStream >> _site; + dataStream >> _application; +} + +bool SimulationAddress::operator==(const SimulationAddress& rhs) const { + bool ivars_equal = true; + + if (!(_site == rhs._site)) { + ivars_equal = false; + } + if (!(_application == rhs._application)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int SimulationAddress::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 2; // _site + marshal_size = marshal_size + 2; // _application + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/SimulationAddress.h b/src/dis6/common/SimulationAddress.h new file mode 100644 index 00000000..f6794eac --- /dev/null +++ b/src/dis6/common/SimulationAddress.h @@ -0,0 +1,71 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.14.1. A Simulation Address record shall consist of the Site +// Identification number and the Application Identification number. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SimulationAddress { + protected: + /** The site ID */ + uint16_t _site; + + /** The application ID */ + uint16_t _application; + + public: + SimulationAddress(); + virtual ~SimulationAddress(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint16_t getSite() const; + void setSite(uint16_t pX); + + uint16_t getApplication() const; + void setApplication(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SimulationAddress& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/SixByteChunk.cpp b/src/dis6/common/SixByteChunk.cpp new file mode 100644 index 00000000..fc793acc --- /dev/null +++ b/src/dis6/common/SixByteChunk.cpp @@ -0,0 +1,86 @@ +#include "dis6/common/SixByteChunk.h" + +using namespace DIS; + +SixByteChunk::SixByteChunk() { + // Initialize fixed length array + for (char& other_parameter : _otherParameters) { + other_parameter = 0; + } +} + +SixByteChunk::~SixByteChunk() = default; + +char* SixByteChunk::getOtherParameters() { return _otherParameters; } + +const char* SixByteChunk::getOtherParameters() const { + return _otherParameters; +} + +void SixByteChunk::setOtherParameters(const char* x) { + for (int i = 0; i < 6; i++) { + _otherParameters[i] = x[i]; + } +} + +void SixByteChunk::Marshal(DataStream& dataStream) const { + for (char const other_parameter : _otherParameters) { + dataStream << other_parameter; + } +} + +void SixByteChunk::Unmarshal(DataStream& dataStream) { + for (char const& other_parameter : _otherParameters) { + dataStream >> other_parameter; + } +} + +bool SixByteChunk::operator==(const SixByteChunk& rhs) const { + bool ivars_equal = true; + + for (uint8_t idx = 0; idx < 6; idx++) { + if (!(_otherParameters[idx] == rhs._otherParameters[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int SixByteChunk::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 6 * 1; // _otherParameters + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/SixByteChunk.h b/src/dis6/common/SixByteChunk.h similarity index 76% rename from src/dis6/SixByteChunk.h rename to src/dis6/common/SixByteChunk.h index d9334ab1..d8a95f2d 100644 --- a/src/dis6/SixByteChunk.h +++ b/src/dis6/common/SixByteChunk.h @@ -1,47 +1,43 @@ #pragma once -#include -#include +#include "dis6/utils/DataStream.h" -namespace DIS -{ +namespace DIS { // 48 bit piece of data -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. // // @author DMcG, jkg -class OPENDIS6_EXPORT SixByteChunk -{ -protected: +class SixByteChunk { + protected: /** six bytes of arbitrary data */ - char _otherParameters[6]; - + char _otherParameters[6]; public: - SixByteChunk(); - virtual ~SixByteChunk(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); + SixByteChunk(); + virtual ~SixByteChunk(); - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + char* getOtherParameters(); + const char* getOtherParameters() const; + void setOtherParameters(const char* pX); -virtual int getMarshalledSize() const; + virtual int getMarshalledSize() const; - bool operator ==(const SixByteChunk& rhs) const; + bool operator==(const SixByteChunk& rhs) const; }; -} +} // namespace DIS // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright @@ -54,7 +50,7 @@ virtual int getMarshalledSize() const; // nor the names of its contributors may be used to endorse or // promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/src/dis6/common/TwoByteChunk.cpp b/src/dis6/common/TwoByteChunk.cpp new file mode 100644 index 00000000..9dca460f --- /dev/null +++ b/src/dis6/common/TwoByteChunk.cpp @@ -0,0 +1,86 @@ +#include "dis6/common/TwoByteChunk.h" + +using namespace DIS; + +TwoByteChunk::TwoByteChunk() { + // Initialize fixed length array + for (char& other_parameter : _otherParameters) { + other_parameter = 0; + } +} + +TwoByteChunk::~TwoByteChunk() = default; + +char* TwoByteChunk::getOtherParameters() { return _otherParameters; } + +const char* TwoByteChunk::getOtherParameters() const { + return _otherParameters; +} + +void TwoByteChunk::setOtherParameters(const char* x) { + for (int i = 0; i < 2; i++) { + _otherParameters[i] = x[i]; + } +} + +void TwoByteChunk::Marshal(DataStream& dataStream) const { + for (char const other_parameter : _otherParameters) { + dataStream << other_parameter; + } +} + +void TwoByteChunk::Unmarshal(DataStream& dataStream) { + for (char const& other_parameter : _otherParameters) { + dataStream >> other_parameter; + } +} + +bool TwoByteChunk::operator==(const TwoByteChunk& rhs) const { + bool ivars_equal = true; + + for (uint8_t idx = 0; idx < 2; idx++) { + if (!(_otherParameters[idx] == rhs._otherParameters[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int TwoByteChunk::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 2 * 1; // _otherParameters + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/TwoByteChunk.h b/src/dis6/common/TwoByteChunk.h new file mode 100644 index 00000000..cc5c1986 --- /dev/null +++ b/src/dis6/common/TwoByteChunk.h @@ -0,0 +1,65 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 16 bit piece of data + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class TwoByteChunk { + protected: + /** two bytes of arbitrary data */ + char _otherParameters[2]; + + public: + TwoByteChunk(); + virtual ~TwoByteChunk(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + char* getOtherParameters(); + const char* getOtherParameters() const; + void setOtherParameters(const char* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const TwoByteChunk& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/VariableDatum.cpp b/src/dis6/common/VariableDatum.cpp new file mode 100644 index 00000000..8bcc647c --- /dev/null +++ b/src/dis6/common/VariableDatum.cpp @@ -0,0 +1,161 @@ +#include "dis6/common/VariableDatum.h" + +using namespace DIS; + +VariableDatum::VariableDatum() + : _variableDatumID(0), + _variableDatumLength(0), + _variableDatums(static_cast(STATIC_ARRAY_LENGTH), + static_cast(0)), // can (theoretically) throw + _arrayLength(0) {} + +VariableDatum::~VariableDatum() { + // delete [] _variableDatums; +} + +uint32_t VariableDatum::getVariableDatumID() const { return _variableDatumID; } + +void VariableDatum::setVariableDatumID(uint32_t pX) { _variableDatumID = pX; } + +uint32_t VariableDatum::getVariableDatumLength() const { + return _variableDatumLength; +} + +void VariableDatum::setVariableDatumLength(uint32_t pX) { + _variableDatumLength = pX; +} + +char* VariableDatum::getVariableDatums() // a bit dangerous. we could just + // return a ref to _variableDatums +{ + return _variableDatums.data(); +} + +const char* VariableDatum::getVariableDatums() const { + return _variableDatums.data(); +} + +void VariableDatum::setVariableDatums(const char* x, const uint32_t length) { + // convert and store length as bits + _variableDatumLength = length * 8; + + // Figure out _arrayLength (including padding to force whole 8 byte chunks) + uint32_t chunks = length / 8; + int const remainder = length % 8; + if (remainder > 0) { + chunks++; + } + _arrayLength = chunks * 8; + + // .resize() might (theoretically) throw. want to catch? : what to do? zombie + // datum? + if (_variableDatums.size() < length) { + _variableDatums.resize(length); + } + + for (auto i = 0; i < length; i++) { + _variableDatums[i] = x[i]; + } + for (auto i = length; i < _variableDatums.size(); i++) { + _variableDatums[i] = 0; + } +} + +void VariableDatum::Marshal(DataStream& dataStream) const { + dataStream << _variableDatumID; + dataStream << _variableDatumLength; + + for (auto idx = 0; idx < _arrayLength; idx++) { + dataStream << _variableDatums[idx]; + } +} + +void VariableDatum::Unmarshal(DataStream& dataStream) { + dataStream >> _variableDatumID; + dataStream >> _variableDatumLength; + + int const byte_length = _variableDatumLength / 8; + int chunks = byte_length / 8; + if (byte_length % 8 > 0) { + chunks++; + } + _arrayLength = chunks * 8; + + // .resize() might (theoretically) throw. want to catch? : what to do? zombie + // datum? + if (_variableDatums.size() < _arrayLength) { + _variableDatums.resize(_arrayLength); + } + + for (uint32_t idx = 0; idx < _arrayLength; idx++) { + dataStream >> _variableDatums[idx]; + } + for (uint64_t idx = _arrayLength; idx < _variableDatums.size(); idx++) { + _variableDatums[idx] = 0; + } +} + +bool VariableDatum::operator==(const VariableDatum& rhs) const { + bool ivars_equal = true; + + if (!(_variableDatumID == rhs._variableDatumID)) { + ivars_equal = false; + } + if (!(_variableDatumLength == rhs._variableDatumLength)) { + ivars_equal = false; + } + if (!(_variableDatums.size() == rhs._variableDatums.size())) { + ivars_equal = false; + } else { + for (std::size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) { + ivars_equal = false; + break; + } + } + } + + return ivars_equal; +} + +uint32_t VariableDatum::getMarshalledSize() const { + uint32_t marshal_size = 0; + + marshal_size = marshal_size + 4; // _variableDatumID + marshal_size = marshal_size + 4; // _variableDatumLength + + marshal_size = marshal_size + _arrayLength; + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/VariableDatum.h b/src/dis6/common/VariableDatum.h new file mode 100644 index 00000000..a6cb61a4 --- /dev/null +++ b/src/dis6/common/VariableDatum.h @@ -0,0 +1,84 @@ +#pragma once + +#include + + +#include "dis6/utils/DataStream.h" + +// length in bytes for the variable data. This should be a dynamically allocated +// array. +#define STATIC_ARRAY_LENGTH 128 + +namespace DIS { +// Section 5.2.32. Variable Datum Record + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class VariableDatum { + protected: + /** ID of the variable datum */ + uint32_t _variableDatumID; + + /** length of the variable datums */ + uint32_t _variableDatumLength; + + /** The variable datum data.*/ + std::vector _variableDatums; + uint32_t _arrayLength; + + public: + VariableDatum(); + virtual ~VariableDatum(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint32_t getVariableDatumID() const; + void setVariableDatumID(uint32_t pX); + + uint32_t getVariableDatumLength() const; + void setVariableDatumLength(uint32_t pX); + + char* getVariableDatums(); + const char* getVariableDatums() const; + void setVariableDatums(const char* pX, const uint32_t length); + + virtual uint32_t getMarshalledSize() const; + + bool operator==(const VariableDatum& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/Vector3Double.cpp b/src/dis6/common/Vector3Double.cpp new file mode 100644 index 00000000..dc311162 --- /dev/null +++ b/src/dis6/common/Vector3Double.cpp @@ -0,0 +1,82 @@ +#include "dis6/common/Vector3Double.h" + +namespace dis { +Vector3Double::Vector3Double() : x_(0.0), y_(0.0), z_(0.0) {} + +double Vector3Double::GetX() const { return x_; } + +void Vector3Double::SetX(double pX) { x_ = pX; } + +double Vector3Double::GetY() const { return y_; } + +void Vector3Double::SetY(double pX) { y_ = pX; } + +double Vector3Double::GetZ() const { return z_; } + +void Vector3Double::SetZ(double pX) { z_ = pX; } + +void Vector3Double::Marshal(DataStream& dataStream) const { + dataStream << x_; + dataStream << y_; + dataStream << z_; +} + +void Vector3Double::Unmarshal(DataStream& dataStream) { + dataStream >> x_; + dataStream >> y_; + dataStream >> z_; +} + +bool Vector3Double::operator==(const Vector3Double& rhs) const { + bool ivars_equal = true; + + if (!(x_ == rhs.x_)) { + ivars_equal = false; + } + if (!(y_ == rhs.y_)) { + ivars_equal = false; + } + if (!(z_ == rhs.z_)) { + ivars_equal = false; + } + + return ivars_equal; +} + +size_t Vector3Double::GetMarshalledSize() const { + size_t marshal_size = sizeof(x_) + sizeof(y_) + sizeof(z_); + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/Vector3Double.h b/src/dis6/common/Vector3Double.h new file mode 100644 index 00000000..87fb1bab --- /dev/null +++ b/src/dis6/common/Vector3Double.h @@ -0,0 +1,78 @@ +#ifndef DIS6_COMMON_VECTOR3DOUBLE_H_ +#define DIS6_COMMON_VECTOR3DOUBLE_H_ + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.3.34. Three double precision floating point values, x, y, and z + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class Vector3Double { + protected: + /** X value */ + double x_; // NOLINT + + /** Y value */ + double y_; // NOLINT + + /** Z value */ + double z_; // NOLINT + + public: + Vector3Double(); + ~Vector3Double() = default; + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] double GetX() const; + void SetX(double pX); + + [[nodiscard]] double GetY() const; + void SetY(double pX); + + [[nodiscard]] double GetZ() const; + void SetZ(double pX); + + [[nodiscard]] size_t GetMarshalledSize() const; + + bool operator==(const Vector3Double& rhs) const; +}; +} // namespace dis + +#endif // DIS6_COMMON_VECTOR3DOUBLE_H_ + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/Vector3Float.cpp b/src/dis6/common/Vector3Float.cpp new file mode 100644 index 00000000..f732466e --- /dev/null +++ b/src/dis6/common/Vector3Float.cpp @@ -0,0 +1,82 @@ +#include "dis6/common/Vector3Float.h" + +namespace dis { +Vector3Float::Vector3Float() : x_(0.0), y_(0.0), z_(0.0) {} + +float Vector3Float::GetX() const { return x_; } + +void Vector3Float::SetX(float pX) { x_ = pX; } + +float Vector3Float::GetY() const { return y_; } + +void Vector3Float::SetY(float pX) { y_ = pX; } + +float Vector3Float::GetZ() const { return z_; } + +void Vector3Float::SetZ(float pX) { z_ = pX; } + +void Vector3Float::Marshal(DataStream& dataStream) const { + dataStream << x_; + dataStream << y_; + dataStream << z_; +} + +void Vector3Float::Unmarshal(DataStream& dataStream) { + dataStream >> x_; + dataStream >> y_; + dataStream >> z_; +} + +bool Vector3Float::operator==(const Vector3Float& rhs) const { + bool ivars_equal = true; + + if (!(x_ == rhs.x_)) { + ivars_equal = false; + } + if (!(y_ == rhs.y_)) { + ivars_equal = false; + } + if (!(z_ == rhs.z_)) { + ivars_equal = false; + } + + return ivars_equal; +} + +size_t Vector3Float::GetMarshalledSize() const { + size_t marshal_size = sizeof(x_) + sizeof(y_) + sizeof(z_); + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/common/Vector3Float.h b/src/dis6/common/Vector3Float.h new file mode 100644 index 00000000..70d5c71b --- /dev/null +++ b/src/dis6/common/Vector3Float.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.33. Three floating point values, x, y, and z + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class Vector3Float { + protected: + /// X value + float x_; // NOLINT + + /// y value + float y_; // NOLINT + + /// Z value + float z_; // NOLINT + + public: + Vector3Float(); + ~Vector3Float() = default; + + void Marshal(dis::DataStream& dataStream) const; + void Unmarshal(dis::DataStream& dataStream); + + [[nodiscard]] float GetX() const; + void SetX(float pX); + + [[nodiscard]] float GetY() const; + void SetY(float pX); + + [[nodiscard]] float GetZ() const; + void SetZ(float pX); + + [[nodiscard]] size_t GetMarshalledSize() const; + + bool operator==(const Vector3Float& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/AcousticBeamData.cpp b/src/dis6/distributed_emissions/AcousticBeamData.cpp new file mode 100644 index 00000000..5132ab61 --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticBeamData.cpp @@ -0,0 +1,110 @@ +#include "dis6/distributed_emissions/AcousticBeamData.h" + +namespace dis { + +AcousticBeamData::AcousticBeamData() + : beam_data_length_(0), beam_id_number_(0), pad2_(0) {} + +uint16_t AcousticBeamData::GetBeamDataLength() const { + return beam_data_length_; +} + +void AcousticBeamData::SetBeamDataLength(uint16_t pX) { + beam_data_length_ = pX; +} + +uint8_t AcousticBeamData::GetBeamIdNumber() const { return beam_id_number_; } + +void AcousticBeamData::SetBeamIdNumber(uint8_t pX) { beam_id_number_ = pX; } + +uint16_t AcousticBeamData::GetPad2() const { return pad2_; } + +void AcousticBeamData::SetPad2(uint16_t pX) { pad2_ = pX; } + +AcousticBeamFundamentalParameter& +AcousticBeamData::GetFundamentalDataParameters() { + return fundamental_data_parameters_; +} + +const AcousticBeamFundamentalParameter& +AcousticBeamData::GetFundamentalDataParameters() const { + return fundamental_data_parameters_; +} + +void AcousticBeamData::SetFundamentalDataParameters( + const AcousticBeamFundamentalParameter& pX) { + fundamental_data_parameters_ = pX; +} + +void AcousticBeamData::Marshal(DataStream& dataStream) const { + dataStream << beam_data_length_; + dataStream << beam_id_number_; + dataStream << pad2_; + fundamental_data_parameters_.Marshal(dataStream); +} + +void AcousticBeamData::Unmarshal(DataStream& dataStream) { + dataStream >> beam_data_length_; + dataStream >> beam_id_number_; + dataStream >> pad2_; + fundamental_data_parameters_.Unmarshal(dataStream); +} + +bool AcousticBeamData::operator==(const AcousticBeamData& rhs) const { + bool ivars_equal = true; + + if (!(beam_data_length_ == rhs.beam_data_length_)) { + ivars_equal = false; + } + if (!(beam_id_number_ == rhs.beam_id_number_)) { + ivars_equal = false; + } + if (!(pad2_ == rhs.pad2_)) { + ivars_equal = false; + } + if (!(fundamental_data_parameters_ == rhs.fundamental_data_parameters_)) { + ivars_equal = false; + } + + return ivars_equal; +} + +size_t AcousticBeamData::GetMarshalledSize() const { + size_t marshal_size = sizeof(beam_data_length_) + sizeof(beam_id_number_) + + sizeof(pad2_) + + fundamental_data_parameters_.GetMarshalledSize(); + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/AcousticBeamData.h b/src/dis6/distributed_emissions/AcousticBeamData.h new file mode 100644 index 00000000..a9669cd9 --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticBeamData.h @@ -0,0 +1,89 @@ +#ifndef DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICBEAMDATA_H_ +#define DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICBEAMDATA_H_ + +#include + +#include "dis6/distributed_emissions/AcousticBeamFundamentalParameter.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Used in UA PDU + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AcousticBeamData { + protected: + /// beam data length + uint16_t beam_data_length_; // NOLINT + + /// beamIDNumber + uint8_t beam_id_number_; // NOLINT + + /// padding + uint16_t pad2_; // NOLINT + + /// fundamental data parameters + AcousticBeamFundamentalParameter fundamental_data_parameters_; // NOLINT + + public: + AcousticBeamData(); + ~AcousticBeamData() = default; + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint16_t GetBeamDataLength() const; + void SetBeamDataLength(uint16_t pX); + + [[nodiscard]] uint8_t GetBeamIdNumber() const; + void SetBeamIdNumber(uint8_t pX); + + [[nodiscard]] uint16_t GetPad2() const; + void SetPad2(uint16_t pX); + + AcousticBeamFundamentalParameter& GetFundamentalDataParameters(); + [[nodiscard]] const AcousticBeamFundamentalParameter& + GetFundamentalDataParameters() const; + void SetFundamentalDataParameters(const AcousticBeamFundamentalParameter& pX); + + [[nodiscard]] size_t GetMarshalledSize() const; + + bool operator==(const AcousticBeamData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#endif // DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICBEAMDATA_H_ diff --git a/src/dis6/distributed_emissions/AcousticBeamFundamentalParameter.cpp b/src/dis6/distributed_emissions/AcousticBeamFundamentalParameter.cpp new file mode 100644 index 00000000..18416f28 --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticBeamFundamentalParameter.cpp @@ -0,0 +1,147 @@ +#include "dis6/distributed_emissions/AcousticBeamFundamentalParameter.h" + +namespace dis { + +AcousticBeamFundamentalParameter::AcousticBeamFundamentalParameter() + : active_emission_parameter_index_(0), + scan_pattern_(0), + beam_center_azimuth_(0.0), + azimuthal_beamwidth_(0.0), + beam_center_de_(0.0), + de_beamwidth_(0.0) {} + +uint16_t AcousticBeamFundamentalParameter::GetActiveEmissionParameterIndex() + const { + return active_emission_parameter_index_; +} + +void AcousticBeamFundamentalParameter::SetActiveEmissionParameterIndex( + uint16_t pX) { + active_emission_parameter_index_ = pX; +} + +uint16_t AcousticBeamFundamentalParameter::GetScanPattern() const { + return scan_pattern_; +} + +void AcousticBeamFundamentalParameter::SetScanPattern(uint16_t pX) { + scan_pattern_ = pX; +} + +float AcousticBeamFundamentalParameter::GetBeamCenterAzimuth() const { + return beam_center_azimuth_; +} + +void AcousticBeamFundamentalParameter::SetBeamCenterAzimuth(float pX) { + beam_center_azimuth_ = pX; +} + +float AcousticBeamFundamentalParameter::GetAzimuthalBeamwidth() const { + return azimuthal_beamwidth_; +} + +void AcousticBeamFundamentalParameter::SetAzimuthalBeamwidth(float pX) { + azimuthal_beamwidth_ = pX; +} + +float AcousticBeamFundamentalParameter::GetBeamCenterDe() const { + return beam_center_de_; +} + +void AcousticBeamFundamentalParameter::SetBeamCenterDe(float pX) { + beam_center_de_ = pX; +} + +float AcousticBeamFundamentalParameter::GetDeBeamwidth() const { + return de_beamwidth_; +} + +void AcousticBeamFundamentalParameter::SetDeBeamwidth(float pX) { + de_beamwidth_ = pX; +} + +void AcousticBeamFundamentalParameter::Marshal(DataStream& dataStream) const { + dataStream << active_emission_parameter_index_; + dataStream << scan_pattern_; + dataStream << beam_center_azimuth_; + dataStream << azimuthal_beamwidth_; + dataStream << beam_center_de_; + dataStream << de_beamwidth_; +} + +void AcousticBeamFundamentalParameter::Unmarshal(DataStream& dataStream) { + dataStream >> active_emission_parameter_index_; + dataStream >> scan_pattern_; + dataStream >> beam_center_azimuth_; + dataStream >> azimuthal_beamwidth_; + dataStream >> beam_center_de_; + dataStream >> de_beamwidth_; +} + +bool AcousticBeamFundamentalParameter::operator==( + const AcousticBeamFundamentalParameter& rhs) const { + bool ivars_equal = true; + + if (active_emission_parameter_index_ != + rhs.active_emission_parameter_index_) { + ivars_equal = false; + } + if (scan_pattern_ != rhs.scan_pattern_) { + ivars_equal = false; + } + if (beam_center_azimuth_ != rhs.beam_center_azimuth_) { + ivars_equal = false; + } + if (azimuthal_beamwidth_ != rhs.azimuthal_beamwidth_) { + ivars_equal = false; + } + if (beam_center_de_ != rhs.beam_center_de_) { + ivars_equal = false; + } + if (de_beamwidth_ != rhs.de_beamwidth_) { + ivars_equal = false; + } + + return ivars_equal; +} + +size_t AcousticBeamFundamentalParameter::GetMarshalledSize() const { + size_t marshal_size = sizeof(active_emission_parameter_index_) + + sizeof(scan_pattern_) + sizeof(beam_center_azimuth_) + + sizeof(azimuthal_beamwidth_) + sizeof(beam_center_de_) + + sizeof(de_beamwidth_); + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/AcousticBeamFundamentalParameter.h b/src/dis6/distributed_emissions/AcousticBeamFundamentalParameter.h new file mode 100644 index 00000000..ac1ba0b0 --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticBeamFundamentalParameter.h @@ -0,0 +1,98 @@ +#ifndef DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICBEAMFUNDAMENTALPARAMETER_H_ +#define DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICBEAMFUNDAMENTALPARAMETER_H_ + +#include + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Used in UaPdu + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AcousticBeamFundamentalParameter { + protected: + /// parameter index + uint16_t active_emission_parameter_index_; // NOLINT + + /// scan pattern + uint16_t scan_pattern_; // NOLINT + + /// beam center azimuth + float beam_center_azimuth_; // NOLINT + + /// azimuthal beamwidth + float azimuthal_beamwidth_; // NOLINT + + /// beam center + float beam_center_de_; // NOLINT + + /// DE beamwidth (vertical beamwidth) + float de_beamwidth_; // NOLINT + + public: + AcousticBeamFundamentalParameter(); + ~AcousticBeamFundamentalParameter() = default; + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint16_t GetActiveEmissionParameterIndex() const; + void SetActiveEmissionParameterIndex(uint16_t pX); + + [[nodiscard]] uint16_t GetScanPattern() const; + void SetScanPattern(uint16_t pX); + + [[nodiscard]] float GetBeamCenterAzimuth() const; + void SetBeamCenterAzimuth(float pX); + + [[nodiscard]] float GetAzimuthalBeamwidth() const; + void SetAzimuthalBeamwidth(float pX); + + [[nodiscard]] float GetBeamCenterDe() const; + void SetBeamCenterDe(float pX); + + [[nodiscard]] float GetDeBeamwidth() const; + void SetDeBeamwidth(float pX); + + [[nodiscard]] size_t GetMarshalledSize() const; + + bool operator==(const AcousticBeamFundamentalParameter& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#endif // DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICBEAMFUNDAMENTALPARAMETER_H_ diff --git a/src/dis6/distributed_emissions/AcousticEmitter.cpp b/src/dis6/distributed_emissions/AcousticEmitter.cpp new file mode 100644 index 00000000..4f305ffe --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticEmitter.cpp @@ -0,0 +1,88 @@ +#include "dis6/distributed_emissions/AcousticEmitter.h" + +namespace dis { +AcousticEmitter::AcousticEmitter() + : acoustic_name_(0), function_(0), acoustic_id_number_(0) {} + +uint16_t AcousticEmitter::GetAcousticName() const { return acoustic_name_; } + +void AcousticEmitter::SetAcousticName(uint16_t pX) { acoustic_name_ = pX; } + +uint8_t AcousticEmitter::GetFunction() const { return function_; } + +void AcousticEmitter::SetFunction(uint8_t pX) { function_ = pX; } + +uint8_t AcousticEmitter::GetAcousticIdNumber() const { + return acoustic_id_number_; +} + +void AcousticEmitter::SetAcousticIdNumber(uint8_t pX) { + acoustic_id_number_ = pX; +} + +void AcousticEmitter::Marshal(DataStream& dataStream) const { + dataStream << acoustic_name_; + dataStream << function_; + dataStream << acoustic_id_number_; +} + +void AcousticEmitter::Unmarshal(DataStream& dataStream) { + dataStream >> acoustic_name_; + dataStream >> function_; + dataStream >> acoustic_id_number_; +} + +bool AcousticEmitter::operator==(const AcousticEmitter& rhs) const { + bool ivars_equal = true; + + if (acoustic_name_ != rhs.acoustic_name_) { + ivars_equal = false; + } + if (function_ != rhs.function_) { + ivars_equal = false; + } + if (acoustic_id_number_ != rhs.acoustic_id_number_) { + ivars_equal = false; + } + + return ivars_equal; +} + +size_t AcousticEmitter::GetMarshalledSize() const { + size_t marshal_size = + sizeof(acoustic_name_) + sizeof(function_) + sizeof(acoustic_id_number_); + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/AcousticEmitter.h b/src/dis6/distributed_emissions/AcousticEmitter.h new file mode 100644 index 00000000..c7034edb --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticEmitter.h @@ -0,0 +1,80 @@ +#ifndef DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICEMITTER_H_ +#define DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICEMITTER_H_ + +#include + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.35. information about a specific UA emmtter + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AcousticEmitter { + protected: + /// the system for a particular UA emitter, and an enumeration + uint16_t acoustic_name_; // NOLINT + + /// The function of the acoustic system + uint8_t function_; // NOLINT + + /// The UA emitter identification number relative to a specific system + uint8_t acoustic_id_number_; // NOLINT + + public: + AcousticEmitter(); + ~AcousticEmitter() = default; + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint16_t GetAcousticName() const; + void SetAcousticName(uint16_t pX); + + [[nodiscard]] uint8_t GetFunction() const; + void SetFunction(uint8_t pX); + + [[nodiscard]] uint8_t GetAcousticIdNumber() const; + void SetAcousticIdNumber(uint8_t pX); + + [[nodiscard]] size_t GetMarshalledSize() const; + + bool operator==(const AcousticEmitter& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#endif // DIS6_DISTRIBUTED_EMISSIONS_ACOUSTICEMITTER_H_ diff --git a/src/dis6/distributed_emissions/AcousticEmitterSystem.cpp b/src/dis6/distributed_emissions/AcousticEmitterSystem.cpp new file mode 100644 index 00000000..5111bbff --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticEmitterSystem.cpp @@ -0,0 +1,95 @@ +#include "dis6/distributed_emissions/AcousticEmitterSystem.h" + +namespace dis { +AcousticEmitterSystem::AcousticEmitterSystem() + : acoustic_name_(0), acoustic_function_(0), acoustic_id_(0) {} + +uint16_t AcousticEmitterSystem::GetAcousticName() const { + return acoustic_name_; +} + +void AcousticEmitterSystem::SetAcousticName(uint16_t pX) { + acoustic_name_ = pX; +} + +uint8_t AcousticEmitterSystem::GetAcousticFunction() const { + return acoustic_function_; +} + +void AcousticEmitterSystem::SetAcousticFunction(uint8_t pX) { + acoustic_function_ = pX; +} + +uint8_t AcousticEmitterSystem::GetAcousticId() const { return acoustic_id_; } + +void AcousticEmitterSystem::SetAcousticId(uint8_t pX) { acoustic_id_ = pX; } + +void AcousticEmitterSystem::Marshal(DataStream& dataStream) const { + dataStream << acoustic_name_; + dataStream << acoustic_function_; + dataStream << acoustic_id_; +} + +void AcousticEmitterSystem::Unmarshal(DataStream& dataStream) { + dataStream >> acoustic_name_; + dataStream >> acoustic_function_; + dataStream >> acoustic_id_; +} + +bool AcousticEmitterSystem::operator==(const AcousticEmitterSystem& rhs) const { + bool ivars_equal = true; + + if (acoustic_name_ != rhs.acoustic_name_) { + ivars_equal = false; + } + if (acoustic_function_ != rhs.acoustic_function_) { + ivars_equal = false; + } + if (acoustic_id_ != rhs.acoustic_id_) { + ivars_equal = false; + } + + return ivars_equal; +} + +int AcousticEmitterSystem::GetMarshalledSize() { + int marshal_size = 0; + + marshal_size = marshal_size + 2; // acoustic_name_ + marshal_size = marshal_size + 1; // acoustic_function_ + marshal_size = marshal_size + 1; // acoustic_id_ + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/AcousticEmitterSystem.h b/src/dis6/distributed_emissions/AcousticEmitterSystem.h new file mode 100644 index 00000000..5d5888e3 --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticEmitterSystem.h @@ -0,0 +1,84 @@ +#pragma once + +#include + +#include "dis6/utils/DataStream.h" + +namespace dis { +// 5.3.35: Information about a particular UA emitter shall be represented using +// an Acoustic Emitter System record. This record shall consist of three fields: +// Acoustic Name, Function, and Acoustic ID Number + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AcousticEmitterSystem { + protected: + /** This field shall specify the system for a particular UA emitter. */ + uint16_t acoustic_name_; // NOLINT + + /** This field shall describe the function of the acoustic system. */ + uint8_t acoustic_function_; // NOLINT + + /** This field shall specify the UA emitter identification number relative to + * a specific system. This field shall be represented by an 8-bit unsigned + * integer. This field allows the differentiation of multiple systems on an + * entity, even if in some instances two or more of the systems may be + * identical UA emitter types. Numbering of systems shall begin with the + * value 1. */ + uint8_t acoustic_id_; // NOLINT + + public: + AcousticEmitterSystem(); + ~AcousticEmitterSystem() = default; + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint16_t GetAcousticName() const; + void SetAcousticName(uint16_t pX); + + [[nodiscard]] uint8_t GetAcousticFunction() const; + void SetAcousticFunction(uint8_t pX); + + [[nodiscard]] uint8_t GetAcousticId() const; + void SetAcousticId(uint8_t pX); + + [[nodiscard]] static int GetMarshalledSize(); + + bool operator==(const AcousticEmitterSystem& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/AcousticEmitterSystemData.cpp b/src/dis6/distributed_emissions/AcousticEmitterSystemData.cpp new file mode 100644 index 00000000..defa38ee --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticEmitterSystemData.cpp @@ -0,0 +1,168 @@ +#include "dis6/distributed_emissions/AcousticEmitterSystemData.h" + +namespace dis { +AcousticEmitterSystemData::AcousticEmitterSystemData() + : _emitterSystemDataLength(0), + _numberOfBeams(0), + _pad2(0), + _acousticEmitterSystem(), + _emitterLocation() {} + +AcousticEmitterSystemData::~AcousticEmitterSystemData() { + _beamRecords.clear(); +} + +uint8_t AcousticEmitterSystemData::getEmitterSystemDataLength() const { + return _emitterSystemDataLength; +} + +void AcousticEmitterSystemData::setEmitterSystemDataLength(uint8_t pX) { + _emitterSystemDataLength = pX; +} + +uint8_t AcousticEmitterSystemData::getNumberOfBeams() const { + return _beamRecords.size(); +} + +uint16_t AcousticEmitterSystemData::getPad2() const { return _pad2; } + +void AcousticEmitterSystemData::setPad2(uint16_t pX) { _pad2 = pX; } + +AcousticEmitterSystem& AcousticEmitterSystemData::getAcousticEmitterSystem() { + return _acousticEmitterSystem; +} + +const AcousticEmitterSystem& +AcousticEmitterSystemData::getAcousticEmitterSystem() const { + return _acousticEmitterSystem; +} + +void AcousticEmitterSystemData::setAcousticEmitterSystem( + const AcousticEmitterSystem& pX) { + _acousticEmitterSystem = pX; +} + +Vector3Float& AcousticEmitterSystemData::getEmitterLocation() { + return _emitterLocation; +} + +const Vector3Float& AcousticEmitterSystemData::getEmitterLocation() const { + return _emitterLocation; +} + +void AcousticEmitterSystemData::setEmitterLocation(const Vector3Float& pX) { + _emitterLocation = pX; +} + +std::vector& AcousticEmitterSystemData::getBeamRecords() { + return _beamRecords; +} + +const std::vector& AcousticEmitterSystemData::getBeamRecords() + const { + return _beamRecords; +} + +void AcousticEmitterSystemData::setBeamRecords( + const std::vector& pX) { + _beamRecords = pX; +} + +void AcousticEmitterSystemData::marshal(DataStream& dataStream) const { + dataStream << _emitterSystemDataLength; + dataStream << (uint8_t)_beamRecords.size(); + dataStream << _pad2; + _acousticEmitterSystem.marshal(dataStream); + _emitterLocation.marshal(dataStream); + + for (size_t idx = 0; idx < _beamRecords.size(); idx++) { + AcousticBeamData x = _beamRecords[idx]; + x.marshal(dataStream); + } +} + +void AcousticEmitterSystemData::unmarshal(DataStream& dataStream) { + dataStream >> _emitterSystemDataLength; + dataStream >> _numberOfBeams; + dataStream >> _pad2; + _acousticEmitterSystem.unmarshal(dataStream); + _emitterLocation.unmarshal(dataStream); + + _beamRecords.clear(); + for (size_t idx = 0; idx < _numberOfBeams; idx++) { + AcousticBeamData x; + x.unmarshal(dataStream); + _beamRecords.push_back(x); + } +} + +bool AcousticEmitterSystemData::operator==( + const AcousticEmitterSystemData& rhs) const { + bool ivarsEqual = true; + + if (!(_emitterSystemDataLength == rhs._emitterSystemDataLength)) + ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_acousticEmitterSystem == rhs._acousticEmitterSystem)) + ivarsEqual = false; + if (!(_emitterLocation == rhs._emitterLocation)) ivarsEqual = false; + + for (size_t idx = 0; idx < _beamRecords.size(); idx++) { + if (!(_beamRecords[idx] == rhs._beamRecords[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int AcousticEmitterSystemData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _emitterSystemDataLength + marshalSize = marshalSize + 1; // _numberOfBeams + marshalSize = marshalSize + 2; // _pad2 + marshalSize = + marshalSize + + _acousticEmitterSystem.getMarshalledSize(); // _acousticEmitterSystem + marshalSize = + marshalSize + _emitterLocation.getMarshalledSize(); // _emitterLocation + + for (uint64_t idx = 0; idx < _beamRecords.size(); idx++) { + AcousticBeamData listElement = _beamRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/AcousticEmitterSystemData.h b/src/dis6/distributed_emissions/AcousticEmitterSystemData.h new file mode 100644 index 00000000..8ae4956e --- /dev/null +++ b/src/dis6/distributed_emissions/AcousticEmitterSystemData.h @@ -0,0 +1,103 @@ +#pragma once + +#include + +#include "dis6/common/Vector3Float.h" +#include "dis6/distributed_emissions/AcousticBeamData.h" +#include "dis6/distributed_emissions/AcousticEmitterSystem.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Used in the UA pdu; ties together an emmitter and a location. This requires +// manual cleanup; the beam data should not be attached to each emitter system. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AcousticEmitterSystemData { + protected: + /** Length of emitter system data */ + uint8_t _emitterSystemDataLength; + + /** Number of beams */ + uint8_t _numberOfBeams; + + /** padding */ + uint16_t _pad2; + + /** This field shall specify the system for a particular UA emitter. */ + AcousticEmitterSystem _acousticEmitterSystem; + + /** Represents the location wrt the entity */ + Vector3Float _emitterLocation; + + /** For each beam in numberOfBeams, an emitter system. This is not right--the + * beam records need to be at the end of the PDU, rather than attached to each + * system. */ + std::vector _beamRecords; + + public: + AcousticEmitterSystemData(); + virtual ~AcousticEmitterSystemData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getEmitterSystemDataLength() const; + void setEmitterSystemDataLength(uint8_t pX); + + uint8_t getNumberOfBeams() const; + + uint16_t getPad2() const; + void setPad2(uint16_t pX); + + AcousticEmitterSystem& getAcousticEmitterSystem(); + const AcousticEmitterSystem& getAcousticEmitterSystem() const; + void setAcousticEmitterSystem(const AcousticEmitterSystem& pX); + + Vector3Float& getEmitterLocation(); + const Vector3Float& getEmitterLocation() const; + void setEmitterLocation(const Vector3Float& pX); + + std::vector& getBeamRecords(); + const std::vector& getBeamRecords() const; + void setBeamRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AcousticEmitterSystemData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ApaData.cpp b/src/dis6/distributed_emissions/ApaData.cpp new file mode 100644 index 00000000..7169678e --- /dev/null +++ b/src/dis6/distributed_emissions/ApaData.cpp @@ -0,0 +1,76 @@ +#include "dis6/distributed_emissions/ApaData.h" + +namespace dis { +ApaData::ApaData() : parameter_index_(0), parameter_value_(0) {} + +uint16_t ApaData::GetParameterIndex() const { return parameter_index_; } + +void ApaData::SetParameterIndex(uint16_t pX) { parameter_index_ = pX; } + +int16_t ApaData::GetParameterValue() const { return parameter_value_; } + +void ApaData::SetParameterValue(int16_t pX) { parameter_value_ = pX; } + +void ApaData::Marshal(DataStream& dataStream) const { + dataStream << parameter_index_; + dataStream << parameter_value_; +} + +void ApaData::Unmarshal(DataStream& dataStream) { + dataStream >> parameter_index_; + dataStream >> parameter_value_; +} + +bool ApaData::operator==(const ApaData& rhs) const { + bool ivars_equal = true; + + if (!(parameter_index_ == rhs.parameter_index_)) { + ivars_equal = false; + } + if (!(parameter_value_ == rhs.parameter_value_)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int ApaData::GetMarshalledSize() { + int marshal_size = 0; + + marshal_size = marshal_size + 2; // _parameterIndex + marshal_size = marshal_size + 2; // _parameterValue + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/ApaData.h b/src/dis6/distributed_emissions/ApaData.h similarity index 75% rename from src/dis6/ApaData.h rename to src/dis6/distributed_emissions/ApaData.h index 2972b953..d94444e7 100644 --- a/src/dis6/ApaData.h +++ b/src/dis6/distributed_emissions/ApaData.h @@ -1,52 +1,49 @@ #pragma once -#include -#include +#include +#include "dis6/utils/DataStream.h" -namespace DIS -{ +namespace dis { // Used in UA PDU -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. // // @author DMcG, jkg -class OPENDIS6_EXPORT ApaData -{ -protected: +class ApaData { + protected: /** Index of APA parameter */ - unsigned short _parameterIndex; + uint16_t parameter_index_; // NOLINT /** Index of APA parameter */ - short _parameterValue; - + int16_t parameter_value_; // NOLINT public: - ApaData(); - virtual ~ApaData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); + ApaData(); + ~ApaData() = default; - unsigned short getParameterIndex() const; - void setParameterIndex(unsigned short pX); + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); - short getParameterValue() const; - void setParameterValue(short pX); + [[nodiscard]] uint16_t GetParameterIndex() const; + void SetParameterIndex(uint16_t pX); + [[nodiscard]] int16_t GetParameterValue() const; + void SetParameterValue(int16_t pX); -virtual int getMarshalledSize() const; + [[nodiscard]] static int GetMarshalledSize(); - bool operator ==(const ApaData& rhs) const; + bool operator==(const ApaData& rhs) const; }; -} +} // namespace dis // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright @@ -59,7 +56,7 @@ virtual int getMarshalledSize() const; // nor the names of its contributors may be used to endorse or // promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/src/dis6/distributed_emissions/BeamData.cpp b/src/dis6/distributed_emissions/BeamData.cpp new file mode 100644 index 00000000..e0f2dfe6 --- /dev/null +++ b/src/dis6/distributed_emissions/BeamData.cpp @@ -0,0 +1,113 @@ +#include "dis6/distributed_emissions/BeamData.h" + +namespace dis { +BeamData::BeamData() + : beam_azimuth_center_(0.0), + beam_azimuth_sweep_(0.0), + beam_elevation_center_(0.0), + beam_elevation_sweep_(0.0), + beam_sweep_sync_(0.0) {} + +float BeamData::GetBeamAzimuthCenter() const { return beam_azimuth_center_; } + +void BeamData::SetBeamAzimuthCenter(float pX) { beam_azimuth_center_ = pX; } + +float BeamData::GetBeamAzimuthSweep() const { return beam_azimuth_sweep_; } + +void BeamData::SetBeamAzimuthSweep(float pX) { beam_azimuth_sweep_ = pX; } + +float BeamData::GetBeamElevationCenter() const { + return beam_elevation_center_; +} + +void BeamData::SetBeamElevationCenter(float pX) { beam_elevation_center_ = pX; } + +float BeamData::GetBeamElevationSweep() const { return beam_elevation_sweep_; } + +void BeamData::SetBeamElevationSweep(float pX) { beam_elevation_sweep_ = pX; } + +float BeamData::GetBeamSweepSync() const { return beam_sweep_sync_; } + +void BeamData::SetBeamSweepSync(float pX) { beam_sweep_sync_ = pX; } + +void BeamData::Marshal(DataStream& dataStream) const { + dataStream << beam_azimuth_center_; + dataStream << beam_azimuth_sweep_; + dataStream << beam_elevation_center_; + dataStream << beam_elevation_sweep_; + dataStream << beam_sweep_sync_; +} + +void BeamData::Unmarshal(DataStream& dataStream) { + dataStream >> beam_azimuth_center_; + dataStream >> beam_azimuth_sweep_; + dataStream >> beam_elevation_center_; + dataStream >> beam_elevation_sweep_; + dataStream >> beam_sweep_sync_; +} + +bool BeamData::operator==(const BeamData& rhs) const { + bool ivars_equal = true; + + if (beam_azimuth_center_ != rhs.beam_azimuth_center_) { + ivars_equal = false; + } + if (beam_azimuth_sweep_ != rhs.beam_azimuth_sweep_) { + ivars_equal = false; + } + if (beam_elevation_center_ != rhs.beam_elevation_center_) { + ivars_equal = false; + } + if (beam_elevation_sweep_ != rhs.beam_elevation_sweep_) { + ivars_equal = false; + } + if (beam_sweep_sync_ != rhs.beam_sweep_sync_) { + ivars_equal = false; + } + + return ivars_equal; +} + +int BeamData::GetMarshalledSize() { + int marshal_size = 0; + + marshal_size = marshal_size + 4; // beam_azimuth_center_ + marshal_size = marshal_size + 4; // beam_azimuth_sweep_ + marshal_size = marshal_size + 4; // beam_elevation_center_ + marshal_size = marshal_size + 4; // beam_elevation_sweep_ + marshal_size = marshal_size + 4; // beam_sweep_sync_ + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/BeamData.h b/src/dis6/distributed_emissions/BeamData.h new file mode 100644 index 00000000..0a7cf704 --- /dev/null +++ b/src/dis6/distributed_emissions/BeamData.h @@ -0,0 +1,91 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.39. Specification of the data necessary to describe the scan +// volume of an emitter. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class BeamData { + protected: + /** Specifies the beam azimuth an elevation centers and corresponding + * half-angles to describe the scan volume */ + float beam_azimuth_center_; // NOLINT + + /** Specifies the beam azimuth sweep to determine scan volume */ + float beam_azimuth_sweep_; // NOLINT + + /** Specifies the beam elevation center to determine scan volume */ + float beam_elevation_center_; // NOLINT + + /** Specifies the beam elevation sweep to determine scan volume */ + float beam_elevation_sweep_; // NOLINT + + /** allows receiver to synchronize its regenerated scan pattern to that of + * the emmitter. Specifies the percentage of time a scan is through its + * pattern from its origion. */ + float beam_sweep_sync_; // NOLINT + + public: + BeamData(); + ~BeamData() = default; + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] float GetBeamAzimuthCenter() const; + void SetBeamAzimuthCenter(float pX); + + [[nodiscard]] float GetBeamAzimuthSweep() const; + void SetBeamAzimuthSweep(float pX); + + [[nodiscard]] float GetBeamElevationCenter() const; + void SetBeamElevationCenter(float pX); + + [[nodiscard]] float GetBeamElevationSweep() const; + void SetBeamElevationSweep(float pX); + + [[nodiscard]] float GetBeamSweepSync() const; + void SetBeamSweepSync(float pX); + + [[nodiscard]] static int GetMarshalledSize(); + + bool operator==(const BeamData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/CMakeLists.txt b/src/dis6/distributed_emissions/CMakeLists.txt new file mode 100644 index 00000000..f5cd4e99 --- /dev/null +++ b/src/dis6/distributed_emissions/CMakeLists.txt @@ -0,0 +1,39 @@ +set(distributed_emissions_hdr + DesignatorPdu.h + DistributedEmissionsFamilyPdu.h + ElectromagneticEmissionBeamData.h + ElectromagneticEmissionsPdu.h + ElectromagneticEmissionSystemData.h + EmitterSystem.h + FundamentalParameterData.h + FundamentalParameterDataIff.h + IffAtcNavAidsLayer1Pdu.h + IffAtcNavAidsLayer2Pdu.h + IffFundamentalData.h + SeesPdu.h + TrackJamTarget.h + UnderwaterAcousticsPdu.h +) + +set(distributed_emissions_src + DesignatorPdu.cpp + DistributedEmissionsFamilyPdu.cpp + ElectromagneticEmissionBeamData.cpp + ElectromagneticEmissionsPdu.cpp + ElectromagneticEmissionSystemData.cpp + EmitterSystem.cpp + FundamentalParameterData.cpp + FundamentalParameterDataIff.cpp + IffAtcNavAidsLayer1Pdu.cpp + IffAtcNavAidsLayer2Pdu.cpp + IffFundamentalData.cpp + SeesPdu.cpp + TrackJamTarget.cpp + UnderwaterAcousticsPdu.cpp +) + +target_sources(OpenDIS6 PRIVATE ${distributed_emissions_src}) + +install(FILES ${distributed_emissions_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/distributed_emissions +) diff --git a/src/dis6/distributed_emissions/DesignatorPdu.cpp b/src/dis6/distributed_emissions/DesignatorPdu.cpp new file mode 100644 index 00000000..5d97c024 --- /dev/null +++ b/src/dis6/distributed_emissions/DesignatorPdu.cpp @@ -0,0 +1,231 @@ +#include "dis6/distributed_emissions/DesignatorPdu.h" + +namespace dis { +DesignatorPdu::DesignatorPdu() + : _codeName(0), + + _designatorCode(0), + _designatorPower(0.0), + _designatorWavelength(0.0), + + _deadReckoningAlgorithm(0), + _padding1(0), + _padding2(0) { + SetPduType(24); +} + +DesignatorPdu::~DesignatorPdu() = default; + +EntityID& DesignatorPdu::getDesignatingEntityID() { + return _designatingEntityID; +} + +const EntityID& DesignatorPdu::getDesignatingEntityID() const { + return _designatingEntityID; +} + +void DesignatorPdu::setDesignatingEntityID(const EntityID& pX) { + _designatingEntityID = pX; +} + +uint16_t DesignatorPdu::getCodeName() const { return _codeName; } + +void DesignatorPdu::setCodeName(uint16_t pX) { _codeName = pX; } + +EntityID& DesignatorPdu::getDesignatedEntityID() { return _designatedEntityID; } + +const EntityID& DesignatorPdu::getDesignatedEntityID() const { + return _designatedEntityID; +} + +void DesignatorPdu::setDesignatedEntityID(const EntityID& pX) { + _designatedEntityID = pX; +} + +uint16_t DesignatorPdu::getDesignatorCode() const { return _designatorCode; } + +void DesignatorPdu::setDesignatorCode(uint16_t pX) { _designatorCode = pX; } + +float DesignatorPdu::getDesignatorPower() const { return _designatorPower; } + +void DesignatorPdu::setDesignatorPower(float pX) { _designatorPower = pX; } + +float DesignatorPdu::getDesignatorWavelength() const { + return _designatorWavelength; +} + +void DesignatorPdu::setDesignatorWavelength(float pX) { + _designatorWavelength = pX; +} + +Vector3Float& DesignatorPdu::getDesignatorSpotWrtDesignated() { + return _designatorSpotWrtDesignated; +} + +const Vector3Float& DesignatorPdu::getDesignatorSpotWrtDesignated() const { + return _designatorSpotWrtDesignated; +} + +void DesignatorPdu::setDesignatorSpotWrtDesignated(const Vector3Float& pX) { + _designatorSpotWrtDesignated = pX; +} + +Vector3Double& DesignatorPdu::getDesignatorSpotLocation() { + return _designatorSpotLocation; +} + +const Vector3Double& DesignatorPdu::getDesignatorSpotLocation() const { + return _designatorSpotLocation; +} + +void DesignatorPdu::setDesignatorSpotLocation(const Vector3Double& pX) { + _designatorSpotLocation = pX; +} + +char DesignatorPdu::getDeadReckoningAlgorithm() const { + return _deadReckoningAlgorithm; +} + +void DesignatorPdu::setDeadReckoningAlgorithm(char pX) { + _deadReckoningAlgorithm = pX; +} + +uint16_t DesignatorPdu::getPadding1() const { return _padding1; } + +void DesignatorPdu::setPadding1(uint16_t pX) { _padding1 = pX; } + +char DesignatorPdu::getPadding2() const { return _padding2; } + +void DesignatorPdu::setPadding2(char pX) { _padding2 = pX; } + +Vector3Float& DesignatorPdu::getEntityLinearAcceleration() { + return _entityLinearAcceleration; +} + +const Vector3Float& DesignatorPdu::getEntityLinearAcceleration() const { + return _entityLinearAcceleration; +} + +void DesignatorPdu::setEntityLinearAcceleration(const Vector3Float& pX) { + _entityLinearAcceleration = pX; +} + +void DesignatorPdu::Marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + data_stream); // Marshal information in superclass first + _designatingEntityID.Marshal(dataStream); + dataStream << _codeName; + _designatedEntityID.Marshal(dataStream); + dataStream << _designatorCode; + dataStream << _designatorPower; + dataStream << _designatorWavelength; + _designatorSpotWrtDesignated.marshal(dataStream); + _designatorSpotLocation.marshal(dataStream); + dataStream << _deadReckoningAlgorithm; + dataStream << _padding1; + dataStream << _padding2; + _entityLinearAcceleration.marshal(dataStream); +} + +void DesignatorPdu::Unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + data_stream); // unmarshal information in superclass first + _designatingEntityID.unmarshal(dataStream); + dataStream >> _codeName; + _designatedEntityID.unmarshal(dataStream); + dataStream >> _designatorCode; + dataStream >> _designatorPower; + dataStream >> _designatorWavelength; + _designatorSpotWrtDesignated.unmarshal(dataStream); + _designatorSpotLocation.unmarshal(dataStream); + dataStream >> _deadReckoningAlgorithm; + dataStream >> _padding1; + dataStream >> _padding2; + _entityLinearAcceleration.unmarshal(dataStream); +} + +bool DesignatorPdu::operator==(const DesignatorPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_designatingEntityID == rhs._designatingEntityID)) ivarsEqual = false; + if (!(_codeName == rhs._codeName)) ivarsEqual = false; + if (!(_designatedEntityID == rhs._designatedEntityID)) ivarsEqual = false; + if (!(_designatorCode == rhs._designatorCode)) ivarsEqual = false; + if (!(_designatorPower == rhs._designatorPower)) ivarsEqual = false; + if (!(_designatorWavelength == rhs._designatorWavelength)) ivarsEqual = false; + if (!(_designatorSpotWrtDesignated == rhs._designatorSpotWrtDesignated)) + ivarsEqual = false; + if (!(_designatorSpotLocation == rhs._designatorSpotLocation)) + ivarsEqual = false; + if (!(_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm)) + ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_entityLinearAcceleration == rhs._entityLinearAcceleration)) + ivarsEqual = false; + + return ivarsEqual; +} + +int DesignatorPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + + _designatingEntityID.getMarshalledSize(); // _designatingEntityID + marshalSize = marshalSize + 2; // _codeName + marshalSize = marshalSize + + _designatedEntityID.getMarshalledSize(); // _designatedEntityID + marshalSize = marshalSize + 2; // _designatorCode + marshalSize = marshalSize + 4; // _designatorPower + marshalSize = marshalSize + 4; // _designatorWavelength + marshalSize = + marshalSize + _designatorSpotWrtDesignated + .getMarshalledSize(); // _designatorSpotWrtDesignated + marshalSize = + marshalSize + + _designatorSpotLocation.getMarshalledSize(); // _designatorSpotLocation + marshalSize = marshalSize + 1; // _deadReckoningAlgorithm + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 1; // _padding2 + marshalSize = + marshalSize + _entityLinearAcceleration + .getMarshalledSize(); // _entityLinearAcceleration + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/DesignatorPdu.h b/src/dis6/distributed_emissions/DesignatorPdu.h new file mode 100644 index 00000000..4851aa6d --- /dev/null +++ b/src/dis6/distributed_emissions/DesignatorPdu.h @@ -0,0 +1,143 @@ +#pragma once + +#include + +#include "dis6/common/EntityID.h" +#include "dis6/common/Vector3Double.h" +#include "dis6/common/Vector3Float.h" +#include "dis6/distributed_emissions/DistributedEmissionsFamilyPdu.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.3.7.2. Handles designating operations. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class DesignatorPdu final : public DistributedEmissionsFamilyPdu { + protected: + /** ID of the entity designating */ + EntityID designating_entity_id_; // NOLINT + + /** This field shall specify a unique emitter database number assigned to + * differentiate between otherwise similar or identical emitter beams within + * an emitter system. */ + uint16_t code_name_; // NOLINT + + /** ID of the entity being designated */ + EntityID designated_entity_id_; // NOLINT + + /** This field shall identify the designator code being used by the + * designating entity */ + uint16_t designator_code_; // NOLINT + + /** This field shall identify the designator output power in watts */ + float designator_power_; // NOLINT + + /** This field shall identify the designator wavelength in units of microns */ + float designator_wavelength_; // NOLINT + + /** designtor spot wrt the designated entity */ + Vector3Float designator_spot_wrt_designated_; // NOLINT + + /** designtor spot wrt the designated entity */ + Vector3Double designator_spot_location_; // NOLINT + + /** Dead reckoning algorithm */ + char dead_reckoning_algorithm_; // NOLINT + + /** padding */ + uint16_t padding1_; // NOLINT + + /** padding */ + char padding2_; // NOLINT + + /** linear accelleration of entity */ + Vector3Float entity_linear_acceleration_; // NOLINT + + public: + DesignatorPdu(); + ~DesignatorPdu() final; + + void Marshal(DataStream& dataStream) const override; + void Unmarshal(DataStream& dataStream) override; + + EntityID& GetDesignatingEntityId(); + [[nodiscard]] const EntityID& GetDesignatingEntityId() const; + void SetDesignatingEntityId(const EntityID& pX); + + [[nodiscard]] uint16_t GetCodeName() const; + void SetCodeName(uint16_t pX); + + EntityID& GetDesignatedEntityId(); + [[nodiscard]] const EntityID& GetDesignatedEntityId() const; + void SetDesignatedEntityId(const EntityID& pX); + + [[nodiscard]] uint16_t GetDesignatorCode() const; + void SetDesignatorCode(uint16_t pX); + + [[nodiscard]] float GetDesignatorPower() const; + void SetDesignatorPower(float pX); + + [[nodiscard]] float GetDesignatorWavelength() const; + void SetDesignatorWavelength(float pX); + + Vector3Float& GetDesignatorSpotWrtDesignated(); + [[nodiscard]] const Vector3Float& GetDesignatorSpotWrtDesignated() const; + void SetDesignatorSpotWrtDesignated(const Vector3Float& pX); + + Vector3Double& GetDesignatorSpotLocation(); + [[nodiscard]] const Vector3Double& GetDesignatorSpotLocation() const; + void SetDesignatorSpotLocation(const Vector3Double& pX); + + [[nodiscard]] char GetDeadReckoningAlgorithm() const; + void SetDeadReckoningAlgorithm(char pX); + + [[nodiscard]] uint16_t GetPadding1() const; + void SetPadding1(uint16_t pX); + + [[nodiscard]] char GetPadding2() const; + void SetPadding2(char pX); + + Vector3Float& GetEntityLinearAcceleration(); + [[nodiscard]] const Vector3Float& GetEntityLinearAcceleration() const; + void SetEntityLinearAcceleration(const Vector3Float& pX); + + [[nodiscard]] int GetMarshalledSize() const override; + + bool operator==(const DesignatorPdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/DistributedEmissionsFamilyPdu.cpp b/src/dis6/distributed_emissions/DistributedEmissionsFamilyPdu.cpp new file mode 100644 index 00000000..9206cb09 --- /dev/null +++ b/src/dis6/distributed_emissions/DistributedEmissionsFamilyPdu.cpp @@ -0,0 +1,67 @@ +#include "dis6/DistributedEmissionsFamilyPdu.h" + +using namespace DIS; + +DistributedEmissionsFamilyPdu::DistributedEmissionsFamilyPdu() + : Pdu() + +{ + setProtocolFamily(6); +} + +DistributedEmissionsFamilyPdu::~DistributedEmissionsFamilyPdu() {} + +void DistributedEmissionsFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void DistributedEmissionsFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool DistributedEmissionsFamilyPdu::operator==( + const DistributedEmissionsFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int DistributedEmissionsFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/DistributedEmissionsFamilyPdu.h b/src/dis6/distributed_emissions/DistributedEmissionsFamilyPdu.h new file mode 100644 index 00000000..07cfbcc0 --- /dev/null +++ b/src/dis6/distributed_emissions/DistributedEmissionsFamilyPdu.h @@ -0,0 +1,59 @@ +#pragma once + +#include "dis6/common/Pdu.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.3.7. Electromagnetic Emissions. Abstract superclass for distirubted +// emissions PDU + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class DistributedEmissionsFamilyPdu : public Pdu { + protected: + public: + DistributedEmissionsFamilyPdu(); + ~DistributedEmissionsFamilyPdu() override; + + void Marshal(DataStream& dataStream) const override; + void Unmarshal(DataStream& dataStream) override; + + [[nodiscard]] int GetMarshalledSize() const override; + + bool operator==(const DistributedEmissionsFamilyPdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ElectromagneticEmissionBeamData.cpp b/src/dis6/distributed_emissions/ElectromagneticEmissionBeamData.cpp new file mode 100644 index 00000000..65d87b35 --- /dev/null +++ b/src/dis6/distributed_emissions/ElectromagneticEmissionBeamData.cpp @@ -0,0 +1,223 @@ +#include "dis6/distributed_emissions/ElectromagneticEmissionBeamData.h" + +namespace dis { +ElectromagneticEmissionBeamData::ElectromagneticEmissionBeamData() + : beam_data_length_(0), + beam_id_number_(0), + beam_parameter_index_(0), + beam_function_(0), + number_of_track_jam_targets_(0), + high_density_track_jam_(0), + pad4_(0), + jamming_mode_sequence_(0) {} + +ElectromagneticEmissionBeamData::~ElectromagneticEmissionBeamData() { + track_jam_targets_.clear(); +} + +uint8_t ElectromagneticEmissionBeamData::GetBeamDataLength() const { + return beam_data_length_; +} + +void ElectromagneticEmissionBeamData::SetBeamDataLength(uint8_t pX) { + beam_data_length_ = pX; +} + +uint8_t ElectromagneticEmissionBeamData::GetBeamIdNumber() const { + return beam_id_number_; +} + +void ElectromagneticEmissionBeamData::SetBeamIdNumber(uint8_t pX) { + beam_id_number_ = pX; +} + +uint16_t ElectromagneticEmissionBeamData::GetBeamParameterIndex() const { + return beam_parameter_index_; +} + +void ElectromagneticEmissionBeamData::SetBeamParameterIndex(uint16_t pX) { + beam_parameter_index_ = pX; +} + +FundamentalParameterData& +ElectromagneticEmissionBeamData::GetFundamentalParameterData() { + return fundamental_parameter_data_; +} + +const FundamentalParameterData& +ElectromagneticEmissionBeamData::GetFundamentalParameterData() const { + return fundamental_parameter_data_; +} + +void ElectromagneticEmissionBeamData::SetFundamentalParameterData( + const FundamentalParameterData& pX) { + fundamental_parameter_data_ = pX; +} + +uint8_t ElectromagneticEmissionBeamData::GetBeamFunction() const { + return beam_function_; +} + +void ElectromagneticEmissionBeamData::SetBeamFunction(uint8_t pX) { + beam_function_ = pX; +} + +uint8_t ElectromagneticEmissionBeamData::GetNumberOfTrackJamTargets() const { + return track_jam_targets_.size(); +} + +uint8_t ElectromagneticEmissionBeamData::GetHighDensityTrackJam() const { + return high_density_track_jam_; +} + +void ElectromagneticEmissionBeamData::SetHighDensityTrackJam(uint8_t pX) { + high_density_track_jam_ = pX; +} + +uint8_t ElectromagneticEmissionBeamData::GetPad4() const { return pad4_; } + +void ElectromagneticEmissionBeamData::SetPad4(uint8_t pX) { pad4_ = pX; } + +uint32_t ElectromagneticEmissionBeamData::GetJammingModeSequence() const { + return jamming_mode_sequence_; +} + +void ElectromagneticEmissionBeamData::SetJammingModeSequence(uint32_t pX) { + jamming_mode_sequence_ = pX; +} + +std::vector& +ElectromagneticEmissionBeamData::GetTrackJamTargets() { + return track_jam_targets_; +} + +const std::vector& +ElectromagneticEmissionBeamData::GetTrackJamTargets() const { + return track_jam_targets_; +} + +void ElectromagneticEmissionBeamData::SetTrackJamTargets( + const std::vector& pX) { + track_jam_targets_ = pX; +} + +void ElectromagneticEmissionBeamData::Marshal(DataStream& dataStream) const { + dataStream << beam_data_length_; + dataStream << beam_id_number_; + dataStream << beam_parameter_index_; + fundamental_parameter_data_.Marshal(dataStream); + dataStream << beam_function_; + dataStream << static_cast(track_jam_targets_.size()); + dataStream << high_density_track_jam_; + dataStream << pad4_; + dataStream << jamming_mode_sequence_; + + for (const auto& x : track_jam_targets_) { + x.marshal(dataStream); + } +} + +void ElectromagneticEmissionBeamData::Unmarshal(DataStream& dataStream) { + dataStream >> beam_data_length_; + dataStream >> beam_id_number_; + dataStream >> beam_parameter_index_; + fundamental_parameter_data_.unmarshal(dataStream); + dataStream >> beam_function_; + dataStream >> number_of_track_jam_targets_; + dataStream >> high_density_track_jam_; + dataStream >> pad4_; + dataStream >> jamming_mode_sequence_; + + track_jam_targets_.clear(); + for (size_t idx = 0; idx < number_of_track_jam_targets_; idx++) { + TrackJamTarget x; + x.Unmarshal(dataStream); + track_jam_targets_.push_back(x); + } +} + +bool ElectromagneticEmissionBeamData::operator==( + const ElectromagneticEmissionBeamData& rhs) const { + bool ivars_equal = true; + + if (!(beam_data_length_ == rhs.beam_data_length_)) { + ivars_equal = false; + } + if (!(beam_id_number_ == rhs.beam_id_number_)) { + ivars_equal = false; + } + if (!(beam_parameter_index_ == rhs.beam_parameter_index_)) { + ivars_equal = false; + } + if (!(fundamental_parameter_data_ == rhs.fundamental_parameter_data_)) { + ivars_equal = false; + } + if (!(beam_function_ == rhs.beam_function_)) { + ivars_equal = false; + } + if (!(high_density_track_jam_ == rhs.high_density_track_jam_)) { + ivars_equal = false; + } + if (!(pad4_ == rhs.pad4_)) { + ivars_equal = false; + } + if (!(jamming_mode_sequence_ == rhs.jamming_mode_sequence_)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < track_jam_targets_.size(); idx++) { + if (!(track_jam_targets_[idx] == rhs.track_jam_targets_[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +size_t ElectromagneticEmissionBeamData::GetMarshalledSize() const { + size_t marshal_size = + sizeof(beam_data_length_) + sizeof(beam_id_number_) + + sizeof(beam_parameter_index_) + + fundamental_parameter_data_.GetMarshalledSize() + sizeof(beam_function_) + + sizeof(number_of_track_jam_targets_) + sizeof(high_density_track_jam_) + + sizeof(pad4_) + sizeof(jamming_mode_sequence_); + + for (const auto& list_element : track_jam_targets_) { + marshal_size += list_element.GetMarshalledSize(); + } + + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ElectromagneticEmissionBeamData.h b/src/dis6/distributed_emissions/ElectromagneticEmissionBeamData.h new file mode 100644 index 00000000..6dac73a8 --- /dev/null +++ b/src/dis6/distributed_emissions/ElectromagneticEmissionBeamData.h @@ -0,0 +1,129 @@ +#pragma once + +#include + +#include "dis6/distributed_emissions/FundamentalParameterData.h" +#include "dis6/distributed_emissions/TrackJamTarget.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Description of one electronic emission beam + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ElectromagneticEmissionBeamData { + protected: + /** This field shall specify the length of this beams data in 32 bit words */ + uint8_t beam_data_length_; + + /** This field shall specify a unique emitter database number assigned to + * differentiate between otherwise similar or identical emitter beams within + * an emitter system. */ + uint8_t beam_id_number_; + + /** This field shall specify a Beam Parameter Index number that shall be used + * by receiving entities in conjunction with the Emitter Name field to provide + * a pointer to the stored database parameters required to regenerate the + * beam. */ + uint16_t beam_parameter_index_; + + /** Fundamental parameter data such as frequency range, beam sweep, etc. */ + FundamentalParameterData fundamental_parameter_data_; + + /** beam function of a particular beam */ + uint8_t beam_function_; + + /** Number of track/jam targets */ + uint8_t number_of_track_jam_targets_; + + /** wheher or not the receiving simulation apps can assume all the targets in + * the scan pattern are being tracked/jammed */ + uint8_t high_density_track_jam_; + + /** padding */ + uint8_t pad4_; + + /** identify jamming techniques used */ + uint32_t jamming_mode_sequence_; + + /** variable length list of track/jam targets */ + std::vector track_jam_targets_; + + public: + ElectromagneticEmissionBeamData(); + ~ElectromagneticEmissionBeamData(); + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint8_t GetBeamDataLength() const; + void SetBeamDataLength(uint8_t pX); + + [[nodiscard]] uint8_t GetBeamIdNumber() const; + void SetBeamIdNumber(uint8_t pX); + + [[nodiscard]] uint16_t GetBeamParameterIndex() const; + void SetBeamParameterIndex(uint16_t pX); + + FundamentalParameterData& GetFundamentalParameterData(); + [[nodiscard]] const FundamentalParameterData& GetFundamentalParameterData() + const; + void SetFundamentalParameterData(const FundamentalParameterData& pX); + + [[nodiscard]] uint8_t GetBeamFunction() const; + void SetBeamFunction(uint8_t pX); + + [[nodiscard]] uint8_t GetNumberOfTrackJamTargets() const; + + [[nodiscard]] uint8_t GetHighDensityTrackJam() const; + void SetHighDensityTrackJam(uint8_t pX); + + [[nodiscard]] uint8_t GetPad4() const; + void SetPad4(uint8_t pX); + + [[nodiscard]] uint32_t GetJammingModeSequence() const; + void SetJammingModeSequence(uint32_t pX); + + std::vector& GetTrackJamTargets(); + [[nodiscard]] const std::vector& GetTrackJamTargets() const; + void SetTrackJamTargets(const std::vector& pX); + + [[nodiscard]] size_t GetMarshalledSize() const; + + bool operator==(const ElectromagneticEmissionBeamData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ElectromagneticEmissionSystemData.cpp b/src/dis6/distributed_emissions/ElectromagneticEmissionSystemData.cpp new file mode 100644 index 00000000..7eb5f026 --- /dev/null +++ b/src/dis6/distributed_emissions/ElectromagneticEmissionSystemData.cpp @@ -0,0 +1,169 @@ +#include "dis6/distributed_emissions/ElectromagneticEmissionSystemData.h" + +namespace dis { +ElectromagneticEmissionSystemData::ElectromagneticEmissionSystemData() + : system_data_length_(0), number_of_beams_(0), emissions_padding2_(0) {} + +ElectromagneticEmissionSystemData::~ElectromagneticEmissionSystemData() { + beam_data_records_.clear(); +} + +uint8_t ElectromagneticEmissionSystemData::GetSystemDataLength() const { + return system_data_length_; +} + +void ElectromagneticEmissionSystemData::SetSystemDataLength(uint8_t pX) { + system_data_length_ = pX; +} + +uint8_t ElectromagneticEmissionSystemData::GetNumberOfBeams() const { + return beam_data_records_.size(); +} + +uint16_t ElectromagneticEmissionSystemData::GetEmissionsPadding2() const { + return emissions_padding2_; +} + +void ElectromagneticEmissionSystemData::SetEmissionsPadding2(uint16_t pX) { + emissions_padding2_ = pX; +} + +EmitterSystem& ElectromagneticEmissionSystemData::GetEmitterSystem() { + return emitter_system_; +} + +const EmitterSystem& ElectromagneticEmissionSystemData::GetEmitterSystem() + const { + return emitter_system_; +} + +void ElectromagneticEmissionSystemData::SetEmitterSystem( + const EmitterSystem& pX) { + emitter_system_ = pX; +} + +Vector3Float& ElectromagneticEmissionSystemData::GetLocation() { + return location_; +} + +const Vector3Float& ElectromagneticEmissionSystemData::GetLocation() const { + return location_; +} + +void ElectromagneticEmissionSystemData::SetLocation(const Vector3Float& pX) { + location_ = pX; +} + +std::vector& +ElectromagneticEmissionSystemData::GetBeamDataRecords() { + return beam_data_records_; +} + +const std::vector& +ElectromagneticEmissionSystemData::GetBeamDataRecords() const { + return beam_data_records_; +} + +void ElectromagneticEmissionSystemData::SetBeamDataRecords( + const std::vector& pX) { + beam_data_records_ = pX; +} + +void ElectromagneticEmissionSystemData::Marshal(DataStream& dataStream) const { + dataStream << system_data_length_; + dataStream << static_cast(beam_data_records_.size()); + dataStream << emissions_padding2_; + emitter_system_.Marshal(dataStream); + location_.Marshal(dataStream); + + for (const auto& x : beam_data_records_) { + x.Marshal(dataStream); + } +} + +void ElectromagneticEmissionSystemData::Unmarshal(DataStream& dataStream) { + dataStream >> system_data_length_; + dataStream >> number_of_beams_; + dataStream >> emissions_padding2_; + emitter_system_.Unmarshal(dataStream); + location_.Unmarshal(dataStream); + + beam_data_records_.clear(); + for (size_t idx = 0; idx < number_of_beams_; idx++) { + ElectromagneticEmissionBeamData x; + x.Unmarshal(dataStream); + beam_data_records_.push_back(x); + } +} + +bool ElectromagneticEmissionSystemData::operator==( + const ElectromagneticEmissionSystemData& rhs) const { + bool ivars_equal = true; + + if (!(system_data_length_ == rhs.system_data_length_)) { + ivars_equal = false; + } + if (!(emissions_padding2_ == rhs.emissions_padding2_)) { + ivars_equal = false; + } + if (!(emitter_system_ == rhs.emitter_system_)) { + ivars_equal = false; + } + if (!(location_ == rhs.location_)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < beam_data_records_.size(); idx++) { + if (!(beam_data_records_[idx] == rhs.beam_data_records_[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +size_t ElectromagneticEmissionSystemData::GetMarshalledSize() const { + size_t marshal_size = sizeof(system_data_length_) + sizeof(number_of_beams_) + + sizeof(emissions_padding2_) + + emitter_system_.GetMarshalledSize() + + location_.GetMarshalledSize(); + + for (const auto& list_element : beam_data_records_) { + marshal_size += list_element.GetMarshalledSize(); + } + + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ElectromagneticEmissionSystemData.h b/src/dis6/distributed_emissions/ElectromagneticEmissionSystemData.h new file mode 100644 index 00000000..ea274cfc --- /dev/null +++ b/src/dis6/distributed_emissions/ElectromagneticEmissionSystemData.h @@ -0,0 +1,105 @@ +#pragma once + +#include + +#include "dis6/common/Vector3Float.h" +#include "dis6/distributed_emissions/ElectromagneticEmissionBeamData.h" +#include "dis6/distributed_emissions/EmitterSystem.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Data about one electronic system + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ElectromagneticEmissionSystemData { + protected: + /** This field shall specify the length of this emitter system�s data + * (including beam data and its track/jam information) in 32-bit words. The + * length shall include the System Data Length field. */ + uint8_t system_data_length_; + + /** This field shall specify the number of beams being described in the + * current PDU for the system being described. */ + uint8_t number_of_beams_; + + /** padding. */ + uint16_t emissions_padding2_; + + /** This field shall specify information about a particular emitter system */ + EmitterSystem emitter_system_; + + /** Location with respect to the entity */ + Vector3Float location_; + + /** variable length list of beam data records */ + std::vector beam_data_records_; + + public: + ElectromagneticEmissionSystemData(); + ~ElectromagneticEmissionSystemData(); + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint8_t GetSystemDataLength() const; + void SetSystemDataLength(uint8_t pX); + + [[nodiscard]] uint8_t GetNumberOfBeams() const; + + [[nodiscard]] uint16_t GetEmissionsPadding2() const; + void SetEmissionsPadding2(uint16_t pX); + + EmitterSystem& GetEmitterSystem(); + [[nodiscard]] const EmitterSystem& GetEmitterSystem() const; + void SetEmitterSystem(const EmitterSystem& pX); + + Vector3Float& GetLocation(); + [[nodiscard]] const Vector3Float& GetLocation() const; + void SetLocation(const Vector3Float& pX); + + std::vector& GetBeamDataRecords(); + [[nodiscard]] const std::vector& + GetBeamDataRecords() const; + void SetBeamDataRecords( + const std::vector& pX); + + [[nodiscard]] size_t GetMarshalledSize() const; + + bool operator==(const ElectromagneticEmissionSystemData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ElectromagneticEmissionsPdu.cpp b/src/dis6/distributed_emissions/ElectromagneticEmissionsPdu.cpp new file mode 100644 index 00000000..66dfb900 --- /dev/null +++ b/src/dis6/distributed_emissions/ElectromagneticEmissionsPdu.cpp @@ -0,0 +1,177 @@ +#include "dis6/distributed_emissions/ElectromagneticEmissionsPdu.h" + +namespace dis { + +ElectromagneticEmissionsPdu::ElectromagneticEmissionsPdu() + :, + , + _stateUpdateIndicator(0), + _numberOfSystems(0), + _paddingForEmissionsPdu(0) { + SetPduType(23); + setPaddingForEmissionsPdu(0); +} + +ElectromagneticEmissionsPdu::~ElectromagneticEmissionsPdu() { + _systems.clear(); +} + +EntityID& ElectromagneticEmissionsPdu::getEmittingEntityID() { + return _emittingEntityID; +} + +const EntityID& ElectromagneticEmissionsPdu::getEmittingEntityID() const { + return _emittingEntityID; +} + +void ElectromagneticEmissionsPdu::setEmittingEntityID(const EntityID& pX) { + _emittingEntityID = pX; +} + +EventID& ElectromagneticEmissionsPdu::getEventID() { return _eventID; } + +const EventID& ElectromagneticEmissionsPdu::getEventID() const { + return _eventID; +} + +void ElectromagneticEmissionsPdu::setEventID(const EventID& pX) { + _eventID = pX; +} + +uint8_t ElectromagneticEmissionsPdu::getStateUpdateIndicator() const { + return _stateUpdateIndicator; +} + +void ElectromagneticEmissionsPdu::setStateUpdateIndicator(uint8_t pX) { + _stateUpdateIndicator = pX; +} + +uint8_t ElectromagneticEmissionsPdu::getNumberOfSystems() const { + return _systems.size(); +} + +uint16_t ElectromagneticEmissionsPdu::getPaddingForEmissionsPdu() const { + return _paddingForEmissionsPdu; +} + +void ElectromagneticEmissionsPdu::setPaddingForEmissionsPdu(uint16_t pX) { + _paddingForEmissionsPdu = pX; +} + +std::vector& +ElectromagneticEmissionsPdu::getSystems() { + return _systems; +} + +const std::vector& +ElectromagneticEmissionsPdu::getSystems() const { + return _systems; +} + +void ElectromagneticEmissionsPdu::setSystems( + const std::vector& pX) { + _systems = pX; +} + +void ElectromagneticEmissionsPdu::marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _emittingEntityID.marshal(dataStream); + _eventID.marshal(dataStream); + dataStream << _stateUpdateIndicator; + dataStream << (uint8_t)_systems.size(); + dataStream << _paddingForEmissionsPdu; + + for (size_t idx = 0; idx < _systems.size(); idx++) { + ElectromagneticEmissionSystemData x = _systems[idx]; + x.marshal(dataStream); + } +} + +void ElectromagneticEmissionsPdu::unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _emittingEntityID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + dataStream >> _stateUpdateIndicator; + dataStream >> _numberOfSystems; + dataStream >> _paddingForEmissionsPdu; + + _systems.clear(); + for (size_t idx = 0; idx < _numberOfSystems; idx++) { + ElectromagneticEmissionSystemData x; + x.unmarshal(dataStream); + _systems.push_back(x); + } +} + +bool ElectromagneticEmissionsPdu::operator==( + const ElectromagneticEmissionsPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_emittingEntityID == rhs._emittingEntityID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_stateUpdateIndicator == rhs._stateUpdateIndicator)) ivarsEqual = false; + if (!(_paddingForEmissionsPdu == rhs._paddingForEmissionsPdu)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _systems.size(); idx++) { + if (!(_systems[idx] == rhs._systems[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ElectromagneticEmissionsPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + 1; // _stateUpdateIndicator + marshalSize = marshalSize + 1; // _numberOfSystems + marshalSize = marshalSize + 2; // _paddingForEmissionsPdu + + for (uint64_t idx = 0; idx < _systems.size(); idx++) { + ElectromagneticEmissionSystemData listElement = _systems[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ElectromagneticEmissionsPdu.h b/src/dis6/distributed_emissions/ElectromagneticEmissionsPdu.h new file mode 100644 index 00000000..654b7752 --- /dev/null +++ b/src/dis6/distributed_emissions/ElectromagneticEmissionsPdu.h @@ -0,0 +1,107 @@ +#pragma once + +#include + +#include "dis6/common/EntityID.h" +#include "dis6/common/EventID.h" +#include "dis6/distributed_emissions/DistributedEmissionsFamilyPdu.h" +#include "dis6/distributed_emissions/ElectromagneticEmissionSystemData.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.3.7.1. Information about active electronic warfare (EW) emissions +// and active EW countermeasures shall be communicated using an Electromagnetic +// Emission PDU. COMPLETE (I think) + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ElectromagneticEmissionsPdu : public DistributedEmissionsFamilyPdu { + protected: + /** ID of the entity emitting */ + EntityID _emittingEntityID; + + /** ID of event */ + EventID _eventID; + + /** This field shall be used to indicate if the data in the PDU represents a + * state update or just data that has changed since issuance of the last + * Electromagnetic Emission PDU [relative to the identified entity and + * emission system(s)]. */ + uint8_t _stateUpdateIndicator; + + /** This field shall specify the number of emission systems being described in + * the current PDU. */ + uint8_t _numberOfSystems; + + /** padding */ + uint16_t _paddingForEmissionsPdu; + + /** Electromagnetic emmissions systems */ + std::vector _systems; + + public: + ElectromagneticEmissionsPdu(); + ~ElectromagneticEmissionsPdu() override; + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEmittingEntityID(); + const EntityID& getEmittingEntityID() const; + void setEmittingEntityID(const EntityID& pX); + + EventID& getEventID(); + const EventID& getEventID() const; + void setEventID(const EventID& pX); + + uint8_t getStateUpdateIndicator() const; + void setStateUpdateIndicator(uint8_t pX); + + uint8_t getNumberOfSystems() const; + + uint16_t getPaddingForEmissionsPdu() const; + void setPaddingForEmissionsPdu(uint16_t pX); + + std::vector& getSystems(); + const std::vector& getSystems() const; + void setSystems(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ElectromagneticEmissionsPdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/EmitterSystem.cpp b/src/dis6/distributed_emissions/EmitterSystem.cpp new file mode 100644 index 00000000..85680d30 --- /dev/null +++ b/src/dis6/distributed_emissions/EmitterSystem.cpp @@ -0,0 +1,82 @@ +#include "dis6/distributed_emissions/EmitterSystem.h" + +namespace dis { + +EmitterSystem::EmitterSystem() + : _emitterName(0), _function(0), _emitterIdNumber(0) {} + +uint16_t EmitterSystem::getEmitterName() const { return _emitterName; } + +void EmitterSystem::setEmitterName(uint16_t pX) { _emitterName = pX; } + +uint8_t EmitterSystem::getFunction() const { return _function; } + +void EmitterSystem::setFunction(uint8_t pX) { _function = pX; } + +uint8_t EmitterSystem::getEmitterIdNumber() const { return _emitterIdNumber; } + +void EmitterSystem::setEmitterIdNumber(uint8_t pX) { _emitterIdNumber = pX; } + +void EmitterSystem::marshal(DataStream& dataStream) const { + dataStream << _emitterName; + dataStream << _function; + dataStream << _emitterIdNumber; +} + +void EmitterSystem::unmarshal(DataStream& dataStream) { + dataStream >> _emitterName; + dataStream >> _function; + dataStream >> _emitterIdNumber; +} + +bool EmitterSystem::operator==(const EmitterSystem& rhs) const { + bool ivarsEqual = true; + + if (!(_emitterName == rhs._emitterName)) ivarsEqual = false; + if (!(_function == rhs._function)) ivarsEqual = false; + if (!(_emitterIdNumber == rhs._emitterIdNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int EmitterSystem::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _emitterName + marshalSize = marshalSize + 1; // _function + marshalSize = marshalSize + 1; // _emitterIdNumber + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/EmitterSystem.h b/src/dis6/distributed_emissions/EmitterSystem.h new file mode 100644 index 00000000..89dd6000 --- /dev/null +++ b/src/dis6/distributed_emissions/EmitterSystem.h @@ -0,0 +1,78 @@ +#pragma once + +#include + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.11. This field shall specify information about a particular +// emitter system + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EmitterSystem { + protected: + /** Name of the emitter, 16 bit enumeration */ + uint16_t emitter_name_; + + /** function of the emitter, 8 bit enumeration */ + uint8_t function_; + + /** emitter ID, 8 bit enumeration */ + uint8_t emitter_id_number_; + + public: + EmitterSystem(); + ~EmitterSystem() = default; + + void Marshal(DataStream& dataStream) const; + void Unmarshal(DataStream& dataStream); + + [[nodiscard]] uint16_t GetEmitterName() const; + void SetEmitterName(uint16_t pX); + + [[nodiscard]] uint8_t GetFunction() const; + void SetFunction(uint8_t pX); + + [[nodiscard]] uint8_t GetEmitterIdNumber() const; + void SetEmitterIdNumber(uint8_t pX); + + [[nodiscard]] int GetMarshalledSize() const; + + bool operator==(const EmitterSystem& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/FundamentalParameterData.cpp b/src/dis6/distributed_emissions/FundamentalParameterData.cpp new file mode 100644 index 00000000..21a28039 --- /dev/null +++ b/src/dis6/distributed_emissions/FundamentalParameterData.cpp @@ -0,0 +1,181 @@ +#include "dis6/distributed_emissions/FundamentalParameterData.h" + +namespace dis { +FundamentalParameterData::FundamentalParameterData() + : _frequency(0.0), + _frequencyRange(0.0), + _effectiveRadiatedPower(0.0), + _pulseRepetitionFrequency(0.0), + _pulseWidth(0.0), + _beamAzimuthCenter(0.0), + _beamAzimuthSweep(0.0), + _beamElevationCenter(0.0), + _beamElevationSweep(0.0), + _beamSweepSync(0.0) {} + +float FundamentalParameterData::getFrequency() const { return _frequency; } + +void FundamentalParameterData::setFrequency(float pX) { _frequency = pX; } + +float FundamentalParameterData::getFrequencyRange() const { + return _frequencyRange; +} + +void FundamentalParameterData::setFrequencyRange(float pX) { + _frequencyRange = pX; +} + +float FundamentalParameterData::getEffectiveRadiatedPower() const { + return _effectiveRadiatedPower; +} + +void FundamentalParameterData::setEffectiveRadiatedPower(float pX) { + _effectiveRadiatedPower = pX; +} + +float FundamentalParameterData::getPulseRepetitionFrequency() const { + return _pulseRepetitionFrequency; +} + +void FundamentalParameterData::setPulseRepetitionFrequency(float pX) { + _pulseRepetitionFrequency = pX; +} + +float FundamentalParameterData::getPulseWidth() const { return _pulseWidth; } + +void FundamentalParameterData::setPulseWidth(float pX) { _pulseWidth = pX; } + +float FundamentalParameterData::getBeamAzimuthCenter() const { + return _beamAzimuthCenter; +} + +void FundamentalParameterData::setBeamAzimuthCenter(float pX) { + _beamAzimuthCenter = pX; +} + +float FundamentalParameterData::getBeamAzimuthSweep() const { + return _beamAzimuthSweep; +} + +void FundamentalParameterData::setBeamAzimuthSweep(float pX) { + _beamAzimuthSweep = pX; +} + +float FundamentalParameterData::getBeamElevationCenter() const { + return _beamElevationCenter; +} + +void FundamentalParameterData::setBeamElevationCenter(float pX) { + _beamElevationCenter = pX; +} + +float FundamentalParameterData::getBeamElevationSweep() const { + return _beamElevationSweep; +} + +void FundamentalParameterData::setBeamElevationSweep(float pX) { + _beamElevationSweep = pX; +} + +float FundamentalParameterData::getBeamSweepSync() const { + return _beamSweepSync; +} + +void FundamentalParameterData::setBeamSweepSync(float pX) { + _beamSweepSync = pX; +} + +void FundamentalParameterData::marshal(DataStream& dataStream) const { + dataStream << _frequency; + dataStream << _frequencyRange; + dataStream << _effectiveRadiatedPower; + dataStream << _pulseRepetitionFrequency; + dataStream << _pulseWidth; + dataStream << _beamAzimuthCenter; + dataStream << _beamAzimuthSweep; + dataStream << _beamElevationCenter; + dataStream << _beamElevationSweep; + dataStream << _beamSweepSync; +} + +void FundamentalParameterData::unmarshal(DataStream& dataStream) { + dataStream >> _frequency; + dataStream >> _frequencyRange; + dataStream >> _effectiveRadiatedPower; + dataStream >> _pulseRepetitionFrequency; + dataStream >> _pulseWidth; + dataStream >> _beamAzimuthCenter; + dataStream >> _beamAzimuthSweep; + dataStream >> _beamElevationCenter; + dataStream >> _beamElevationSweep; + dataStream >> _beamSweepSync; +} + +bool FundamentalParameterData::operator==( + const FundamentalParameterData& rhs) const { + bool ivarsEqual = true; + + if (!(_frequency == rhs._frequency)) ivarsEqual = false; + if (!(_frequencyRange == rhs._frequencyRange)) ivarsEqual = false; + if (!(_effectiveRadiatedPower == rhs._effectiveRadiatedPower)) + ivarsEqual = false; + if (!(_pulseRepetitionFrequency == rhs._pulseRepetitionFrequency)) + ivarsEqual = false; + if (!(_pulseWidth == rhs._pulseWidth)) ivarsEqual = false; + if (!(_beamAzimuthCenter == rhs._beamAzimuthCenter)) ivarsEqual = false; + if (!(_beamAzimuthSweep == rhs._beamAzimuthSweep)) ivarsEqual = false; + if (!(_beamElevationCenter == rhs._beamElevationCenter)) ivarsEqual = false; + if (!(_beamElevationSweep == rhs._beamElevationSweep)) ivarsEqual = false; + if (!(_beamSweepSync == rhs._beamSweepSync)) ivarsEqual = false; + + return ivarsEqual; +} + +int FundamentalParameterData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _frequency + marshalSize = marshalSize + 4; // _frequencyRange + marshalSize = marshalSize + 4; // _effectiveRadiatedPower + marshalSize = marshalSize + 4; // _pulseRepetitionFrequency + marshalSize = marshalSize + 4; // _pulseWidth + marshalSize = marshalSize + 4; // _beamAzimuthCenter + marshalSize = marshalSize + 4; // _beamAzimuthSweep + marshalSize = marshalSize + 4; // _beamElevationCenter + marshalSize = marshalSize + 4; // _beamElevationSweep + marshalSize = marshalSize + 4; // _beamSweepSync + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/FundamentalParameterData.h b/src/dis6/distributed_emissions/FundamentalParameterData.h new file mode 100644 index 00000000..8ecfe808 --- /dev/null +++ b/src/dis6/distributed_emissions/FundamentalParameterData.h @@ -0,0 +1,124 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.2.22. Contains electromagnetic emmision regineratin parameters that +// are variable throughout a scenario dependent on the actions of the +// participants in the simulation. Also provides basic parametric data that may +// be used to support low-fidelity simulations. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class FundamentalParameterData { + protected: + /** center frequency of the emission in hertz. */ + float _frequency; + + /** Bandwidth of the frequencies corresponding to the fequency field. */ + float _frequencyRange; + + /** Effective radiated power for the emission in DdBm. For a radar noise + * jammer, indicates the peak of the transmitted power. */ + float _effectiveRadiatedPower; + + /** Average repetition frequency of the emission in hertz. */ + float _pulseRepetitionFrequency; + + /** Average pulse width of the emission in microseconds. */ + float _pulseWidth; + + /** Specifies the beam azimuth an elevation centers and corresponding + * half-angles to describe the scan volume */ + float _beamAzimuthCenter; + + /** Specifies the beam azimuth sweep to determine scan volume */ + float _beamAzimuthSweep; + + /** Specifies the beam elevation center to determine scan volume */ + float _beamElevationCenter; + + /** Specifies the beam elevation sweep to determine scan volume */ + float _beamElevationSweep; + + /** allows receiver to synchronize its regenerated scan pattern to that of + * the emmitter. Specifies the percentage of time a scan is through its + * pattern from its origion. */ + float _beamSweepSync; + + public: + FundamentalParameterData(); + ~FundamentalParameterData() = default; + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getFrequency() const; + void setFrequency(float pX); + + float getFrequencyRange() const; + void setFrequencyRange(float pX); + + float getEffectiveRadiatedPower() const; + void setEffectiveRadiatedPower(float pX); + + float getPulseRepetitionFrequency() const; + void setPulseRepetitionFrequency(float pX); + + float getPulseWidth() const; + void setPulseWidth(float pX); + + float getBeamAzimuthCenter() const; + void setBeamAzimuthCenter(float pX); + + float getBeamAzimuthSweep() const; + void setBeamAzimuthSweep(float pX); + + float getBeamElevationCenter() const; + void setBeamElevationCenter(float pX); + + float getBeamElevationSweep() const; + void setBeamElevationSweep(float pX); + + float getBeamSweepSync() const; + void setBeamSweepSync(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FundamentalParameterData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/FundamentalParameterDataIff.cpp b/src/dis6/distributed_emissions/FundamentalParameterDataIff.cpp new file mode 100644 index 00000000..85f01bf1 --- /dev/null +++ b/src/dis6/distributed_emissions/FundamentalParameterDataIff.cpp @@ -0,0 +1,137 @@ +#include "dis6/distributed_emissions/FundamentalParameterDataIff.h" + +namespace dis { +FundamentalParameterDataIff::FundamentalParameterDataIff() + : _erp(0.0), + _frequency(0.0), + _pgrf(0.0), + _pulseWidth(0.0), + _burstLength(0), + _applicableModes(0), + _pad2(0), + _pad3(0) {} + +float FundamentalParameterDataIff::getErp() const { return _erp; } + +void FundamentalParameterDataIff::setErp(float pX) { _erp = pX; } + +float FundamentalParameterDataIff::getFrequency() const { return _frequency; } + +void FundamentalParameterDataIff::setFrequency(float pX) { _frequency = pX; } + +float FundamentalParameterDataIff::getPgrf() const { return _pgrf; } + +void FundamentalParameterDataIff::setPgrf(float pX) { _pgrf = pX; } + +float FundamentalParameterDataIff::getPulseWidth() const { return _pulseWidth; } + +void FundamentalParameterDataIff::setPulseWidth(float pX) { _pulseWidth = pX; } + +uint32_t FundamentalParameterDataIff::getBurstLength() const { + return _burstLength; +} + +void FundamentalParameterDataIff::setBurstLength(uint32_t pX) { + _burstLength = pX; +} + +uint8_t FundamentalParameterDataIff::getApplicableModes() const { + return _applicableModes; +} + +void FundamentalParameterDataIff::setApplicableModes(uint8_t pX) { + _applicableModes = pX; +} + +uint16_t FundamentalParameterDataIff::getPad2() const { return _pad2; } + +void FundamentalParameterDataIff::setPad2(uint16_t pX) { _pad2 = pX; } + +uint8_t FundamentalParameterDataIff::getPad3() const { return _pad3; } + +void FundamentalParameterDataIff::setPad3(uint8_t pX) { _pad3 = pX; } + +void FundamentalParameterDataIff::marshal(DataStream& dataStream) const { + dataStream << _erp; + dataStream << _frequency; + dataStream << _pgrf; + dataStream << _pulseWidth; + dataStream << _burstLength; + dataStream << _applicableModes; + dataStream << _pad2; + dataStream << _pad3; +} + +void FundamentalParameterDataIff::unmarshal(DataStream& dataStream) { + dataStream >> _erp; + dataStream >> _frequency; + dataStream >> _pgrf; + dataStream >> _pulseWidth; + dataStream >> _burstLength; + dataStream >> _applicableModes; + dataStream >> _pad2; + dataStream >> _pad3; +} + +bool FundamentalParameterDataIff::operator==( + const FundamentalParameterDataIff& rhs) const { + bool ivarsEqual = true; + + if (!(_erp == rhs._erp)) ivarsEqual = false; + if (!(_frequency == rhs._frequency)) ivarsEqual = false; + if (!(_pgrf == rhs._pgrf)) ivarsEqual = false; + if (!(_pulseWidth == rhs._pulseWidth)) ivarsEqual = false; + if (!(_burstLength == rhs._burstLength)) ivarsEqual = false; + if (!(_applicableModes == rhs._applicableModes)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_pad3 == rhs._pad3)) ivarsEqual = false; + + return ivarsEqual; +} + +int FundamentalParameterDataIff::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _erp + marshalSize = marshalSize + 4; // _frequency + marshalSize = marshalSize + 4; // _pgrf + marshalSize = marshalSize + 4; // _pulseWidth + marshalSize = marshalSize + 4; // _burstLength + marshalSize = marshalSize + 1; // _applicableModes + marshalSize = marshalSize + 2; // _pad2 + marshalSize = marshalSize + 1; // _pad3 + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/FundamentalParameterDataIff.h b/src/dis6/distributed_emissions/FundamentalParameterDataIff.h new file mode 100644 index 00000000..e7cbe62a --- /dev/null +++ b/src/dis6/distributed_emissions/FundamentalParameterDataIff.h @@ -0,0 +1,105 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// 5.2.45. Fundamental IFF atc data + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class FundamentalParameterDataIff { + protected: + /** ERP */ + float _erp; + + /** frequency */ + float _frequency; + + /** pgrf */ + float _pgrf; + + /** Pulse width */ + float _pulseWidth; + + /** Burst length */ + uint32_t _burstLength; + + /** Applicable modes enumeration */ + uint8_t _applicableModes; + + /** padding */ + uint16_t _pad2; + + /** padding */ + uint8_t _pad3; + + public: + FundamentalParameterDataIff(); + ~FundamentalParameterDataIff() = default; + + void marshal(DataStream& dataStream) const; + void unmarshal(DataStream& dataStream); + + float getErp() const; + void setErp(float pX); + + float getFrequency() const; + void setFrequency(float pX); + + float getPgrf() const; + void setPgrf(float pX); + + float getPulseWidth() const; + void setPulseWidth(float pX); + + uint32_t getBurstLength() const; + void setBurstLength(uint32_t pX); + + uint8_t getApplicableModes() const; + void setApplicableModes(uint8_t pX); + + uint16_t getPad2() const; + void setPad2(uint16_t pX); + + uint8_t getPad3() const; + void setPad3(uint8_t pX); + + int getMarshalledSize() const; + + bool operator==(const FundamentalParameterDataIff& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/IffAtcNavAidsLayer1Pdu.cpp b/src/dis6/distributed_emissions/IffAtcNavAidsLayer1Pdu.cpp new file mode 100644 index 00000000..5c7a7f8e --- /dev/null +++ b/src/dis6/distributed_emissions/IffAtcNavAidsLayer1Pdu.cpp @@ -0,0 +1,155 @@ +#include "dis6/distributed_emissions/IffAtcNavAidsLayer1Pdu.h" + +namespace dis { +IffAtcNavAidsLayer1Pdu::IffAtcNavAidsLayer1Pdu() + : DistributedEmissionsFamilyPdu(), + _emittingEntityId(), + _eventID(), + _location(), + _systemID(), + _pad2(0), + _fundamentalParameters() { + setPduType(28); +} + +EntityID& IffAtcNavAidsLayer1Pdu::getEmittingEntityId() { + return _emittingEntityId; +} + +const EntityID& IffAtcNavAidsLayer1Pdu::getEmittingEntityId() const { + return _emittingEntityId; +} + +void IffAtcNavAidsLayer1Pdu::setEmittingEntityId(const EntityID& pX) { + _emittingEntityId = pX; +} + +EventID& IffAtcNavAidsLayer1Pdu::getEventID() { return _eventID; } + +const EventID& IffAtcNavAidsLayer1Pdu::getEventID() const { return _eventID; } + +void IffAtcNavAidsLayer1Pdu::setEventID(const EventID& pX) { _eventID = pX; } + +Vector3Float& IffAtcNavAidsLayer1Pdu::getLocation() { return _location; } + +const Vector3Float& IffAtcNavAidsLayer1Pdu::getLocation() const { + return _location; +} + +void IffAtcNavAidsLayer1Pdu::setLocation(const Vector3Float& pX) { + _location = pX; +} + +SystemID& IffAtcNavAidsLayer1Pdu::getSystemID() { return _systemID; } + +const SystemID& IffAtcNavAidsLayer1Pdu::getSystemID() const { + return _systemID; +} + +void IffAtcNavAidsLayer1Pdu::setSystemID(const SystemID& pX) { _systemID = pX; } + +uint16_t IffAtcNavAidsLayer1Pdu::getPad2() const { return _pad2; } + +void IffAtcNavAidsLayer1Pdu::setPad2(uint16_t pX) { _pad2 = pX; } + +IffFundamentalData& IffAtcNavAidsLayer1Pdu::getFundamentalParameters() { + return _fundamentalParameters; +} + +const IffFundamentalData& IffAtcNavAidsLayer1Pdu::getFundamentalParameters() + const { + return _fundamentalParameters; +} + +void IffAtcNavAidsLayer1Pdu::setFundamentalParameters( + const IffFundamentalData& pX) { + _fundamentalParameters = pX; +} + +void IffAtcNavAidsLayer1Pdu::marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _emittingEntityId.marshal(dataStream); + _eventID.marshal(dataStream); + _location.marshal(dataStream); + _systemID.marshal(dataStream); + dataStream << _pad2; + _fundamentalParameters.marshal(dataStream); +} + +void IffAtcNavAidsLayer1Pdu::unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _emittingEntityId.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + _location.unmarshal(dataStream); + _systemID.unmarshal(dataStream); + dataStream >> _pad2; + _fundamentalParameters.unmarshal(dataStream); +} + +bool IffAtcNavAidsLayer1Pdu::operator==( + const IffAtcNavAidsLayer1Pdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_emittingEntityId == rhs._emittingEntityId)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_location == rhs._location)) ivarsEqual = false; + if (!(_systemID == rhs._systemID)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_fundamentalParameters == rhs._fundamentalParameters)) + ivarsEqual = false; + + return ivarsEqual; +} + +int IffAtcNavAidsLayer1Pdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _emittingEntityId.getMarshalledSize(); // _emittingEntityId + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + _location.getMarshalledSize(); // _location + marshalSize = marshalSize + _systemID.getMarshalledSize(); // _systemID + marshalSize = marshalSize + 2; // _pad2 + marshalSize = + marshalSize + + _fundamentalParameters.getMarshalledSize(); // _fundamentalParameters + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/IffAtcNavAidsLayer1Pdu.h b/src/dis6/distributed_emissions/IffAtcNavAidsLayer1Pdu.h new file mode 100644 index 00000000..6ae26052 --- /dev/null +++ b/src/dis6/distributed_emissions/IffAtcNavAidsLayer1Pdu.h @@ -0,0 +1,105 @@ +#pragma once + +#include "dis6/common/EntityID.h" +#include "dis6/common/EventID.h" +#include "dis6/common/Vector3Float.h" +#include "dis6/distributed_emissions/DistributedEmissionsFamilyPdu.h" +#include "dis6/distributed_emissions/IffFundamentalData.h" +#include "dis6/distributed_emissions/SystemID.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// 5.3.7.4.1: Navigational and IFF PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class IffAtcNavAidsLayer1Pdu : public DistributedEmissionsFamilyPdu { + protected: + /** ID of the entity that is the source of the emissions */ + EntityID _emittingEntityId; + + /** Number generated by the issuing simulation to associate realted events. */ + EventID _eventID; + + /** Location wrt entity. There is some ambugiuity in the standard here, but + * this is the order it is listed in the table. */ + Vector3Float _location; + + /** System ID information */ + SystemID _systemID; + + /** padding */ + uint16_t _pad2; + + /** fundamental parameters */ + IffFundamentalData _fundamentalParameters; + + public: + IffAtcNavAidsLayer1Pdu(); + ~IffAtcNavAidsLayer1Pdu() override = default; + + void Marshal(DataStream& dataStream) const override; + void Unmarshal(DataStream& dataStream) override; + + EntityID& getEmittingEntityId(); + const EntityID& getEmittingEntityId() const; + void setEmittingEntityId(const EntityID& pX); + + EventID& getEventID(); + const EventID& getEventID() const; + void setEventID(const EventID& pX); + + Vector3Float& getLocation(); + const Vector3Float& getLocation() const; + void setLocation(const Vector3Float& pX); + + SystemID& getSystemID(); + const SystemID& getSystemID() const; + void setSystemID(const SystemID& pX); + + uint16_t getPad2() const; + void setPad2(uint16_t pX); + + IffFundamentalData& getFundamentalParameters(); + const IffFundamentalData& getFundamentalParameters() const; + void setFundamentalParameters(const IffFundamentalData& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IffAtcNavAidsLayer1Pdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/IffAtcNavAidsLayer2Pdu.cpp b/src/dis6/distributed_emissions/IffAtcNavAidsLayer2Pdu.cpp new file mode 100644 index 00000000..05d25dd8 --- /dev/null +++ b/src/dis6/distributed_emissions/IffAtcNavAidsLayer2Pdu.cpp @@ -0,0 +1,155 @@ +#include "dis6/distributed_emissions/IffAtcNavAidsLayer2Pdu.h" + +namespace dis { +IffAtcNavAidsLayer2Pdu::IffAtcNavAidsLayer2Pdu() + : IffAtcNavAidsLayer1Pdu(), + _layerHeader(), + _beamData(), + _secondaryOperationalData() {} + +IffAtcNavAidsLayer2Pdu::~IffAtcNavAidsLayer2Pdu() { + _fundamentalIffParameters.clear(); +} + +LayerHeader& IffAtcNavAidsLayer2Pdu::getLayerHeader() { return _layerHeader; } + +const LayerHeader& IffAtcNavAidsLayer2Pdu::getLayerHeader() const { + return _layerHeader; +} + +void IffAtcNavAidsLayer2Pdu::setLayerHeader(const LayerHeader& pX) { + _layerHeader = pX; +} + +BeamData& IffAtcNavAidsLayer2Pdu::getBeamData() { return _beamData; } + +const BeamData& IffAtcNavAidsLayer2Pdu::getBeamData() const { + return _beamData; +} + +void IffAtcNavAidsLayer2Pdu::setBeamData(const BeamData& pX) { _beamData = pX; } + +BeamData& IffAtcNavAidsLayer2Pdu::getSecondaryOperationalData() { + return _secondaryOperationalData; +} + +const BeamData& IffAtcNavAidsLayer2Pdu::getSecondaryOperationalData() const { + return _secondaryOperationalData; +} + +void IffAtcNavAidsLayer2Pdu::setSecondaryOperationalData(const BeamData& pX) { + _secondaryOperationalData = pX; +} + +std::vector& +IffAtcNavAidsLayer2Pdu::getFundamentalIffParameters() { + return _fundamentalIffParameters; +} + +const std::vector& +IffAtcNavAidsLayer2Pdu::getFundamentalIffParameters() const { + return _fundamentalIffParameters; +} + +void IffAtcNavAidsLayer2Pdu::setFundamentalIffParameters( + const std::vector& pX) { + _fundamentalIffParameters = pX; +} + +void IffAtcNavAidsLayer2Pdu::marshal(DataStream& dataStream) const { + IffAtcNavAidsLayer1Pdu::marshal( + dataStream); // Marshal information in superclass first + _layerHeader.marshal(dataStream); + _beamData.marshal(dataStream); + _secondaryOperationalData.marshal(dataStream); + + for (size_t idx = 0; idx < _fundamentalIffParameters.size(); idx++) { + FundamentalParameterDataIff x = _fundamentalIffParameters[idx]; + x.marshal(dataStream); + } +} + +void IffAtcNavAidsLayer2Pdu::unmarshal(DataStream& dataStream) { + IffAtcNavAidsLayer1Pdu::unmarshal( + dataStream); // unmarshal information in superclass first + _layerHeader.unmarshal(dataStream); + _beamData.unmarshal(dataStream); + _secondaryOperationalData.unmarshal(dataStream); + + _fundamentalIffParameters.clear(); + for (size_t idx = 0; idx < _pad2; idx++) { + FundamentalParameterDataIff x; + x.unmarshal(dataStream); + _fundamentalIffParameters.push_back(x); + } +} + +bool IffAtcNavAidsLayer2Pdu::operator==( + const IffAtcNavAidsLayer2Pdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = IffAtcNavAidsLayer1Pdu::operator==(rhs); + + if (!(_layerHeader == rhs._layerHeader)) ivarsEqual = false; + if (!(_beamData == rhs._beamData)) ivarsEqual = false; + if (!(_secondaryOperationalData == rhs._secondaryOperationalData)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _fundamentalIffParameters.size(); idx++) { + if (!(_fundamentalIffParameters[idx] == rhs._fundamentalIffParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int IffAtcNavAidsLayer2Pdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = IffAtcNavAidsLayer1Pdu::getMarshalledSize(); + marshalSize = marshalSize + _layerHeader.getMarshalledSize(); // _layerHeader + marshalSize = marshalSize + _beamData.getMarshalledSize(); // _beamData + marshalSize = + marshalSize + _secondaryOperationalData + .getMarshalledSize(); // _secondaryOperationalData + + for (uint64_t idx = 0; idx < _fundamentalIffParameters.size(); idx++) { + FundamentalParameterDataIff listElement = _fundamentalIffParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/IffAtcNavAidsLayer2Pdu.h b/src/dis6/distributed_emissions/IffAtcNavAidsLayer2Pdu.h new file mode 100644 index 00000000..77265204 --- /dev/null +++ b/src/dis6/distributed_emissions/IffAtcNavAidsLayer2Pdu.h @@ -0,0 +1,94 @@ +#pragma once + +#include + +#include "dis6/distributed_emissions/BeamData.h" +#include "dis6/distributed_emissions/FundamentalParameterDataIff.h" +#include "dis6/distributed_emissions/IffAtcNavAidsLayer1Pdu.h" +#include "dis6/distributed_emissions/LayerHeader.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.3.7.4.2 When present, layer 2 should follow layer 1 and have the +// following fields. This requires manual cleanup. the beamData attribute +// semantics are used in multiple ways. UNFINSISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class IffAtcNavAidsLayer2Pdu final : public IffAtcNavAidsLayer1Pdu { + protected: + /** layer header */ + LayerHeader _layerHeader; + + /** beam data */ + BeamData _beamData; + + /** Secondary operational data, 5.2.57 */ + BeamData _secondaryOperationalData; + + /** variable length list of fundamental parameters. ^^^This is wrong */ + std::vector _fundamentalIffParameters; + + public: + IffAtcNavAidsLayer2Pdu(); + ~IffAtcNavAidsLayer2Pdu() final = default; + void Marshal(DataStream& dataStream) const override; + void Unmarshal(DataStream& dataStream) override; + + LayerHeader& getLayerHeader(); + const LayerHeader& getLayerHeader() const; + void setLayerHeader(const LayerHeader& pX); + + BeamData& getBeamData(); + const BeamData& getBeamData() const; + void setBeamData(const BeamData& pX); + + BeamData& getSecondaryOperationalData(); + const BeamData& getSecondaryOperationalData() const; + void setSecondaryOperationalData(const BeamData& pX); + + std::vector& getFundamentalIffParameters(); + const std::vector& getFundamentalIffParameters() + const; + void setFundamentalIffParameters( + const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IffAtcNavAidsLayer2Pdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/IffFundamentalData.cpp b/src/dis6/distributed_emissions/IffFundamentalData.cpp new file mode 100644 index 00000000..bf7bf129 --- /dev/null +++ b/src/dis6/distributed_emissions/IffFundamentalData.cpp @@ -0,0 +1,156 @@ +#include "dis6/distributed_emissions/IffFundamentalData.h" + +namespace dis { +IffFundamentalData::IffFundamentalData() + : _systemStatus(0), + _alternateParameter4(0), + _informationLayers(0), + _modifier(0), + _parameter1(0), + _parameter2(0), + _parameter3(0), + _parameter4(0), + _parameter5(0), + _parameter6(0) {} + +IffFundamentalData::~IffFundamentalData() {} + +uint8_t IffFundamentalData::getSystemStatus() const { return _systemStatus; } + +void IffFundamentalData::setSystemStatus(uint8_t pX) { _systemStatus = pX; } + +uint8_t IffFundamentalData::getAlternateParameter4() const { + return _alternateParameter4; +} + +void IffFundamentalData::setAlternateParameter4(uint8_t pX) { + _alternateParameter4 = pX; +} + +uint8_t IffFundamentalData::getInformationLayers() const { + return _informationLayers; +} + +void IffFundamentalData::setInformationLayers(uint8_t pX) { + _informationLayers = pX; +} + +uint8_t IffFundamentalData::getModifier() const { return _modifier; } + +void IffFundamentalData::setModifier(uint8_t pX) { _modifier = pX; } + +uint16_t IffFundamentalData::getParameter1() const { return _parameter1; } + +void IffFundamentalData::setParameter1(uint16_t pX) { _parameter1 = pX; } + +uint16_t IffFundamentalData::getParameter2() const { return _parameter2; } + +void IffFundamentalData::setParameter2(uint16_t pX) { _parameter2 = pX; } + +uint16_t IffFundamentalData::getParameter3() const { return _parameter3; } + +void IffFundamentalData::setParameter3(uint16_t pX) { _parameter3 = pX; } + +uint16_t IffFundamentalData::getParameter4() const { return _parameter4; } + +void IffFundamentalData::setParameter4(uint16_t pX) { _parameter4 = pX; } + +uint16_t IffFundamentalData::getParameter5() const { return _parameter5; } + +void IffFundamentalData::setParameter5(uint16_t pX) { _parameter5 = pX; } + +uint16_t IffFundamentalData::getParameter6() const { return _parameter6; } + +void IffFundamentalData::setParameter6(uint16_t pX) { _parameter6 = pX; } + +void IffFundamentalData::marshal(DataStream& dataStream) const { + dataStream << _systemStatus; + dataStream << _alternateParameter4; + dataStream << _informationLayers; + dataStream << _modifier; + dataStream << _parameter1; + dataStream << _parameter2; + dataStream << _parameter3; + dataStream << _parameter4; + dataStream << _parameter5; + dataStream << _parameter6; +} + +void IffFundamentalData::unmarshal(DataStream& dataStream) { + dataStream >> _systemStatus; + dataStream >> _alternateParameter4; + dataStream >> _informationLayers; + dataStream >> _modifier; + dataStream >> _parameter1; + dataStream >> _parameter2; + dataStream >> _parameter3; + dataStream >> _parameter4; + dataStream >> _parameter5; + dataStream >> _parameter6; +} + +bool IffFundamentalData::operator==(const IffFundamentalData& rhs) const { + bool ivarsEqual = true; + + if (!(_systemStatus == rhs._systemStatus)) ivarsEqual = false; + if (!(_alternateParameter4 == rhs._alternateParameter4)) ivarsEqual = false; + if (!(_informationLayers == rhs._informationLayers)) ivarsEqual = false; + if (!(_modifier == rhs._modifier)) ivarsEqual = false; + if (!(_parameter1 == rhs._parameter1)) ivarsEqual = false; + if (!(_parameter2 == rhs._parameter2)) ivarsEqual = false; + if (!(_parameter3 == rhs._parameter3)) ivarsEqual = false; + if (!(_parameter4 == rhs._parameter4)) ivarsEqual = false; + if (!(_parameter5 == rhs._parameter5)) ivarsEqual = false; + if (!(_parameter6 == rhs._parameter6)) ivarsEqual = false; + + return ivarsEqual; +} + +int IffFundamentalData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _systemStatus + marshalSize = marshalSize + 1; // _alternateParameter4 + marshalSize = marshalSize + 1; // _informationLayers + marshalSize = marshalSize + 1; // _modifier + marshalSize = marshalSize + 2; // _parameter1 + marshalSize = marshalSize + 2; // _parameter2 + marshalSize = marshalSize + 2; // _parameter3 + marshalSize = marshalSize + 2; // _parameter4 + marshalSize = marshalSize + 2; // _parameter5 + marshalSize = marshalSize + 2; // _parameter6 + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/IffFundamentalData.h b/src/dis6/distributed_emissions/IffFundamentalData.h new file mode 100644 index 00000000..a4f91dd9 --- /dev/null +++ b/src/dis6/distributed_emissions/IffFundamentalData.h @@ -0,0 +1,117 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// 5.2.42. Basic operational data ofr IFF ATC NAVAIDS + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class IffFundamentalData { + protected: + /** system status */ + uint8_t _systemStatus; + + /** Alternate parameter 4 */ + uint8_t _alternateParameter4; + + /** eight boolean fields */ + uint8_t _informationLayers; + + /** enumeration */ + uint8_t _modifier; + + /** parameter, enumeration */ + uint16_t _parameter1; + + /** parameter, enumeration */ + uint16_t _parameter2; + + /** parameter, enumeration */ + uint16_t _parameter3; + + /** parameter, enumeration */ + uint16_t _parameter4; + + /** parameter, enumeration */ + uint16_t _parameter5; + + /** parameter, enumeration */ + uint16_t _parameter6; + + public: + IffFundamentalData(); + virtual ~IffFundamentalData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getSystemStatus() const; + void setSystemStatus(uint8_t pX); + + uint8_t getAlternateParameter4() const; + void setAlternateParameter4(uint8_t pX); + + uint8_t getInformationLayers() const; + void setInformationLayers(uint8_t pX); + + uint8_t getModifier() const; + void setModifier(uint8_t pX); + + uint16_t getParameter1() const; + void setParameter1(uint16_t pX); + + uint16_t getParameter2() const; + void setParameter2(uint16_t pX); + + uint16_t getParameter3() const; + void setParameter3(uint16_t pX); + + uint16_t getParameter4() const; + void setParameter4(uint16_t pX); + + uint16_t getParameter5() const; + void setParameter5(uint16_t pX); + + uint16_t getParameter6() const; + void setParameter6(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IffFundamentalData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/LayerHeader.cpp b/src/dis6/distributed_emissions/LayerHeader.cpp new file mode 100644 index 00000000..7fd89ec1 --- /dev/null +++ b/src/dis6/distributed_emissions/LayerHeader.cpp @@ -0,0 +1,86 @@ +#include "dis6/distributed_emissions/LayerHeader.h" + +namespace dis { +LayerHeader::LayerHeader() + : _layerNumber(0), _layerSpecificInformaiton(0), _length(0) {} + +uint8_t LayerHeader::getLayerNumber() const { return _layerNumber; } + +void LayerHeader::setLayerNumber(uint8_t pX) { _layerNumber = pX; } + +uint8_t LayerHeader::getLayerSpecificInformaiton() const { + return _layerSpecificInformaiton; +} + +void LayerHeader::setLayerSpecificInformaiton(uint8_t pX) { + _layerSpecificInformaiton = pX; +} + +uint16_t LayerHeader::getLength() const { return _length; } + +void LayerHeader::setLength(uint16_t pX) { _length = pX; } + +void LayerHeader::marshal(DataStream& dataStream) const { + dataStream << _layerNumber; + dataStream << _layerSpecificInformaiton; + dataStream << _length; +} + +void LayerHeader::unmarshal(DataStream& dataStream) { + dataStream >> _layerNumber; + dataStream >> _layerSpecificInformaiton; + dataStream >> _length; +} + +bool LayerHeader::operator==(const LayerHeader& rhs) const { + bool ivarsEqual = true; + + if (!(_layerNumber == rhs._layerNumber)) ivarsEqual = false; + if (!(_layerSpecificInformaiton == rhs._layerSpecificInformaiton)) + ivarsEqual = false; + if (!(_length == rhs._length)) ivarsEqual = false; + + return ivarsEqual; +} + +int LayerHeader::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _layerNumber + marshalSize = marshalSize + 1; // _layerSpecificInformaiton + marshalSize = marshalSize + 2; // _length + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/LayerHeader.h b/src/dis6/distributed_emissions/LayerHeader.h new file mode 100644 index 00000000..511bcc2f --- /dev/null +++ b/src/dis6/distributed_emissions/LayerHeader.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// 5.2.47. Layer header. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class LayerHeader { + protected: + /** Layer number */ + uint8_t _layerNumber; + + /** Layer speccific information enumeration */ + uint8_t _layerSpecificInformaiton; + + /** information length */ + uint16_t _length; + + public: + LayerHeader(); + ~LayerHeader() = default; + + void marshal(DataStream& dataStream) const; + void unmarshal(DataStream& dataStream); + + uint8_t getLayerNumber() const; + void setLayerNumber(uint8_t pX); + + uint8_t getLayerSpecificInformaiton() const; + void setLayerSpecificInformaiton(uint8_t pX); + + uint16_t getLength() const; + void setLength(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LayerHeader& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/PropulsionSystemData.cpp b/src/dis6/distributed_emissions/PropulsionSystemData.cpp new file mode 100644 index 00000000..5a16b05f --- /dev/null +++ b/src/dis6/distributed_emissions/PropulsionSystemData.cpp @@ -0,0 +1,73 @@ +#include "dis6/distributed_emissions/PropulsionSystemData.h" + +namespace dis { +PropulsionSystemData::PropulsionSystemData() + : _powerSetting(0.0), _engineRpm(0.0) {} + +float PropulsionSystemData::getPowerSetting() const { return _powerSetting; } + +void PropulsionSystemData::setPowerSetting(float pX) { _powerSetting = pX; } + +float PropulsionSystemData::getEngineRpm() const { return _engineRpm; } + +void PropulsionSystemData::setEngineRpm(float pX) { _engineRpm = pX; } + +void PropulsionSystemData::marshal(DataStream& dataStream) const { + dataStream << _powerSetting; + dataStream << _engineRpm; +} + +void PropulsionSystemData::unmarshal(DataStream& dataStream) { + dataStream >> _powerSetting; + dataStream >> _engineRpm; +} + +bool PropulsionSystemData::operator==(const PropulsionSystemData& rhs) const { + bool ivarsEqual = true; + + if (!(_powerSetting == rhs._powerSetting)) ivarsEqual = false; + if (!(_engineRpm == rhs._engineRpm)) ivarsEqual = false; + + return ivarsEqual; +} + +int PropulsionSystemData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _powerSetting + marshalSize = marshalSize + 4; // _engineRpm + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/PropulsionSystemData.h b/src/dis6/distributed_emissions/PropulsionSystemData.h new file mode 100644 index 00000000..e12a5a5c --- /dev/null +++ b/src/dis6/distributed_emissions/PropulsionSystemData.h @@ -0,0 +1,69 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Data about a propulsion system + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class PropulsionSystemData { + protected: + /** powerSetting */ + float _powerSetting; + + /** engine RPMs */ + float _engineRpm; + + public: + PropulsionSystemData(); + ~PropulsionSystemData() = default; + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getPowerSetting() const; + void setPowerSetting(float pX); + + float getEngineRpm() const; + void setEngineRpm(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const PropulsionSystemData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/SeesPdu.cpp b/src/dis6/distributed_emissions/SeesPdu.cpp new file mode 100644 index 00000000..3989e958 --- /dev/null +++ b/src/dis6/distributed_emissions/SeesPdu.cpp @@ -0,0 +1,221 @@ +#include "dis6/distributed_emissions/SeesPdu.h" + +namespace dis { +SeesPdu::SeesPdu() + : _orginatingEntityID(), + _infraredSignatureRepresentationIndex(0), + _acousticSignatureRepresentationIndex(0), + _radarCrossSectionSignatureRepresentationIndex(0), + _numberOfPropulsionSystems(0), + _numberOfVectoringNozzleSystems(0) { + SetPduType(30); +} + +SeesPdu::~SeesPdu() { + _propulsionSystemData.clear(); + _vectoringSystemData.clear(); +} + +EntityID& SeesPdu::getOrginatingEntityID() { return _orginatingEntityID; } + +const EntityID& SeesPdu::getOrginatingEntityID() const { + return _orginatingEntityID; +} + +void SeesPdu::setOrginatingEntityID(const EntityID& pX) { + _orginatingEntityID = pX; +} + +uint16_t SeesPdu::getInfraredSignatureRepresentationIndex() const { + return _infraredSignatureRepresentationIndex; +} + +void SeesPdu::setInfraredSignatureRepresentationIndex(uint16_t pX) { + _infraredSignatureRepresentationIndex = pX; +} + +uint16_t SeesPdu::getAcousticSignatureRepresentationIndex() const { + return _acousticSignatureRepresentationIndex; +} + +void SeesPdu::setAcousticSignatureRepresentationIndex(uint16_t pX) { + _acousticSignatureRepresentationIndex = pX; +} + +uint16_t SeesPdu::getRadarCrossSectionSignatureRepresentationIndex() const { + return _radarCrossSectionSignatureRepresentationIndex; +} + +void SeesPdu::setRadarCrossSectionSignatureRepresentationIndex(uint16_t pX) { + _radarCrossSectionSignatureRepresentationIndex = pX; +} + +uint16_t SeesPdu::getNumberOfPropulsionSystems() const { + return _propulsionSystemData.size(); +} + +uint16_t SeesPdu::getNumberOfVectoringNozzleSystems() const { + return _vectoringSystemData.size(); +} + +std::vector& SeesPdu::getPropulsionSystemData() { + return _propulsionSystemData; +} + +const std::vector& SeesPdu::getPropulsionSystemData() + const { + return _propulsionSystemData; +} + +void SeesPdu::setPropulsionSystemData( + const std::vector& pX) { + _propulsionSystemData = pX; +} + +std::vector& SeesPdu::getVectoringSystemData() { + return _vectoringSystemData; +} + +const std::vector& SeesPdu::getVectoringSystemData() + const { + return _vectoringSystemData; +} + +void SeesPdu::setVectoringSystemData( + const std::vector& pX) { + _vectoringSystemData = pX; +} + +void SeesPdu::marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _orginatingEntityID.marshal(dataStream); + dataStream << _infraredSignatureRepresentationIndex; + dataStream << _acousticSignatureRepresentationIndex; + dataStream << _radarCrossSectionSignatureRepresentationIndex; + dataStream << (uint16_t)_propulsionSystemData.size(); + dataStream << (uint16_t)_vectoringSystemData.size(); + + for (size_t idx = 0; idx < _propulsionSystemData.size(); idx++) { + PropulsionSystemData x = _propulsionSystemData[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _vectoringSystemData.size(); idx++) { + VectoringNozzleSystemData x = _vectoringSystemData[idx]; + x.marshal(dataStream); + } +} + +void SeesPdu::unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _orginatingEntityID.unmarshal(dataStream); + dataStream >> _infraredSignatureRepresentationIndex; + dataStream >> _acousticSignatureRepresentationIndex; + dataStream >> _radarCrossSectionSignatureRepresentationIndex; + dataStream >> _numberOfPropulsionSystems; + dataStream >> _numberOfVectoringNozzleSystems; + + _propulsionSystemData.clear(); + for (size_t idx = 0; idx < _numberOfPropulsionSystems; idx++) { + PropulsionSystemData x; + x.unmarshal(dataStream); + _propulsionSystemData.push_back(x); + } + + _vectoringSystemData.clear(); + for (size_t idx = 0; idx < _numberOfVectoringNozzleSystems; idx++) { + VectoringNozzleSystemData x; + x.unmarshal(dataStream); + _vectoringSystemData.push_back(x); + } +} + +bool SeesPdu::operator==(const SeesPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_orginatingEntityID == rhs._orginatingEntityID)) ivarsEqual = false; + if (!(_infraredSignatureRepresentationIndex == + rhs._infraredSignatureRepresentationIndex)) + ivarsEqual = false; + if (!(_acousticSignatureRepresentationIndex == + rhs._acousticSignatureRepresentationIndex)) + ivarsEqual = false; + if (!(_radarCrossSectionSignatureRepresentationIndex == + rhs._radarCrossSectionSignatureRepresentationIndex)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _propulsionSystemData.size(); idx++) { + if (!(_propulsionSystemData[idx] == rhs._propulsionSystemData[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _vectoringSystemData.size(); idx++) { + if (!(_vectoringSystemData[idx] == rhs._vectoringSystemData[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int SeesPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID + marshalSize = marshalSize + 2; // _infraredSignatureRepresentationIndex + marshalSize = marshalSize + 2; // _acousticSignatureRepresentationIndex + marshalSize = + marshalSize + 2; // _radarCrossSectionSignatureRepresentationIndex + marshalSize = marshalSize + 2; // _numberOfPropulsionSystems + marshalSize = marshalSize + 2; // _numberOfVectoringNozzleSystems + + for (uint64_t idx = 0; idx < _propulsionSystemData.size(); idx++) { + PropulsionSystemData listElement = _propulsionSystemData[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _vectoringSystemData.size(); idx++) { + VectoringNozzleSystemData listElement = _vectoringSystemData[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/SeesPdu.h b/src/dis6/distributed_emissions/SeesPdu.h new file mode 100644 index 00000000..62852e32 --- /dev/null +++ b/src/dis6/distributed_emissions/SeesPdu.h @@ -0,0 +1,113 @@ +#pragma once + +#include + +#include "dis6/common/EntityID.h" +#include "dis6/distributed_emissions/DistributedEmissionsFamilyPdu.h" +#include "dis6/distributed_emissions/PropulsionSystemData.h" +#include "dis6/distributed_emissions/VectoringNozzleSystemData.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.3.7.5. SEES PDU, supplemental emissions entity state information. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SeesPdu final : public DistributedEmissionsFamilyPdu { + protected: + /** Originating entity ID */ + EntityID _orginatingEntityID; + + /** IR Signature representation index */ + uint16_t _infraredSignatureRepresentationIndex; + + /** acoustic Signature representation index */ + uint16_t _acousticSignatureRepresentationIndex; + + /** radar cross section representation index */ + uint16_t _radarCrossSectionSignatureRepresentationIndex; + + /** how many propulsion systems */ + uint16_t _numberOfPropulsionSystems; + + /** how many vectoring nozzle systems */ + uint16_t _numberOfVectoringNozzleSystems; + + /** variable length list of propulsion system data */ + std::vector _propulsionSystemData; + + /** variable length list of vectoring system data */ + std::vector _vectoringSystemData; + + public: + SeesPdu(); + ~SeesPdu() final; + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOrginatingEntityID(); + const EntityID& getOrginatingEntityID() const; + void setOrginatingEntityID(const EntityID& pX); + + uint16_t getInfraredSignatureRepresentationIndex() const; + void setInfraredSignatureRepresentationIndex(uint16_t pX); + + uint16_t getAcousticSignatureRepresentationIndex() const; + void setAcousticSignatureRepresentationIndex(uint16_t pX); + + uint16_t getRadarCrossSectionSignatureRepresentationIndex() const; + void setRadarCrossSectionSignatureRepresentationIndex(uint16_t pX); + + uint16_t getNumberOfPropulsionSystems() const; + + uint16_t getNumberOfVectoringNozzleSystems() const; + + std::vector& getPropulsionSystemData(); + const std::vector& getPropulsionSystemData() const; + void setPropulsionSystemData(const std::vector& pX); + + std::vector& getVectoringSystemData(); + const std::vector& getVectoringSystemData() const; + void setVectoringSystemData(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SeesPdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ShaftRPMs.cpp b/src/dis6/distributed_emissions/ShaftRPMs.cpp new file mode 100644 index 00000000..00e69e59 --- /dev/null +++ b/src/dis6/distributed_emissions/ShaftRPMs.cpp @@ -0,0 +1,85 @@ +#include "dis6/ShaftRPMs.h" + +namespace dis { +ShaftRPMs::ShaftRPMs() + : _currentShaftRPMs(0), _orderedShaftRPMs(0), _shaftRPMRateOfChange(0.0) {} + +int16_t ShaftRPMs::getCurrentShaftRPMs() const { return _currentShaftRPMs; } + +void ShaftRPMs::setCurrentShaftRPMs(int16_t pX) { _currentShaftRPMs = pX; } + +int16_t ShaftRPMs::getOrderedShaftRPMs() const { return _orderedShaftRPMs; } + +void ShaftRPMs::setOrderedShaftRPMs(int16_t pX) { _orderedShaftRPMs = pX; } + +float ShaftRPMs::getShaftRPMRateOfChange() const { + return _shaftRPMRateOfChange; +} + +void ShaftRPMs::setShaftRPMRateOfChange(float pX) { + _shaftRPMRateOfChange = pX; +} + +void ShaftRPMs::marshal(DataStream& dataStream) const { + dataStream << _currentShaftRPMs; + dataStream << _orderedShaftRPMs; + dataStream << _shaftRPMRateOfChange; +} + +void ShaftRPMs::unmarshal(DataStream& dataStream) { + dataStream >> _currentShaftRPMs; + dataStream >> _orderedShaftRPMs; + dataStream >> _shaftRPMRateOfChange; +} + +bool ShaftRPMs::operator==(const ShaftRPMs& rhs) const { + bool ivarsEqual = true; + + if (!(_currentShaftRPMs == rhs._currentShaftRPMs)) ivarsEqual = false; + if (!(_orderedShaftRPMs == rhs._orderedShaftRPMs)) ivarsEqual = false; + if (!(_shaftRPMRateOfChange == rhs._shaftRPMRateOfChange)) ivarsEqual = false; + + return ivarsEqual; +} + +int ShaftRPMs::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _currentShaftRPMs + marshalSize = marshalSize + 2; // _orderedShaftRPMs + marshalSize = marshalSize + 4; // _shaftRPMRateOfChange + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/ShaftRPMs.h b/src/dis6/distributed_emissions/ShaftRPMs.h new file mode 100644 index 00000000..de50d60b --- /dev/null +++ b/src/dis6/distributed_emissions/ShaftRPMs.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Shaft RPMs, used in underwater acoustic clacluations. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ShaftRPMs { + protected: + /** Current shaft RPMs */ + int16_t _currentShaftRPMs; + + /** ordered shaft rpms */ + int16_t _orderedShaftRPMs; + + /** rate of change of shaft RPMs */ + float _shaftRPMRateOfChange; + + public: + ShaftRPMs(); + ~ShaftRPMs() = default; + + void marshal(DataStream& dataStream) const; + void unmarshal(DataStream& dataStream); + + int16_t getCurrentShaftRPMs() const; + void setCurrentShaftRPMs(int16_t pX); + + int16_t getOrderedShaftRPMs() const; + void setOrderedShaftRPMs(int16_t pX); + + float getShaftRPMRateOfChange() const; + void setShaftRPMRateOfChange(float pX); + + int getMarshalledSize() const; + + bool operator==(const ShaftRPMs& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/SystemID.cpp b/src/dis6/distributed_emissions/SystemID.cpp new file mode 100644 index 00000000..bf3e95ef --- /dev/null +++ b/src/dis6/distributed_emissions/SystemID.cpp @@ -0,0 +1,91 @@ +#include "dis6/distributed_emissions/SystemID.h" + +namespace dis { +SystemID::SystemID() + : _systemType(0), _systemName(0), _systemMode(0), _changeOptions(0) {} + +SystemID::~SystemID() {} + +uint16_t SystemID::getSystemType() const { return _systemType; } + +void SystemID::setSystemType(uint16_t pX) { _systemType = pX; } + +uint16_t SystemID::getSystemName() const { return _systemName; } + +void SystemID::setSystemName(uint16_t pX) { _systemName = pX; } + +uint8_t SystemID::getSystemMode() const { return _systemMode; } + +void SystemID::setSystemMode(uint8_t pX) { _systemMode = pX; } + +uint8_t SystemID::getChangeOptions() const { return _changeOptions; } + +void SystemID::setChangeOptions(uint8_t pX) { _changeOptions = pX; } + +void SystemID::marshal(DataStream& dataStream) const { + dataStream << _systemType; + dataStream << _systemName; + dataStream << _systemMode; + dataStream << _changeOptions; +} + +void SystemID::unmarshal(DataStream& dataStream) { + dataStream >> _systemType; + dataStream >> _systemName; + dataStream >> _systemMode; + dataStream >> _changeOptions; +} + +bool SystemID::operator==(const SystemID& rhs) const { + bool ivarsEqual = true; + + if (!(_systemType == rhs._systemType)) ivarsEqual = false; + if (!(_systemName == rhs._systemName)) ivarsEqual = false; + if (!(_systemMode == rhs._systemMode)) ivarsEqual = false; + if (!(_changeOptions == rhs._changeOptions)) ivarsEqual = false; + + return ivarsEqual; +} + +int SystemID::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _systemType + marshalSize = marshalSize + 2; // _systemName + marshalSize = marshalSize + 1; // _systemMode + marshalSize = marshalSize + 1; // _changeOptions + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/SystemID.h b/src/dis6/distributed_emissions/SystemID.h new file mode 100644 index 00000000..5cc69050 --- /dev/null +++ b/src/dis6/distributed_emissions/SystemID.h @@ -0,0 +1,81 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// 5.2.58. Used in IFF ATC PDU + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SystemID { + protected: + /** System Type */ + uint16_t _systemType; + + /** System name, an enumeration */ + uint16_t _systemName; + + /** System mode */ + uint8_t _systemMode; + + /** Change Options */ + uint8_t _changeOptions; + + public: + SystemID(); + virtual ~SystemID(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSystemType() const; + void setSystemType(uint16_t pX); + + uint16_t getSystemName() const; + void setSystemName(uint16_t pX); + + uint8_t getSystemMode() const; + void setSystemMode(uint8_t pX); + + uint8_t getChangeOptions() const; + void setChangeOptions(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SystemID& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/TrackJamTarget.cpp b/src/dis6/distributed_emissions/TrackJamTarget.cpp new file mode 100644 index 00000000..3615491d --- /dev/null +++ b/src/dis6/distributed_emissions/TrackJamTarget.cpp @@ -0,0 +1,83 @@ +#include "dis6/distributed_emissions/TrackJamTarget.h" + +namespace dis { + +TrackJamTarget::TrackJamTarget() : _trackJam(), _emitterID(0), _beamID(0) {} + +EntityID& TrackJamTarget::getTrackJam() { return _trackJam; } + +const EntityID& TrackJamTarget::getTrackJam() const { return _trackJam; } + +void TrackJamTarget::setTrackJam(const EntityID& pX) { _trackJam = pX; } + +uint8_t TrackJamTarget::getEmitterID() const { return _emitterID; } + +void TrackJamTarget::setEmitterID(uint8_t pX) { _emitterID = pX; } + +uint8_t TrackJamTarget::getBeamID() const { return _beamID; } + +void TrackJamTarget::setBeamID(uint8_t pX) { _beamID = pX; } + +void TrackJamTarget::marshal(DataStream& dataStream) const { + _trackJam.marshal(dataStream); + dataStream << _emitterID; + dataStream << _beamID; +} + +void TrackJamTarget::unmarshal(DataStream& dataStream) { + _trackJam.unmarshal(dataStream); + dataStream >> _emitterID; + dataStream >> _beamID; +} + +bool TrackJamTarget::operator==(const TrackJamTarget& rhs) const { + bool ivarsEqual = true; + + if (!(_trackJam == rhs._trackJam)) ivarsEqual = false; + if (!(_emitterID == rhs._emitterID)) ivarsEqual = false; + if (!(_beamID == rhs._beamID)) ivarsEqual = false; + + return ivarsEqual; +} + +int TrackJamTarget::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _trackJam.GetMarshalledSize(); // _trackJam + marshalSize = marshalSize + 1; // _emitterID + marshalSize = marshalSize + 1; // _beamID + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/TrackJamTarget.h b/src/dis6/distributed_emissions/TrackJamTarget.h new file mode 100644 index 00000000..69b0f486 --- /dev/null +++ b/src/dis6/distributed_emissions/TrackJamTarget.h @@ -0,0 +1,77 @@ +#pragma once + +#include "dis6/common/EntityID.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// One track/jam target + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class TrackJamTarget { + protected: + /** track/jam target */ + EntityID _trackJam; + + /** Emitter ID */ + uint8_t _emitterID; + + /** beam ID */ + uint8_t _beamID; + + public: + TrackJamTarget(); + ~TrackJamTarget() = default; + + void marshal(DataStream& dataStream) const; + void unmarshal(DataStream& dataStream); + + EntityID& getTrackJam(); + const EntityID& getTrackJam() const; + void setTrackJam(const EntityID& pX); + + uint8_t getEmitterID() const; + void setEmitterID(uint8_t pX); + + uint8_t getBeamID() const; + void setBeamID(uint8_t pX); + + int getMarshalledSize() const; + + bool operator==(const TrackJamTarget& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/UnderwaterAcousticsPdu.cpp b/src/dis6/distributed_emissions/UnderwaterAcousticsPdu.cpp new file mode 100644 index 00000000..10aed989 --- /dev/null +++ b/src/dis6/distributed_emissions/UnderwaterAcousticsPdu.cpp @@ -0,0 +1,287 @@ +#include "dis6/distributed_emissions/UnderwaterAcousticsPdu.h" + +namespace dis { +UnderwaterAcousticsPdu::UnderwaterAcousticsPdu() + : DistributedEmissionsFamilyPdu(), + _emittingEntityID(), + _eventID(), + _stateChangeIndicator(0), + _pad(0), + _passiveParameterIndex(0), + _propulsionPlantConfiguration(0), + _numberOfShafts(0), + _numberOfAPAs(0), + _numberOfUAEmitterSystems(0) { + setPduType(29); +} + +UnderwaterAcousticsPdu::~UnderwaterAcousticsPdu() { + _shaftRPMs.clear(); + _apaData.clear(); + _emitterSystems.clear(); +} + +EntityID& UnderwaterAcousticsPdu::GetEmittingEntityId() { + return _emittingEntityID; +} + +const EntityID& UnderwaterAcousticsPdu::GetEmittingEntityId() const { + return _emittingEntityID; +} + +void UnderwaterAcousticsPdu::SetEmittingEntityId(const EntityID& pX) { + _emittingEntityID = pX; +} + +EventID& UnderwaterAcousticsPdu::GetEventId() { return _eventID; } + +const EventID& UnderwaterAcousticsPdu::GetEventId() const { return _eventID; } + +void UnderwaterAcousticsPdu::SetEventId(const EventID& pX) { _eventID = pX; } + +char UnderwaterAcousticsPdu::getStateChangeIndicator() const { + return _stateChangeIndicator; +} + +void UnderwaterAcousticsPdu::setStateChangeIndicator(char pX) { + _stateChangeIndicator = pX; +} + +char UnderwaterAcousticsPdu::getPad() const { return _pad; } + +void UnderwaterAcousticsPdu::setPad(char pX) { _pad = pX; } + +uint16_t UnderwaterAcousticsPdu::getPassiveParameterIndex() const { + return _passiveParameterIndex; +} + +void UnderwaterAcousticsPdu::setPassiveParameterIndex(uint16_t pX) { + _passiveParameterIndex = pX; +} + +uint8_t UnderwaterAcousticsPdu::getPropulsionPlantConfiguration() const { + return _propulsionPlantConfiguration; +} + +void UnderwaterAcousticsPdu::setPropulsionPlantConfiguration(uint8_t pX) { + _propulsionPlantConfiguration = pX; +} + +uint8_t UnderwaterAcousticsPdu::getNumberOfShafts() const { + return _shaftRPMs.size(); +} + +uint8_t UnderwaterAcousticsPdu::getNumberOfAPAs() const { + return _apaData.size(); +} + +uint8_t UnderwaterAcousticsPdu::getNumberOfUAEmitterSystems() const { + return _emitterSystems.size(); +} + +std::vector& UnderwaterAcousticsPdu::GetShaftRpMs() { + return _shaftRPMs; +} + +const std::vector& UnderwaterAcousticsPdu::GetShaftRpMs() const { + return _shaftRPMs; +} + +void UnderwaterAcousticsPdu::SetShaftRpMs(const std::vector& pX) { + _shaftRPMs = pX; +} + +std::vector& UnderwaterAcousticsPdu::GetApaData() { return _apaData; } + +const std::vector& UnderwaterAcousticsPdu::GetApaData() const { + return _apaData; +} + +void UnderwaterAcousticsPdu::SetApaData(const std::vector& pX) { + _apaData = pX; +} + +std::vector& +UnderwaterAcousticsPdu::GetEmitterSystems() { + return _emitterSystems; +} + +const std::vector& +UnderwaterAcousticsPdu::GetEmitterSystems() const { + return _emitterSystems; +} + +void UnderwaterAcousticsPdu::SetEmitterSystems( + const std::vector& pX) { + _emitterSystems = pX; +} + +void UnderwaterAcousticsPdu::Marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + data_stream); // Marshal information in superclass first + _emittingEntityID.marshal(dataStream); + _eventID.marshal(dataStream); + dataStream << _stateChangeIndicator; + dataStream << _pad; + dataStream << _passiveParameterIndex; + dataStream << _propulsionPlantConfiguration; + dataStream << (uint8_t)_shaftRPMs.size(); + dataStream << (uint8_t)_apaData.size(); + dataStream << (uint8_t)_emitterSystems.size(); + + for (size_t idx = 0; idx < _shaftRPMs.size(); idx++) { + ShaftRPMs x = _shaftRPMs[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _apaData.size(); idx++) { + ApaData x = _apaData[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _emitterSystems.size(); idx++) { + AcousticEmitterSystemData x = _emitterSystems[idx]; + x.marshal(dataStream); + } +} + +void UnderwaterAcousticsPdu::Unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + data_stream); // unmarshal information in superclass first + _emittingEntityID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + dataStream >> _stateChangeIndicator; + dataStream >> _pad; + dataStream >> _passiveParameterIndex; + dataStream >> _propulsionPlantConfiguration; + dataStream >> _numberOfShafts; + dataStream >> _numberOfAPAs; + dataStream >> _numberOfUAEmitterSystems; + + _shaftRPMs.clear(); + for (size_t idx = 0; idx < _numberOfShafts; idx++) { + ShaftRPMs x; + x.unmarshal(dataStream); + _shaftRPMs.push_back(x); + } + + _apaData.clear(); + for (size_t idx = 0; idx < _numberOfAPAs; idx++) { + ApaData x; + x.unmarshal(dataStream); + _apaData.push_back(x); + } + + _emitterSystems.clear(); + for (size_t idx = 0; idx < _numberOfUAEmitterSystems; idx++) { + AcousticEmitterSystemData x; + x.unmarshal(dataStream); + _emitterSystems.push_back(x); + } +} + +bool UnderwaterAcousticsPdu::operator==( + const UnderwaterAcousticsPdu& rhs) const { + bool ivars_equal = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_emittingEntityID == rhs._emittingEntityID)) { + ivars_equal = false; + } + if (!(_eventID == rhs._eventID)) { + ivars_equal = false; + } + if (!(_stateChangeIndicator == rhs._stateChangeIndicator)) { + ivars_equal = false; + } + if (!(_pad == rhs._pad)) { + ivars_equal = false; + } + if (!(_passiveParameterIndex == rhs._passiveParameterIndex)) { + ivars_equal = false; + } + if (!(_propulsionPlantConfiguration == rhs._propulsionPlantConfiguration)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < _shaftRPMs.size(); idx++) { + if (!(_shaftRPMs[idx] == rhs._shaftRPMs[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _apaData.size(); idx++) { + if (!(_apaData[idx] == rhs._apaData[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _emitterSystems.size(); idx++) { + if (!(_emitterSystems[idx] == rhs._emitterSystems[idx])) ivarsEqual = false; + } + + return ivars_equal; +} + +int UnderwaterAcousticsPdu::getMarshalledSize() const { + int marshal_size = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshal_size = marshal_size + 1; // _stateChangeIndicator + marshal_size = marshal_size + 1; // _pad + marshal_size = marshal_size + 2; // _passiveParameterIndex + marshal_size = marshal_size + 1; // _propulsionPlantConfiguration + marshal_size = marshal_size + 1; // _numberOfShafts + marshal_size = marshal_size + 1; // _numberOfAPAs + marshal_size = marshal_size + 1; // _numberOfUAEmitterSystems + + for (uint64_t idx = 0; idx < _shaftRPMs.size(); idx++) { + ShaftRPMs listElement = _shaftRPMs[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _apaData.size(); idx++) { + ApaData listElement = _apaData[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _emitterSystems.size(); idx++) { + AcousticEmitterSystemData listElement = _emitterSystems[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshal_size; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/UnderwaterAcousticsPdu.h b/src/dis6/distributed_emissions/UnderwaterAcousticsPdu.h new file mode 100644 index 00000000..5203b6b7 --- /dev/null +++ b/src/dis6/distributed_emissions/UnderwaterAcousticsPdu.h @@ -0,0 +1,150 @@ +#pragma once + +#include + +#include "dis6/common/EntityID.h" +#include "dis6/common/EventID.h" +#include "dis6/distributed_emissions/AcousticEmitterSystemData.h" +#include "dis6/distributed_emissions/ApaData.h" +#include "dis6/distributed_emissions/DistributedEmissionsFamilyPdu.h" +#include "dis6/distributed_emissions/ShaftRPMs.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.3.7.3. Information about underwater acoustic emmissions. This +// requires manual cleanup. The beam data records should ALL be a the finish, +// rather than attached to each emitter system. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class UnderwaterAcousticsPdu final : public DistributedEmissionsFamilyPdu { + protected: + /** ID of the entity that is the source of the emission */ + EntityID _emittingEntityID; + + /** ID of event */ + EventID _eventID; + + /** This field shall be used to indicate whether the data in the UA PDU + * represent a state update or data that have changed since issuance of the + * last UA PDU */ + char _stateChangeIndicator; + + /** padding */ + char _pad; + + /** This field indicates which database record (or file) shall be used in the + * definition of passive signature (unintentional) emissions of the entity. + * The indicated database record (or file) shall define all noise generated + * as a function of propulsion plant configurations and associated + * auxiliaries. */ + uint16_t _passiveParameterIndex; + + /** This field shall specify the entity propulsion plant configuration. This + * field is used to determine the passive signature characteristics of an + * entity. */ + uint8_t _propulsionPlantConfiguration; + + /** This field shall represent the number of shafts on a platform */ + uint8_t _numberOfShafts; + + /** This field shall indicate the number of APAs described in the current UA + * PDU */ + uint8_t _numberOfAPAs; + + /** This field shall specify the number of UA emitter systems being described + * in the current UA PDU */ + uint8_t _numberOfUAEmitterSystems; + + /** shaft RPM values */ + std::vector _shaftRPMs; + + /** apaData */ + std::vector _apaData; + + std::vector _emitterSystems; + + public: + UnderwaterAcousticsPdu(); + ~UnderwaterAcousticsPdu() final; + + void Marshal(DataStream& dataStream) const override; + void Unmarshal(DataStream& dataStream) override; + + EntityID& getEmittingEntityID(); + const EntityID& getEmittingEntityID() const; + void setEmittingEntityID(const EntityID& pX); + + EventID& getEventID(); + const EventID& getEventID() const; + void setEventID(const EventID& pX); + + char getStateChangeIndicator() const; + void setStateChangeIndicator(char pX); + + char getPad() const; + void setPad(char pX); + + uint16_t getPassiveParameterIndex() const; + void setPassiveParameterIndex(uint16_t pX); + + uint8_t getPropulsionPlantConfiguration() const; + void setPropulsionPlantConfiguration(uint8_t pX); + + uint8_t getNumberOfShafts() const; + + uint8_t getNumberOfAPAs() const; + + uint8_t getNumberOfUAEmitterSystems() const; + + std::vector& getShaftRPMs(); + const std::vector& getShaftRPMs() const; + void setShaftRPMs(const std::vector& pX); + + std::vector& getApaData(); + const std::vector& getApaData() const; + void setApaData(const std::vector& pX); + + std::vector& getEmitterSystems(); + const std::vector& getEmitterSystems() const; + void setEmitterSystems(const std::vector& pX); + + [[nodiscard]] int GetMarshalledSize() const override; + + bool operator==(const UnderwaterAcousticsPdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/VectoringNozzleSystemData.cpp b/src/dis6/distributed_emissions/VectoringNozzleSystemData.cpp new file mode 100644 index 00000000..71dddd0c --- /dev/null +++ b/src/dis6/distributed_emissions/VectoringNozzleSystemData.cpp @@ -0,0 +1,86 @@ +#include "dis6/distributed_emissions/VectoringNozzleSystemData.h" + +namespace dis { +VectoringNozzleSystemData::VectoringNozzleSystemData() + : _horizontalDeflectionAngle(0.0), _verticalDeflectionAngle(0.0) {} + +VectoringNozzleSystemData::~VectoringNozzleSystemData() {} + +float VectoringNozzleSystemData::getHorizontalDeflectionAngle() const { + return _horizontalDeflectionAngle; +} + +void VectoringNozzleSystemData::setHorizontalDeflectionAngle(float pX) { + _horizontalDeflectionAngle = pX; +} + +float VectoringNozzleSystemData::getVerticalDeflectionAngle() const { + return _verticalDeflectionAngle; +} + +void VectoringNozzleSystemData::setVerticalDeflectionAngle(float pX) { + _verticalDeflectionAngle = pX; +} + +void VectoringNozzleSystemData::marshal(DataStream& dataStream) const { + dataStream << _horizontalDeflectionAngle; + dataStream << _verticalDeflectionAngle; +} + +void VectoringNozzleSystemData::unmarshal(DataStream& dataStream) { + dataStream >> _horizontalDeflectionAngle; + dataStream >> _verticalDeflectionAngle; +} + +bool VectoringNozzleSystemData::operator==( + const VectoringNozzleSystemData& rhs) const { + bool ivarsEqual = true; + + if (!(_horizontalDeflectionAngle == rhs._horizontalDeflectionAngle)) + ivarsEqual = false; + if (!(_verticalDeflectionAngle == rhs._verticalDeflectionAngle)) + ivarsEqual = false; + + return ivarsEqual; +} + +int VectoringNozzleSystemData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _horizontalDeflectionAngle + marshalSize = marshalSize + 4; // _verticalDeflectionAngle + return marshalSize; +} + +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/distributed_emissions/VectoringNozzleSystemData.h b/src/dis6/distributed_emissions/VectoringNozzleSystemData.h new file mode 100644 index 00000000..7057ac6e --- /dev/null +++ b/src/dis6/distributed_emissions/VectoringNozzleSystemData.h @@ -0,0 +1,69 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace dis { +// Data about a vectoring nozzle system + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class VectoringNozzleSystemData { + protected: + /** horizontal deflection angle */ + float _horizontalDeflectionAngle; + + /** vertical deflection angle */ + float _verticalDeflectionAngle; + + public: + VectoringNozzleSystemData(); + ~VectoringNozzleSystemData(); + + void marshal(DataStream& dataStream) const; + void unmarshal(DataStream& dataStream); + + float getHorizontalDeflectionAngle() const; + void setHorizontalDeflectionAngle(float pX); + + float getVerticalDeflectionAngle() const; + void setVerticalDeflectionAngle(float pX); + + int getMarshalledSize() const; + + bool operator==(const VectoringNozzleSystemData& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/CMakeLists.txt b/src/dis6/entity_information/CMakeLists.txt new file mode 100644 index 00000000..29cf3c29 --- /dev/null +++ b/src/dis6/entity_information/CMakeLists.txt @@ -0,0 +1,29 @@ +set(entity_information_hdr + CollisionElasticPdu.h + CollisionPdu.h + DeadReckoningParameter.h + EntityInformationFamilyPdu.h + EntityStatePdu.h + EntityStateUpdatePdu.h +) + +set(entity_information_src + CollisionElasticPdu.cpp + CollisionPdu.cpp + DeadReckoningParameter.cpp + EntityInformationFamilyPdu.cpp + EntityStatePdu.cpp + EntityStateUpdatePdu.cpp +) + +list(TRANSFORM entity_information_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND entity_information_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${entity_information_src}) + +install(FILES ${entity_information_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/entity_information +) diff --git a/src/dis6/entity_information/CollisionElasticPdu.cpp b/src/dis6/entity_information/CollisionElasticPdu.cpp new file mode 100644 index 00000000..fc86d1c4 --- /dev/null +++ b/src/dis6/entity_information/CollisionElasticPdu.cpp @@ -0,0 +1,281 @@ +#include "dis6/CollisionElasticPdu.h" + +using namespace DIS; + +CollisionElasticPdu::CollisionElasticPdu() + : EntityInformationFamilyPdu(), + _issuingEntityID(), + _collidingEntityID(), + _collisionEventID(), + _pad(0), + _contactVelocity(), + _mass(0.0), + _location(), + _collisionResultXX(0.0), + _collisionResultXY(0.0), + _collisionResultXZ(0.0), + _collisionResultYY(0.0), + _collisionResultYZ(0.0), + _collisionResultZZ(0.0), + _unitSurfaceNormal(), + _coefficientOfRestitution(0.0) { + setPduType(66); + setProtocolFamily(1); +} + +CollisionElasticPdu::~CollisionElasticPdu() {} + +EntityID& CollisionElasticPdu::getIssuingEntityID() { return _issuingEntityID; } + +const EntityID& CollisionElasticPdu::getIssuingEntityID() const { + return _issuingEntityID; +} + +void CollisionElasticPdu::setIssuingEntityID(const EntityID& pX) { + _issuingEntityID = pX; +} + +EntityID& CollisionElasticPdu::getCollidingEntityID() { + return _collidingEntityID; +} + +const EntityID& CollisionElasticPdu::getCollidingEntityID() const { + return _collidingEntityID; +} + +void CollisionElasticPdu::setCollidingEntityID(const EntityID& pX) { + _collidingEntityID = pX; +} + +EventID& CollisionElasticPdu::getCollisionEventID() { + return _collisionEventID; +} + +const EventID& CollisionElasticPdu::getCollisionEventID() const { + return _collisionEventID; +} + +void CollisionElasticPdu::setCollisionEventID(const EventID& pX) { + _collisionEventID = pX; +} + +int16_t CollisionElasticPdu::getPad() const { return _pad; } + +void CollisionElasticPdu::setPad(int16_t pX) { _pad = pX; } + +Vector3Float& CollisionElasticPdu::getContactVelocity() { + return _contactVelocity; +} + +const Vector3Float& CollisionElasticPdu::getContactVelocity() const { + return _contactVelocity; +} + +void CollisionElasticPdu::setContactVelocity(const Vector3Float& pX) { + _contactVelocity = pX; +} + +float CollisionElasticPdu::getMass() const { return _mass; } + +void CollisionElasticPdu::setMass(float pX) { _mass = pX; } + +Vector3Float& CollisionElasticPdu::getLocation() { return _location; } + +const Vector3Float& CollisionElasticPdu::getLocation() const { + return _location; +} + +void CollisionElasticPdu::setLocation(const Vector3Float& pX) { + _location = pX; +} + +float CollisionElasticPdu::getCollisionResultXX() const { + return _collisionResultXX; +} + +void CollisionElasticPdu::setCollisionResultXX(float pX) { + _collisionResultXX = pX; +} + +float CollisionElasticPdu::getCollisionResultXY() const { + return _collisionResultXY; +} + +void CollisionElasticPdu::setCollisionResultXY(float pX) { + _collisionResultXY = pX; +} + +float CollisionElasticPdu::getCollisionResultXZ() const { + return _collisionResultXZ; +} + +void CollisionElasticPdu::setCollisionResultXZ(float pX) { + _collisionResultXZ = pX; +} + +float CollisionElasticPdu::getCollisionResultYY() const { + return _collisionResultYY; +} + +void CollisionElasticPdu::setCollisionResultYY(float pX) { + _collisionResultYY = pX; +} + +float CollisionElasticPdu::getCollisionResultYZ() const { + return _collisionResultYZ; +} + +void CollisionElasticPdu::setCollisionResultYZ(float pX) { + _collisionResultYZ = pX; +} + +float CollisionElasticPdu::getCollisionResultZZ() const { + return _collisionResultZZ; +} + +void CollisionElasticPdu::setCollisionResultZZ(float pX) { + _collisionResultZZ = pX; +} + +Vector3Float& CollisionElasticPdu::getUnitSurfaceNormal() { + return _unitSurfaceNormal; +} + +const Vector3Float& CollisionElasticPdu::getUnitSurfaceNormal() const { + return _unitSurfaceNormal; +} + +void CollisionElasticPdu::setUnitSurfaceNormal(const Vector3Float& pX) { + _unitSurfaceNormal = pX; +} + +float CollisionElasticPdu::getCoefficientOfRestitution() const { + return _coefficientOfRestitution; +} + +void CollisionElasticPdu::setCoefficientOfRestitution(float pX) { + _coefficientOfRestitution = pX; +} + +void CollisionElasticPdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _issuingEntityID.marshal(dataStream); + _collidingEntityID.marshal(dataStream); + _collisionEventID.marshal(dataStream); + dataStream << _pad; + _contactVelocity.marshal(dataStream); + dataStream << _mass; + _location.marshal(dataStream); + dataStream << _collisionResultXX; + dataStream << _collisionResultXY; + dataStream << _collisionResultXZ; + dataStream << _collisionResultYY; + dataStream << _collisionResultYZ; + dataStream << _collisionResultZZ; + _unitSurfaceNormal.marshal(dataStream); + dataStream << _coefficientOfRestitution; +} + +void CollisionElasticPdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _issuingEntityID.unmarshal(dataStream); + _collidingEntityID.unmarshal(dataStream); + _collisionEventID.unmarshal(dataStream); + dataStream >> _pad; + _contactVelocity.unmarshal(dataStream); + dataStream >> _mass; + _location.unmarshal(dataStream); + dataStream >> _collisionResultXX; + dataStream >> _collisionResultXY; + dataStream >> _collisionResultXZ; + dataStream >> _collisionResultYY; + dataStream >> _collisionResultYZ; + dataStream >> _collisionResultZZ; + _unitSurfaceNormal.unmarshal(dataStream); + dataStream >> _coefficientOfRestitution; +} + +bool CollisionElasticPdu::operator==(const CollisionElasticPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_issuingEntityID == rhs._issuingEntityID)) ivarsEqual = false; + if (!(_collidingEntityID == rhs._collidingEntityID)) ivarsEqual = false; + if (!(_collisionEventID == rhs._collisionEventID)) ivarsEqual = false; + if (!(_pad == rhs._pad)) ivarsEqual = false; + if (!(_contactVelocity == rhs._contactVelocity)) ivarsEqual = false; + if (!(_mass == rhs._mass)) ivarsEqual = false; + if (!(_location == rhs._location)) ivarsEqual = false; + if (!(_collisionResultXX == rhs._collisionResultXX)) ivarsEqual = false; + if (!(_collisionResultXY == rhs._collisionResultXY)) ivarsEqual = false; + if (!(_collisionResultXZ == rhs._collisionResultXZ)) ivarsEqual = false; + if (!(_collisionResultYY == rhs._collisionResultYY)) ivarsEqual = false; + if (!(_collisionResultYZ == rhs._collisionResultYZ)) ivarsEqual = false; + if (!(_collisionResultZZ == rhs._collisionResultZZ)) ivarsEqual = false; + if (!(_unitSurfaceNormal == rhs._unitSurfaceNormal)) ivarsEqual = false; + if (!(_coefficientOfRestitution == rhs._coefficientOfRestitution)) + ivarsEqual = false; + + return ivarsEqual; +} + +int CollisionElasticPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _issuingEntityID.getMarshalledSize(); // _issuingEntityID + marshalSize = marshalSize + + _collidingEntityID.getMarshalledSize(); // _collidingEntityID + marshalSize = + marshalSize + _collisionEventID.getMarshalledSize(); // _collisionEventID + marshalSize = marshalSize + 2; // _pad + marshalSize = + marshalSize + _contactVelocity.getMarshalledSize(); // _contactVelocity + marshalSize = marshalSize + 4; // _mass + marshalSize = marshalSize + _location.getMarshalledSize(); // _location + marshalSize = marshalSize + 4; // _collisionResultXX + marshalSize = marshalSize + 4; // _collisionResultXY + marshalSize = marshalSize + 4; // _collisionResultXZ + marshalSize = marshalSize + 4; // _collisionResultYY + marshalSize = marshalSize + 4; // _collisionResultYZ + marshalSize = marshalSize + 4; // _collisionResultZZ + marshalSize = marshalSize + + _unitSurfaceNormal.getMarshalledSize(); // _unitSurfaceNormal + marshalSize = marshalSize + 4; // _coefficientOfRestitution + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/CollisionElasticPdu.h b/src/dis6/entity_information/CollisionElasticPdu.h new file mode 100644 index 00000000..a68815f6 --- /dev/null +++ b/src/dis6/entity_information/CollisionElasticPdu.h @@ -0,0 +1,162 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/EntityInformationFamilyPdu.h" +#include "dis6/EventID.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.3.3.3. Information about elastic collisions in a DIS exercise shall be +// communicated using a Collision-Elastic PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class CollisionElasticPdu : public EntityInformationFamilyPdu { + protected: + /** ID of the entity that issued the collision PDU */ + EntityID _issuingEntityID; + + /** ID of entity that has collided with the issuing entity ID */ + EntityID _collidingEntityID; + + /** ID of event */ + EventID _collisionEventID; + + /** some padding */ + int16_t _pad; + + /** velocity at collision */ + Vector3Float _contactVelocity; + + /** mass of issuing entity */ + float _mass; + + /** Location with respect to entity the issuing entity collided with */ + Vector3Float _location; + + /** tensor values */ + float _collisionResultXX; + + /** tensor values */ + float _collisionResultXY; + + /** tensor values */ + float _collisionResultXZ; + + /** tensor values */ + float _collisionResultYY; + + /** tensor values */ + float _collisionResultYZ; + + /** tensor values */ + float _collisionResultZZ; + + /** This record shall represent the normal vector to the surface at the point + * of collision detection. The surface normal shall be represented in world + * coordinates. */ + Vector3Float _unitSurfaceNormal; + + /** This field shall represent the degree to which energy is conserved in a + * collision */ + float _coefficientOfRestitution; + + public: + CollisionElasticPdu(); + virtual ~CollisionElasticPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getIssuingEntityID(); + const EntityID& getIssuingEntityID() const; + void setIssuingEntityID(const EntityID& pX); + + EntityID& getCollidingEntityID(); + const EntityID& getCollidingEntityID() const; + void setCollidingEntityID(const EntityID& pX); + + EventID& getCollisionEventID(); + const EventID& getCollisionEventID() const; + void setCollisionEventID(const EventID& pX); + + int16_t getPad() const; + void setPad(int16_t pX); + + Vector3Float& getContactVelocity(); + const Vector3Float& getContactVelocity() const; + void setContactVelocity(const Vector3Float& pX); + + float getMass() const; + void setMass(float pX); + + Vector3Float& getLocation(); + const Vector3Float& getLocation() const; + void setLocation(const Vector3Float& pX); + + float getCollisionResultXX() const; + void setCollisionResultXX(float pX); + + float getCollisionResultXY() const; + void setCollisionResultXY(float pX); + + float getCollisionResultXZ() const; + void setCollisionResultXZ(float pX); + + float getCollisionResultYY() const; + void setCollisionResultYY(float pX); + + float getCollisionResultYZ() const; + void setCollisionResultYZ(float pX); + + float getCollisionResultZZ() const; + void setCollisionResultZZ(float pX); + + Vector3Float& getUnitSurfaceNormal(); + const Vector3Float& getUnitSurfaceNormal() const; + void setUnitSurfaceNormal(const Vector3Float& pX); + + float getCoefficientOfRestitution() const; + void setCoefficientOfRestitution(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CollisionElasticPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/CollisionPdu.cpp b/src/dis6/entity_information/CollisionPdu.cpp new file mode 100644 index 00000000..ecc3d640 --- /dev/null +++ b/src/dis6/entity_information/CollisionPdu.cpp @@ -0,0 +1,160 @@ +#include "dis6/CollisionPdu.h" + +using namespace DIS; + +CollisionPdu::CollisionPdu() + : EntityInformationFamilyPdu(), + _issuingEntityID(), + _collidingEntityID(), + _eventID(), + _collisionType(0), + _pad(0), + _velocity(), + _mass(0.0), + _location() { + setPduType(4); + setProtocolFamily(1); +} + +CollisionPdu::~CollisionPdu() {} + +EntityID& CollisionPdu::getIssuingEntityID() { return _issuingEntityID; } + +const EntityID& CollisionPdu::getIssuingEntityID() const { + return _issuingEntityID; +} + +void CollisionPdu::setIssuingEntityID(const EntityID& pX) { + _issuingEntityID = pX; +} + +EntityID& CollisionPdu::getCollidingEntityID() { return _collidingEntityID; } + +const EntityID& CollisionPdu::getCollidingEntityID() const { + return _collidingEntityID; +} + +void CollisionPdu::setCollidingEntityID(const EntityID& pX) { + _collidingEntityID = pX; +} + +EventID& CollisionPdu::getEventID() { return _eventID; } + +const EventID& CollisionPdu::getEventID() const { return _eventID; } + +void CollisionPdu::setEventID(const EventID& pX) { _eventID = pX; } + +uint8_t CollisionPdu::getCollisionType() const { return _collisionType; } + +void CollisionPdu::setCollisionType(uint8_t pX) { _collisionType = pX; } + +char CollisionPdu::getPad() const { return _pad; } + +void CollisionPdu::setPad(char pX) { _pad = pX; } + +Vector3Float& CollisionPdu::getVelocity() { return _velocity; } + +const Vector3Float& CollisionPdu::getVelocity() const { return _velocity; } + +void CollisionPdu::setVelocity(const Vector3Float& pX) { _velocity = pX; } + +float CollisionPdu::getMass() const { return _mass; } + +void CollisionPdu::setMass(float pX) { _mass = pX; } + +Vector3Float& CollisionPdu::getLocation() { return _location; } + +const Vector3Float& CollisionPdu::getLocation() const { return _location; } + +void CollisionPdu::setLocation(const Vector3Float& pX) { _location = pX; } + +void CollisionPdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _issuingEntityID.marshal(dataStream); + _collidingEntityID.marshal(dataStream); + _eventID.marshal(dataStream); + dataStream << _collisionType; + dataStream << _pad; + _velocity.marshal(dataStream); + dataStream << _mass; + _location.marshal(dataStream); +} + +void CollisionPdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _issuingEntityID.unmarshal(dataStream); + _collidingEntityID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + dataStream >> _collisionType; + dataStream >> _pad; + _velocity.unmarshal(dataStream); + dataStream >> _mass; + _location.unmarshal(dataStream); +} + +bool CollisionPdu::operator==(const CollisionPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_issuingEntityID == rhs._issuingEntityID)) ivarsEqual = false; + if (!(_collidingEntityID == rhs._collidingEntityID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_collisionType == rhs._collisionType)) ivarsEqual = false; + if (!(_pad == rhs._pad)) ivarsEqual = false; + if (!(_velocity == rhs._velocity)) ivarsEqual = false; + if (!(_mass == rhs._mass)) ivarsEqual = false; + if (!(_location == rhs._location)) ivarsEqual = false; + + return ivarsEqual; +} + +int CollisionPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _issuingEntityID.getMarshalledSize(); // _issuingEntityID + marshalSize = marshalSize + + _collidingEntityID.getMarshalledSize(); // _collidingEntityID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + 1; // _collisionType + marshalSize = marshalSize + 1; // _pad + marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity + marshalSize = marshalSize + 4; // _mass + marshalSize = marshalSize + _location.getMarshalledSize(); // _location + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/CollisionPdu.h b/src/dis6/entity_information/CollisionPdu.h new file mode 100644 index 00000000..538705e6 --- /dev/null +++ b/src/dis6/entity_information/CollisionPdu.h @@ -0,0 +1,115 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/EntityInformationFamilyPdu.h" +#include "dis6/EventID.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.3.2. Information about a collision. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class CollisionPdu : public EntityInformationFamilyPdu { + protected: + /** ID of the entity that issued the collision PDU */ + EntityID _issuingEntityID; + + /** ID of entity that has collided with the issuing entity ID */ + EntityID _collidingEntityID; + + /** ID of event */ + EventID _eventID; + + /** ID of event */ + uint8_t _collisionType; + + /** some padding */ + char _pad; + + /** velocity at collision */ + Vector3Float _velocity; + + /** mass of issuing entity */ + float _mass; + + /** Location with respect to entity the issuing entity collided with */ + Vector3Float _location; + + public: + CollisionPdu(); + virtual ~CollisionPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getIssuingEntityID(); + const EntityID& getIssuingEntityID() const; + void setIssuingEntityID(const EntityID& pX); + + EntityID& getCollidingEntityID(); + const EntityID& getCollidingEntityID() const; + void setCollidingEntityID(const EntityID& pX); + + EventID& getEventID(); + const EventID& getEventID() const; + void setEventID(const EventID& pX); + + uint8_t getCollisionType() const; + void setCollisionType(uint8_t pX); + + char getPad() const; + void setPad(char pX); + + Vector3Float& getVelocity(); + const Vector3Float& getVelocity() const; + void setVelocity(const Vector3Float& pX); + + float getMass() const; + void setMass(float pX); + + Vector3Float& getLocation(); + const Vector3Float& getLocation() const; + void setLocation(const Vector3Float& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CollisionPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/DeadReckoningParameter.cpp b/src/dis6/entity_information/DeadReckoningParameter.cpp new file mode 100644 index 00000000..2b5c5f5e --- /dev/null +++ b/src/dis6/entity_information/DeadReckoningParameter.cpp @@ -0,0 +1,149 @@ +#include "dis6/DeadReckoningParameter.h" + +using namespace DIS; + +DeadReckoningParameter::DeadReckoningParameter() + : _deadReckoningAlgorithm(0), + _entityLinearAcceleration(), + _entityAngularVelocity() { + // Initialize fixed length array + for (int lengthotherParameters = 0; lengthotherParameters < 15; + lengthotherParameters++) { + _otherParameters[lengthotherParameters] = 0; + } +} + +DeadReckoningParameter::~DeadReckoningParameter() {} + +uint8_t DeadReckoningParameter::getDeadReckoningAlgorithm() const { + return _deadReckoningAlgorithm; +} + +void DeadReckoningParameter::setDeadReckoningAlgorithm(uint8_t pX) { + _deadReckoningAlgorithm = pX; +} + +char* DeadReckoningParameter::getOtherParameters() { return _otherParameters; } + +const char* DeadReckoningParameter::getOtherParameters() const { + return _otherParameters; +} + +void DeadReckoningParameter::setOtherParameters(const char* x) { + for (int i = 0; i < 15; i++) { + _otherParameters[i] = x[i]; + } +} + +Vector3Float& DeadReckoningParameter::getEntityLinearAcceleration() { + return _entityLinearAcceleration; +} + +const Vector3Float& DeadReckoningParameter::getEntityLinearAcceleration() + const { + return _entityLinearAcceleration; +} + +void DeadReckoningParameter::setEntityLinearAcceleration( + const Vector3Float& pX) { + _entityLinearAcceleration = pX; +} + +Vector3Float& DeadReckoningParameter::getEntityAngularVelocity() { + return _entityAngularVelocity; +} + +const Vector3Float& DeadReckoningParameter::getEntityAngularVelocity() const { + return _entityAngularVelocity; +} + +void DeadReckoningParameter::setEntityAngularVelocity(const Vector3Float& pX) { + _entityAngularVelocity = pX; +} + +void DeadReckoningParameter::marshal(DataStream& dataStream) const { + dataStream << _deadReckoningAlgorithm; + + for (size_t idx = 0; idx < 15; idx++) { + dataStream << _otherParameters[idx]; + } + + _entityLinearAcceleration.marshal(dataStream); + _entityAngularVelocity.marshal(dataStream); +} + +void DeadReckoningParameter::unmarshal(DataStream& dataStream) { + dataStream >> _deadReckoningAlgorithm; + + for (size_t idx = 0; idx < 15; idx++) { + dataStream >> _otherParameters[idx]; + } + + _entityLinearAcceleration.unmarshal(dataStream); + _entityAngularVelocity.unmarshal(dataStream); +} + +bool DeadReckoningParameter::operator==( + const DeadReckoningParameter& rhs) const { + bool ivarsEqual = true; + + if (!(_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm)) + ivarsEqual = false; + + for (uint8_t idx = 0; idx < 15; idx++) { + if (!(_otherParameters[idx] == rhs._otherParameters[idx])) + ivarsEqual = false; + } + + if (!(_entityLinearAcceleration == rhs._entityLinearAcceleration)) + ivarsEqual = false; + if (!(_entityAngularVelocity == rhs._entityAngularVelocity)) + ivarsEqual = false; + + return ivarsEqual; +} + +int DeadReckoningParameter::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _deadReckoningAlgorithm + marshalSize = marshalSize + 15 * 1; // _otherParameters + marshalSize = + marshalSize + _entityLinearAcceleration + .getMarshalledSize(); // _entityLinearAcceleration + marshalSize = + marshalSize + + _entityAngularVelocity.getMarshalledSize(); // _entityAngularVelocity + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/DeadReckoningParameter.h b/src/dis6/entity_information/DeadReckoningParameter.h new file mode 100644 index 00000000..f81ae86f --- /dev/null +++ b/src/dis6/entity_information/DeadReckoningParameter.h @@ -0,0 +1,86 @@ +#pragma once + +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// represents values used in dead reckoning algorithms + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class DeadReckoningParameter { + protected: + /** enumeration of what dead reckoning algorighm to use */ + uint8_t _deadReckoningAlgorithm; + + /** other parameters to use in the dead reckoning algorithm */ + char _otherParameters[15]; + + /** Linear acceleration of the entity */ + Vector3Float _entityLinearAcceleration; + + /** angular velocity of the entity */ + Vector3Float _entityAngularVelocity; + + public: + DeadReckoningParameter(); + virtual ~DeadReckoningParameter(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getDeadReckoningAlgorithm() const; + void setDeadReckoningAlgorithm(uint8_t pX); + + char* getOtherParameters(); + const char* getOtherParameters() const; + void setOtherParameters(const char* pX); + + Vector3Float& getEntityLinearAcceleration(); + const Vector3Float& getEntityLinearAcceleration() const; + void setEntityLinearAcceleration(const Vector3Float& pX); + + Vector3Float& getEntityAngularVelocity(); + const Vector3Float& getEntityAngularVelocity() const; + void setEntityAngularVelocity(const Vector3Float& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DeadReckoningParameter& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/EntityInformationFamilyPdu.cpp b/src/dis6/entity_information/EntityInformationFamilyPdu.cpp new file mode 100644 index 00000000..99ce6db0 --- /dev/null +++ b/src/dis6/entity_information/EntityInformationFamilyPdu.cpp @@ -0,0 +1,67 @@ +#include "dis6/EntityInformationFamilyPdu.h" + +using namespace DIS; + +EntityInformationFamilyPdu::EntityInformationFamilyPdu() + : Pdu() + +{ + setProtocolFamily(1); +} + +EntityInformationFamilyPdu::~EntityInformationFamilyPdu() {} + +void EntityInformationFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void EntityInformationFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool EntityInformationFamilyPdu::operator==( + const EntityInformationFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int EntityInformationFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/EntityInformationFamilyPdu.h b/src/dis6/entity_information/EntityInformationFamilyPdu.h new file mode 100644 index 00000000..787880e6 --- /dev/null +++ b/src/dis6/entity_information/EntityInformationFamilyPdu.h @@ -0,0 +1,61 @@ +#pragma once + +#include "dis6/Pdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.3. Common superclass for EntityState, Collision, +// collision-elastic, and entity state update PDUs. This should be abstract. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EntityInformationFamilyPdu : public Pdu { + protected: + public: + EntityInformationFamilyPdu(); + virtual ~EntityInformationFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityInformationFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/EntityStatePdu.cpp b/src/dis6/entity_information/EntityStatePdu.cpp new file mode 100644 index 00000000..9b4974f3 --- /dev/null +++ b/src/dis6/entity_information/EntityStatePdu.cpp @@ -0,0 +1,269 @@ +#include "dis6/EntityStatePdu.h" + +using namespace DIS; + +EntityStatePdu::EntityStatePdu() + : EntityInformationFamilyPdu(), + _entityID(), + _forceId(0), + _numberOfArticulationParameters(0), + _entityType(), + _alternativeEntityType(), + _entityLinearVelocity(), + _entityLocation(), + _entityOrientation(), + _entityAppearance(0), + _deadReckoningParameters(), + _marking(), + _capabilities(0) { + setPduType(1); +} + +EntityStatePdu::~EntityStatePdu() { _articulationParameters.clear(); } + +EntityID& EntityStatePdu::getEntityID() { return _entityID; } + +const EntityID& EntityStatePdu::getEntityID() const { return _entityID; } + +void EntityStatePdu::setEntityID(const EntityID& pX) { _entityID = pX; } + +uint8_t EntityStatePdu::getForceId() const { return _forceId; } + +void EntityStatePdu::setForceId(uint8_t pX) { _forceId = pX; } + +char EntityStatePdu::getNumberOfArticulationParameters() const { + return _articulationParameters.size(); +} + +EntityType& EntityStatePdu::getEntityType() { return _entityType; } + +const EntityType& EntityStatePdu::getEntityType() const { return _entityType; } + +void EntityStatePdu::setEntityType(const EntityType& pX) { _entityType = pX; } + +EntityType& EntityStatePdu::getAlternativeEntityType() { + return _alternativeEntityType; +} + +const EntityType& EntityStatePdu::getAlternativeEntityType() const { + return _alternativeEntityType; +} + +void EntityStatePdu::setAlternativeEntityType(const EntityType& pX) { + _alternativeEntityType = pX; +} + +Vector3Float& EntityStatePdu::getEntityLinearVelocity() { + return _entityLinearVelocity; +} + +const Vector3Float& EntityStatePdu::getEntityLinearVelocity() const { + return _entityLinearVelocity; +} + +void EntityStatePdu::setEntityLinearVelocity(const Vector3Float& pX) { + _entityLinearVelocity = pX; +} + +Vector3Double& EntityStatePdu::getEntityLocation() { return _entityLocation; } + +const Vector3Double& EntityStatePdu::getEntityLocation() const { + return _entityLocation; +} + +void EntityStatePdu::setEntityLocation(const Vector3Double& pX) { + _entityLocation = pX; +} + +Orientation& EntityStatePdu::getEntityOrientation() { + return _entityOrientation; +} + +const Orientation& EntityStatePdu::getEntityOrientation() const { + return _entityOrientation; +} + +void EntityStatePdu::setEntityOrientation(const Orientation& pX) { + _entityOrientation = pX; +} + +int EntityStatePdu::getEntityAppearance() const { return _entityAppearance; } + +void EntityStatePdu::setEntityAppearance(int pX) { _entityAppearance = pX; } + +DeadReckoningParameter& EntityStatePdu::getDeadReckoningParameters() { + return _deadReckoningParameters; +} + +const DeadReckoningParameter& EntityStatePdu::getDeadReckoningParameters() + const { + return _deadReckoningParameters; +} + +void EntityStatePdu::setDeadReckoningParameters( + const DeadReckoningParameter& pX) { + _deadReckoningParameters = pX; +} + +Marking& EntityStatePdu::getMarking() { return _marking; } + +const Marking& EntityStatePdu::getMarking() const { return _marking; } + +void EntityStatePdu::setMarking(const Marking& pX) { _marking = pX; } + +int EntityStatePdu::getCapabilities() const { return _capabilities; } + +void EntityStatePdu::setCapabilities(int pX) { _capabilities = pX; } + +std::vector& +EntityStatePdu::getArticulationParameters() { + return _articulationParameters; +} + +const std::vector& +EntityStatePdu::getArticulationParameters() const { + return _articulationParameters; +} + +void EntityStatePdu::setArticulationParameters( + const std::vector& pX) { + _articulationParameters = pX; +} + +void EntityStatePdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _entityID.marshal(dataStream); + dataStream << _forceId; + dataStream << (char)_articulationParameters.size(); + _entityType.marshal(dataStream); + _alternativeEntityType.marshal(dataStream); + _entityLinearVelocity.marshal(dataStream); + _entityLocation.marshal(dataStream); + _entityOrientation.marshal(dataStream); + dataStream << _entityAppearance; + _deadReckoningParameters.marshal(dataStream); + _marking.marshal(dataStream); + dataStream << _capabilities; + + for (size_t idx = 0; idx < _articulationParameters.size(); idx++) { + ArticulationParameter x = _articulationParameters[idx]; + x.marshal(dataStream); + } +} + +void EntityStatePdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _entityID.unmarshal(dataStream); + dataStream >> _forceId; + dataStream >> _numberOfArticulationParameters; + _entityType.unmarshal(dataStream); + _alternativeEntityType.unmarshal(dataStream); + _entityLinearVelocity.unmarshal(dataStream); + _entityLocation.unmarshal(dataStream); + _entityOrientation.unmarshal(dataStream); + dataStream >> _entityAppearance; + _deadReckoningParameters.unmarshal(dataStream); + _marking.unmarshal(dataStream); + dataStream >> _capabilities; + + _articulationParameters.clear(); + for (char idx = 0; idx < _numberOfArticulationParameters; idx++) { + ArticulationParameter x; + x.unmarshal(dataStream); + _articulationParameters.push_back(x); + } +} + +bool EntityStatePdu::operator==(const EntityStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_forceId == rhs._forceId)) ivarsEqual = false; + if (!(_entityType == rhs._entityType)) ivarsEqual = false; + if (!(_alternativeEntityType == rhs._alternativeEntityType)) + ivarsEqual = false; + if (!(_entityLinearVelocity == rhs._entityLinearVelocity)) ivarsEqual = false; + if (!(_entityLocation == rhs._entityLocation)) ivarsEqual = false; + if (!(_entityOrientation == rhs._entityOrientation)) ivarsEqual = false; + if (!(_entityAppearance == rhs._entityAppearance)) ivarsEqual = false; + if (!(_deadReckoningParameters == rhs._deadReckoningParameters)) + ivarsEqual = false; + if (!(_marking == rhs._marking)) ivarsEqual = false; + if (!(_capabilities == rhs._capabilities)) ivarsEqual = false; + + for (size_t idx = 0; idx < _articulationParameters.size(); idx++) { + if (!(_articulationParameters[idx] == rhs._articulationParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int EntityStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID + marshalSize = marshalSize + 1; // _forceId + marshalSize = marshalSize + 1; // _numberOfArticulationParameters + marshalSize = marshalSize + _entityType.getMarshalledSize(); // _entityType + marshalSize = + marshalSize + + _alternativeEntityType.getMarshalledSize(); // _alternativeEntityType + marshalSize = + marshalSize + + _entityLinearVelocity.getMarshalledSize(); // _entityLinearVelocity + marshalSize = + marshalSize + _entityLocation.getMarshalledSize(); // _entityLocation + marshalSize = marshalSize + + _entityOrientation.getMarshalledSize(); // _entityOrientation + marshalSize = marshalSize + 4; // _entityAppearance + marshalSize = + marshalSize + + _deadReckoningParameters.getMarshalledSize(); // _deadReckoningParameters + marshalSize = marshalSize + _marking.getMarshalledSize(); // _marking + marshalSize = marshalSize + 4; // _capabilities + + for (uint64_t idx = 0; idx < _articulationParameters.size(); + idx++) { + ArticulationParameter listElement = _articulationParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/EntityStatePdu.h b/src/dis6/entity_information/EntityStatePdu.h new file mode 100644 index 00000000..01997d0b --- /dev/null +++ b/src/dis6/entity_information/EntityStatePdu.h @@ -0,0 +1,157 @@ +#pragma once + +#include + +#include "dis6/ArticulationParameter.h" +#include "dis6/DeadReckoningParameter.h" +#include "dis6/EntityID.h" +#include "dis6/EntityInformationFamilyPdu.h" +#include "dis6/EntityType.h" +#include "dis6/Marking.h" +#include "dis6/Orientation.h" +#include "dis6/Vector3Double.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.3.1. Represents the postion and state of one entity in the world. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EntityStatePdu : public EntityInformationFamilyPdu { + protected: + /** Unique ID for an entity that is tied to this state information */ + EntityID _entityID; + + /** What force this entity is affiliated with, eg red, blue, neutral, etc */ + uint8_t _forceId; + + /** How many articulation parameters are in the variable length list */ + char _numberOfArticulationParameters; + + /** Describes the type of entity in the world */ + EntityType _entityType; + + EntityType _alternativeEntityType; + + /** Describes the speed of the entity in the world */ + Vector3Float _entityLinearVelocity; + + /** describes the location of the entity in the world */ + Vector3Double _entityLocation; + + /** describes the orientation of the entity, in euler angles */ + Orientation _entityOrientation; + + /** a series of bit flags that are used to help draw the entity, such as + * smoking, on fire, etc. */ + int _entityAppearance; + + /** parameters used for dead reckoning */ + DeadReckoningParameter _deadReckoningParameters; + + /** characters that can be used for debugging, or to draw unique strings on + * the side of entities in the world */ + Marking _marking; + + /** a series of bit flags */ + int _capabilities; + + /** variable length list of articulation parameters */ + std::vector _articulationParameters; + + public: + EntityStatePdu(); + virtual ~EntityStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + uint8_t getForceId() const; + void setForceId(uint8_t pX); + + char getNumberOfArticulationParameters() const; + + EntityType& getEntityType(); + const EntityType& getEntityType() const; + void setEntityType(const EntityType& pX); + + EntityType& getAlternativeEntityType(); + const EntityType& getAlternativeEntityType() const; + void setAlternativeEntityType(const EntityType& pX); + + Vector3Float& getEntityLinearVelocity(); + const Vector3Float& getEntityLinearVelocity() const; + void setEntityLinearVelocity(const Vector3Float& pX); + + Vector3Double& getEntityLocation(); + const Vector3Double& getEntityLocation() const; + void setEntityLocation(const Vector3Double& pX); + + Orientation& getEntityOrientation(); + const Orientation& getEntityOrientation() const; + void setEntityOrientation(const Orientation& pX); + + int getEntityAppearance() const; + void setEntityAppearance(int pX); + + DeadReckoningParameter& getDeadReckoningParameters(); + const DeadReckoningParameter& getDeadReckoningParameters() const; + void setDeadReckoningParameters(const DeadReckoningParameter& pX); + + Marking& getMarking(); + const Marking& getMarking() const; + void setMarking(const Marking& pX); + + int getCapabilities() const; + void setCapabilities(int pX); + + std::vector& getArticulationParameters(); + const std::vector& getArticulationParameters() const; + void setArticulationParameters(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/EntityStateUpdatePdu.cpp b/src/dis6/entity_information/EntityStateUpdatePdu.cpp new file mode 100644 index 00000000..c050777d --- /dev/null +++ b/src/dis6/entity_information/EntityStateUpdatePdu.cpp @@ -0,0 +1,205 @@ +#include "dis6/EntityStateUpdatePdu.h" + +using namespace DIS; + +EntityStateUpdatePdu::EntityStateUpdatePdu() + : EntityInformationFamilyPdu(), + _entityID(), + _padding1(0), + _numberOfArticulationParameters(0), + _entityLinearVelocity(), + _entityLocation(), + _entityOrientation(), + _entityAppearance(0) { + setPduType(67); + setProtocolFamily(1); +} + +EntityStateUpdatePdu::~EntityStateUpdatePdu() { + _articulationParameters.clear(); +} + +EntityID& EntityStateUpdatePdu::getEntityID() { return _entityID; } + +const EntityID& EntityStateUpdatePdu::getEntityID() const { return _entityID; } + +void EntityStateUpdatePdu::setEntityID(const EntityID& pX) { _entityID = pX; } + +char EntityStateUpdatePdu::getPadding1() const { return _padding1; } + +void EntityStateUpdatePdu::setPadding1(char pX) { _padding1 = pX; } + +uint8_t EntityStateUpdatePdu::getNumberOfArticulationParameters() const { + return _articulationParameters.size(); +} + +Vector3Float& EntityStateUpdatePdu::getEntityLinearVelocity() { + return _entityLinearVelocity; +} + +const Vector3Float& EntityStateUpdatePdu::getEntityLinearVelocity() const { + return _entityLinearVelocity; +} + +void EntityStateUpdatePdu::setEntityLinearVelocity(const Vector3Float& pX) { + _entityLinearVelocity = pX; +} + +Vector3Double& EntityStateUpdatePdu::getEntityLocation() { + return _entityLocation; +} + +const Vector3Double& EntityStateUpdatePdu::getEntityLocation() const { + return _entityLocation; +} + +void EntityStateUpdatePdu::setEntityLocation(const Vector3Double& pX) { + _entityLocation = pX; +} + +Orientation& EntityStateUpdatePdu::getEntityOrientation() { + return _entityOrientation; +} + +const Orientation& EntityStateUpdatePdu::getEntityOrientation() const { + return _entityOrientation; +} + +void EntityStateUpdatePdu::setEntityOrientation(const Orientation& pX) { + _entityOrientation = pX; +} + +int EntityStateUpdatePdu::getEntityAppearance() const { + return _entityAppearance; +} + +void EntityStateUpdatePdu::setEntityAppearance(int pX) { + _entityAppearance = pX; +} + +std::vector& +EntityStateUpdatePdu::getArticulationParameters() { + return _articulationParameters; +} + +const std::vector& +EntityStateUpdatePdu::getArticulationParameters() const { + return _articulationParameters; +} + +void EntityStateUpdatePdu::setArticulationParameters( + const std::vector& pX) { + _articulationParameters = pX; +} + +void EntityStateUpdatePdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _entityID.marshal(dataStream); + dataStream << _padding1; + dataStream << (uint8_t)_articulationParameters.size(); + _entityLinearVelocity.marshal(dataStream); + _entityLocation.marshal(dataStream); + _entityOrientation.marshal(dataStream); + dataStream << _entityAppearance; + + for (size_t idx = 0; idx < _articulationParameters.size(); idx++) { + ArticulationParameter x = _articulationParameters[idx]; + x.marshal(dataStream); + } +} + +void EntityStateUpdatePdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _entityID.unmarshal(dataStream); + dataStream >> _padding1; + dataStream >> _numberOfArticulationParameters; + _entityLinearVelocity.unmarshal(dataStream); + _entityLocation.unmarshal(dataStream); + _entityOrientation.unmarshal(dataStream); + dataStream >> _entityAppearance; + + _articulationParameters.clear(); + for (size_t idx = 0; idx < _numberOfArticulationParameters; idx++) { + ArticulationParameter x; + x.unmarshal(dataStream); + _articulationParameters.push_back(x); + } +} + +bool EntityStateUpdatePdu::operator==(const EntityStateUpdatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_entityLinearVelocity == rhs._entityLinearVelocity)) ivarsEqual = false; + if (!(_entityLocation == rhs._entityLocation)) ivarsEqual = false; + if (!(_entityOrientation == rhs._entityOrientation)) ivarsEqual = false; + if (!(_entityAppearance == rhs._entityAppearance)) ivarsEqual = false; + + for (size_t idx = 0; idx < _articulationParameters.size(); idx++) { + if (!(_articulationParameters[idx] == rhs._articulationParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int EntityStateUpdatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID + marshalSize = marshalSize + 1; // _padding1 + marshalSize = marshalSize + 1; // _numberOfArticulationParameters + marshalSize = + marshalSize + + _entityLinearVelocity.getMarshalledSize(); // _entityLinearVelocity + marshalSize = + marshalSize + _entityLocation.getMarshalledSize(); // _entityLocation + marshalSize = marshalSize + + _entityOrientation.getMarshalledSize(); // _entityOrientation + marshalSize = marshalSize + 4; // _entityAppearance + + for (uint64_t idx = 0; idx < _articulationParameters.size(); + idx++) { + ArticulationParameter listElement = _articulationParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_information/EntityStateUpdatePdu.h b/src/dis6/entity_information/EntityStateUpdatePdu.h new file mode 100644 index 00000000..3f0d402a --- /dev/null +++ b/src/dis6/entity_information/EntityStateUpdatePdu.h @@ -0,0 +1,119 @@ +#pragma once + +#include + +#include "dis6/ArticulationParameter.h" +#include "dis6/EntityID.h" +#include "dis6/EntityInformationFamilyPdu.h" +#include "dis6/Orientation.h" +#include "dis6/Vector3Double.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.3.3.4. Nonstatic information about a particular entity may be communicated +// by issuing an Entity State Update PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EntityStateUpdatePdu : public EntityInformationFamilyPdu { + protected: + /** This field shall identify the entity issuing the PDU */ + EntityID _entityID; + + /** Padding */ + char _padding1; + + /** How many articulation parameters are in the variable length list */ + uint8_t _numberOfArticulationParameters; + + /** Describes the speed of the entity in the world */ + Vector3Float _entityLinearVelocity; + + /** describes the location of the entity in the world */ + Vector3Double _entityLocation; + + /** describes the orientation of the entity, in euler angles */ + Orientation _entityOrientation; + + /** a series of bit flags that are used to help draw the entity, such as + * smoking, on fire, etc. */ + int _entityAppearance; + + std::vector _articulationParameters; + + public: + EntityStateUpdatePdu(); + virtual ~EntityStateUpdatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + char getPadding1() const; + void setPadding1(char pX); + + uint8_t getNumberOfArticulationParameters() const; + + Vector3Float& getEntityLinearVelocity(); + const Vector3Float& getEntityLinearVelocity() const; + void setEntityLinearVelocity(const Vector3Float& pX); + + Vector3Double& getEntityLocation(); + const Vector3Double& getEntityLocation() const; + void setEntityLocation(const Vector3Double& pX); + + Orientation& getEntityOrientation(); + const Orientation& getEntityOrientation() const; + void setEntityOrientation(const Orientation& pX); + + int getEntityAppearance() const; + void setEntityAppearance(int pX); + + std::vector& getArticulationParameters(); + const std::vector& getArticulationParameters() const; + void setArticulationParameters(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityStateUpdatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/AggregateID.cpp b/src/dis6/entity_management/AggregateID.cpp new file mode 100644 index 00000000..70bba1a2 --- /dev/null +++ b/src/dis6/entity_management/AggregateID.cpp @@ -0,0 +1,81 @@ +#include "dis6/AggregateID.h" + +using namespace DIS; + +AggregateID::AggregateID() : _site(0), _application(0), _aggregateID(0) {} + +AggregateID::~AggregateID() {} + +uint16_t AggregateID::getSite() const { return _site; } + +void AggregateID::setSite(uint16_t pX) { _site = pX; } + +uint16_t AggregateID::getApplication() const { return _application; } + +void AggregateID::setApplication(uint16_t pX) { _application = pX; } + +uint16_t AggregateID::getAggregateID() const { return _aggregateID; } + +void AggregateID::setAggregateID(uint16_t pX) { _aggregateID = pX; } + +void AggregateID::marshal(DataStream& dataStream) const { + dataStream << _site; + dataStream << _application; + dataStream << _aggregateID; +} + +void AggregateID::unmarshal(DataStream& dataStream) { + dataStream >> _site; + dataStream >> _application; + dataStream >> _aggregateID; +} + +bool AggregateID::operator==(const AggregateID& rhs) const { + bool ivarsEqual = true; + + if (!(_site == rhs._site)) ivarsEqual = false; + if (!(_application == rhs._application)) ivarsEqual = false; + if (!(_aggregateID == rhs._aggregateID)) ivarsEqual = false; + + return ivarsEqual; +} + +int AggregateID::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _site + marshalSize = marshalSize + 2; // _application + marshalSize = marshalSize + 2; // _aggregateID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/AggregateID.h b/src/dis6/entity_management/AggregateID.h new file mode 100644 index 00000000..82bad0ea --- /dev/null +++ b/src/dis6/entity_management/AggregateID.h @@ -0,0 +1,78 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.36. Each agregate in a given simulation app is given an aggregate +// identifier number unique for all other aggregates in that app and in that +// exercise. The id is valid for the duration of the the exercise. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AggregateID { + protected: + /** The site ID */ + uint16_t _site; + + /** The application ID */ + uint16_t _application; + + /** the aggregate ID */ + uint16_t _aggregateID; + + public: + AggregateID(); + virtual ~AggregateID(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSite() const; + void setSite(uint16_t pX); + + uint16_t getApplication() const; + void setApplication(uint16_t pX); + + uint16_t getAggregateID() const; + void setAggregateID(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AggregateID& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/AggregateMarking.cpp b/src/dis6/entity_management/AggregateMarking.cpp new file mode 100644 index 00000000..cacf373b --- /dev/null +++ b/src/dis6/entity_management/AggregateMarking.cpp @@ -0,0 +1,95 @@ +#include "dis6/AggregateMarking.h" + +using namespace DIS; + +AggregateMarking::AggregateMarking() : _characterSet(0) { + // Initialize fixed length array + for (int lengthcharacters = 0; lengthcharacters < 31; lengthcharacters++) { + _characters[lengthcharacters] = 0; + } +} + +AggregateMarking::~AggregateMarking() {} + +uint8_t AggregateMarking::getCharacterSet() const { + return _characterSet; +} + +void AggregateMarking::setCharacterSet(uint8_t pX) { _characterSet = pX; } + +char* AggregateMarking::getCharacters() { return _characters; } + +const char* AggregateMarking::getCharacters() const { return _characters; } + +void AggregateMarking::setCharacters(const char* x) { + for (int i = 0; i < 31; i++) { + _characters[i] = x[i]; + } +} + +void AggregateMarking::marshal(DataStream& dataStream) const { + dataStream << _characterSet; + + for (size_t idx = 0; idx < 31; idx++) { + dataStream << _characters[idx]; + } +} + +void AggregateMarking::unmarshal(DataStream& dataStream) { + dataStream >> _characterSet; + + for (size_t idx = 0; idx < 31; idx++) { + dataStream >> _characters[idx]; + } +} + +bool AggregateMarking::operator==(const AggregateMarking& rhs) const { + bool ivarsEqual = true; + + if (!(_characterSet == rhs._characterSet)) ivarsEqual = false; + + for (uint8_t idx = 0; idx < 31; idx++) { + if (!(_characters[idx] == rhs._characters[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int AggregateMarking::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _characterSet + marshalSize = marshalSize + 31 * 1; // _characters + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/AggregateMarking.h b/src/dis6/entity_management/AggregateMarking.h new file mode 100644 index 00000000..43c1632c --- /dev/null +++ b/src/dis6/entity_management/AggregateMarking.h @@ -0,0 +1,72 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.37. Specifies the character set used inthe first byte, followed +// by up to 31 characters of text data. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AggregateMarking { + protected: + /** The character set */ + uint8_t _characterSet; + + /** The characters */ + char _characters[31]; + + public: + AggregateMarking(); + virtual ~AggregateMarking(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getCharacterSet() const; + void setCharacterSet(uint8_t pX); + + char* getCharacters(); + const char* getCharacters() const; + void setCharacters(const char* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AggregateMarking& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/AggregateStatePdu.cpp b/src/dis6/entity_management/AggregateStatePdu.cpp new file mode 100644 index 00000000..56748a76 --- /dev/null +++ b/src/dis6/entity_management/AggregateStatePdu.cpp @@ -0,0 +1,443 @@ +#include "dis6/AggregateStatePdu.h" + +using namespace DIS; + +AggregateStatePdu::AggregateStatePdu() + : EntityManagementFamilyPdu(), + _aggregateID(), + _forceID(0), + _aggregateState(0), + _aggregateType(), + _formation(0), + _aggregateMarking(), + _dimensions(), + _orientation(), + _centerOfMass(), + _velocity(), + _numberOfDisAggregates(0), + _numberOfDisEntities(0), + _numberOfSilentAggregateTypes(0), + _numberOfSilentEntityTypes(0), + _pad2(0), + _numberOfVariableDatumRecords(0) { + setPduType(33); +} + +AggregateStatePdu::~AggregateStatePdu() { + _aggregateIDList.clear(); + _entityIDList.clear(); + _silentAggregateSystemList.clear(); + _silentEntitySystemList.clear(); + _variableDatumList.clear(); +} + +EntityID& AggregateStatePdu::getAggregateID() { return _aggregateID; } + +const EntityID& AggregateStatePdu::getAggregateID() const { + return _aggregateID; +} + +void AggregateStatePdu::setAggregateID(const EntityID& pX) { + _aggregateID = pX; +} + +uint8_t AggregateStatePdu::getForceID() const { return _forceID; } + +void AggregateStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t AggregateStatePdu::getAggregateState() const { + return _aggregateState; +} + +void AggregateStatePdu::setAggregateState(uint8_t pX) { + _aggregateState = pX; +} + +EntityType& AggregateStatePdu::getAggregateType() { return _aggregateType; } + +const EntityType& AggregateStatePdu::getAggregateType() const { + return _aggregateType; +} + +void AggregateStatePdu::setAggregateType(const EntityType& pX) { + _aggregateType = pX; +} + +uint32_t AggregateStatePdu::getFormation() const { return _formation; } + +void AggregateStatePdu::setFormation(uint32_t pX) { _formation = pX; } + +AggregateMarking& AggregateStatePdu::getAggregateMarking() { + return _aggregateMarking; +} + +const AggregateMarking& AggregateStatePdu::getAggregateMarking() const { + return _aggregateMarking; +} + +void AggregateStatePdu::setAggregateMarking(const AggregateMarking& pX) { + _aggregateMarking = pX; +} + +Vector3Float& AggregateStatePdu::getDimensions() { return _dimensions; } + +const Vector3Float& AggregateStatePdu::getDimensions() const { + return _dimensions; +} + +void AggregateStatePdu::setDimensions(const Vector3Float& pX) { + _dimensions = pX; +} + +Orientation& AggregateStatePdu::getOrientation() { return _orientation; } + +const Orientation& AggregateStatePdu::getOrientation() const { + return _orientation; +} + +void AggregateStatePdu::setOrientation(const Orientation& pX) { + _orientation = pX; +} + +Vector3Double& AggregateStatePdu::getCenterOfMass() { return _centerOfMass; } + +const Vector3Double& AggregateStatePdu::getCenterOfMass() const { + return _centerOfMass; +} + +void AggregateStatePdu::setCenterOfMass(const Vector3Double& pX) { + _centerOfMass = pX; +} + +Vector3Float& AggregateStatePdu::getVelocity() { return _velocity; } + +const Vector3Float& AggregateStatePdu::getVelocity() const { return _velocity; } + +void AggregateStatePdu::setVelocity(const Vector3Float& pX) { _velocity = pX; } + +uint16_t AggregateStatePdu::getNumberOfDisAggregates() const { + return _aggregateIDList.size(); +} + +uint16_t AggregateStatePdu::getNumberOfDisEntities() const { + return _entityIDList.size(); +} + +uint16_t AggregateStatePdu::getNumberOfSilentAggregateTypes() const { + return _silentAggregateSystemList.size(); +} + +uint16_t AggregateStatePdu::getNumberOfSilentEntityTypes() const { + return _silentEntitySystemList.size(); +} + +std::vector& AggregateStatePdu::getAggregateIDList() { + return _aggregateIDList; +} + +const std::vector& AggregateStatePdu::getAggregateIDList() const { + return _aggregateIDList; +} + +void AggregateStatePdu::setAggregateIDList(const std::vector& pX) { + _aggregateIDList = pX; +} + +std::vector& AggregateStatePdu::getEntityIDList() { + return _entityIDList; +} + +const std::vector& AggregateStatePdu::getEntityIDList() const { + return _entityIDList; +} + +void AggregateStatePdu::setEntityIDList(const std::vector& pX) { + _entityIDList = pX; +} + +uint8_t AggregateStatePdu::getPad2() const { return _pad2; } + +void AggregateStatePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +std::vector& AggregateStatePdu::getSilentAggregateSystemList() { + return _silentAggregateSystemList; +} + +const std::vector& AggregateStatePdu::getSilentAggregateSystemList() + const { + return _silentAggregateSystemList; +} + +void AggregateStatePdu::setSilentAggregateSystemList( + const std::vector& pX) { + _silentAggregateSystemList = pX; +} + +std::vector& AggregateStatePdu::getSilentEntitySystemList() { + return _silentEntitySystemList; +} + +const std::vector& AggregateStatePdu::getSilentEntitySystemList() + const { + return _silentEntitySystemList; +} + +void AggregateStatePdu::setSilentEntitySystemList( + const std::vector& pX) { + _silentEntitySystemList = pX; +} + +uint32_t AggregateStatePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumList.size(); +} + +std::vector& AggregateStatePdu::getVariableDatumList() { + return _variableDatumList; +} + +const std::vector& AggregateStatePdu::getVariableDatumList() + const { + return _variableDatumList; +} + +void AggregateStatePdu::setVariableDatumList( + const std::vector& pX) { + _variableDatumList = pX; +} + +void AggregateStatePdu::marshal(DataStream& dataStream) const { + EntityManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _aggregateID.marshal(dataStream); + dataStream << _forceID; + dataStream << _aggregateState; + _aggregateType.marshal(dataStream); + dataStream << _formation; + _aggregateMarking.marshal(dataStream); + _dimensions.marshal(dataStream); + _orientation.marshal(dataStream); + _centerOfMass.marshal(dataStream); + _velocity.marshal(dataStream); + dataStream << (uint16_t)_aggregateIDList.size(); + dataStream << (uint16_t)_entityIDList.size(); + dataStream << (uint16_t)_silentAggregateSystemList.size(); + dataStream << (uint16_t)_silentEntitySystemList.size(); + + for (size_t idx = 0; idx < _aggregateIDList.size(); idx++) { + AggregateID x = _aggregateIDList[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _entityIDList.size(); idx++) { + EntityID x = _entityIDList[idx]; + x.marshal(dataStream); + } + + dataStream << _pad2; + + for (size_t idx = 0; idx < _silentAggregateSystemList.size(); idx++) { + EntityType x = _silentAggregateSystemList[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _silentEntitySystemList.size(); idx++) { + EntityType x = _silentEntitySystemList[idx]; + x.marshal(dataStream); + } + + dataStream << (uint32_t)_variableDatumList.size(); + + for (size_t idx = 0; idx < _variableDatumList.size(); idx++) { + VariableDatum x = _variableDatumList[idx]; + x.marshal(dataStream); + } +} + +void AggregateStatePdu::unmarshal(DataStream& dataStream) { + EntityManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _aggregateID.unmarshal(dataStream); + dataStream >> _forceID; + dataStream >> _aggregateState; + _aggregateType.unmarshal(dataStream); + dataStream >> _formation; + _aggregateMarking.unmarshal(dataStream); + _dimensions.unmarshal(dataStream); + _orientation.unmarshal(dataStream); + _centerOfMass.unmarshal(dataStream); + _velocity.unmarshal(dataStream); + dataStream >> _numberOfDisAggregates; + dataStream >> _numberOfDisEntities; + dataStream >> _numberOfSilentAggregateTypes; + dataStream >> _numberOfSilentEntityTypes; + + _aggregateIDList.clear(); + for (size_t idx = 0; idx < _numberOfDisAggregates; idx++) { + AggregateID x; + x.unmarshal(dataStream); + _aggregateIDList.push_back(x); + } + + _entityIDList.clear(); + for (size_t idx = 0; idx < _numberOfDisEntities; idx++) { + EntityID x; + x.unmarshal(dataStream); + _entityIDList.push_back(x); + } + dataStream >> _pad2; + + _silentAggregateSystemList.clear(); + for (size_t idx = 0; idx < _numberOfSilentAggregateTypes; idx++) { + EntityType x; + x.unmarshal(dataStream); + _silentAggregateSystemList.push_back(x); + } + + _silentEntitySystemList.clear(); + for (size_t idx = 0; idx < _numberOfSilentEntityTypes; idx++) { + EntityType x; + x.unmarshal(dataStream); + _silentEntitySystemList.push_back(x); + } + dataStream >> _numberOfVariableDatumRecords; + + _variableDatumList.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumList.push_back(x); + } +} + +bool AggregateStatePdu::operator==(const AggregateStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); + + if (!(_aggregateID == rhs._aggregateID)) ivarsEqual = false; + if (!(_forceID == rhs._forceID)) ivarsEqual = false; + if (!(_aggregateState == rhs._aggregateState)) ivarsEqual = false; + if (!(_aggregateType == rhs._aggregateType)) ivarsEqual = false; + if (!(_formation == rhs._formation)) ivarsEqual = false; + if (!(_aggregateMarking == rhs._aggregateMarking)) ivarsEqual = false; + if (!(_dimensions == rhs._dimensions)) ivarsEqual = false; + if (!(_orientation == rhs._orientation)) ivarsEqual = false; + if (!(_centerOfMass == rhs._centerOfMass)) ivarsEqual = false; + if (!(_velocity == rhs._velocity)) ivarsEqual = false; + + for (size_t idx = 0; idx < _aggregateIDList.size(); idx++) { + if (!(_aggregateIDList[idx] == rhs._aggregateIDList[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _entityIDList.size(); idx++) { + if (!(_entityIDList[idx] == rhs._entityIDList[idx])) ivarsEqual = false; + } + + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _silentAggregateSystemList.size(); idx++) { + if (!(_silentAggregateSystemList[idx] == + rhs._silentAggregateSystemList[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _silentEntitySystemList.size(); idx++) { + if (!(_silentEntitySystemList[idx] == rhs._silentEntitySystemList[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumList.size(); idx++) { + if (!(_variableDatumList[idx] == rhs._variableDatumList[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int AggregateStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _aggregateID.getMarshalledSize(); // _aggregateID + marshalSize = marshalSize + 1; // _forceID + marshalSize = marshalSize + 1; // _aggregateState + marshalSize = + marshalSize + _aggregateType.getMarshalledSize(); // _aggregateType + marshalSize = marshalSize + 4; // _formation + marshalSize = + marshalSize + _aggregateMarking.getMarshalledSize(); // _aggregateMarking + marshalSize = marshalSize + _dimensions.getMarshalledSize(); // _dimensions + marshalSize = marshalSize + _orientation.getMarshalledSize(); // _orientation + marshalSize = + marshalSize + _centerOfMass.getMarshalledSize(); // _centerOfMass + marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity + marshalSize = marshalSize + 2; // _numberOfDisAggregates + marshalSize = marshalSize + 2; // _numberOfDisEntities + marshalSize = marshalSize + 2; // _numberOfSilentAggregateTypes + marshalSize = marshalSize + 2; // _numberOfSilentEntityTypes + + for (uint64_t idx = 0; idx < _aggregateIDList.size(); idx++) { + AggregateID listElement = _aggregateIDList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _entityIDList.size(); idx++) { + EntityID listElement = _entityIDList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + marshalSize = marshalSize + 1; // _pad2 + + for (uint64_t idx = 0; idx < _silentAggregateSystemList.size(); + idx++) { + EntityType listElement = _silentAggregateSystemList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _silentEntitySystemList.size(); + idx++) { + EntityType listElement = _silentEntitySystemList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _variableDatumList.size(); idx++) { + VariableDatum listElement = _variableDatumList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/AggregateStatePdu.h b/src/dis6/entity_management/AggregateStatePdu.h new file mode 100644 index 00000000..d702dc3b --- /dev/null +++ b/src/dis6/entity_management/AggregateStatePdu.h @@ -0,0 +1,208 @@ +#pragma once + +#include + +#include "dis6/AggregateID.h" +#include "dis6/AggregateMarking.h" +#include "dis6/EntityID.h" +#include "dis6/EntityManagementFamilyPdu.h" +#include "dis6/EntityType.h" +#include "dis6/Orientation.h" +#include "dis6/VariableDatum.h" +#include "dis6/Vector3Double.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.9.1 informationa bout aggregating entities anc communicating +// information about the aggregated entities. requires manual +// intervention to fix the padding between entityID lists and silent aggregate +// sysem lists--this padding is dependent on how many entityIDs there +// are, and needs to be on a 32 bit word boundary. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AggregateStatePdu : public EntityManagementFamilyPdu { + protected: + /** ID of aggregated entities */ + EntityID _aggregateID; + + /** force ID */ + uint8_t _forceID; + + /** state of aggregate */ + uint8_t _aggregateState; + + /** entity type of the aggregated entities */ + EntityType _aggregateType; + + /** formation of aggregated entities */ + uint32_t _formation; + + /** marking for aggregate; first char is charset type, rest is char data */ + AggregateMarking _aggregateMarking; + + /** dimensions of bounding box for the aggregated entities, origin at the + * center of mass */ + Vector3Float _dimensions; + + /** orientation of the bounding box */ + Orientation _orientation; + + /** center of mass of the aggregation */ + Vector3Double _centerOfMass; + + /** velocity of aggregation */ + Vector3Float _velocity; + + /** number of aggregates */ + uint16_t _numberOfDisAggregates; + + /** number of entities */ + uint16_t _numberOfDisEntities; + + /** number of silent aggregate types */ + uint16_t _numberOfSilentAggregateTypes; + + /** number of silent entity types */ + uint16_t _numberOfSilentEntityTypes; + + /** aggregates list */ + std::vector _aggregateIDList; + + /** entity ID list */ + std::vector _entityIDList; + + /** ^^^padding to put the start of the next list on a 32 bit boundary. This + * needs to be fixed */ + uint8_t _pad2; + + /** silent entity types */ + std::vector _silentAggregateSystemList; + + /** silent entity types */ + std::vector _silentEntitySystemList; + + /** number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variableDatums */ + std::vector _variableDatumList; + + public: + AggregateStatePdu(); + virtual ~AggregateStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getAggregateID(); + const EntityID& getAggregateID() const; + void setAggregateID(const EntityID& pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getAggregateState() const; + void setAggregateState(uint8_t pX); + + EntityType& getAggregateType(); + const EntityType& getAggregateType() const; + void setAggregateType(const EntityType& pX); + + uint32_t getFormation() const; + void setFormation(uint32_t pX); + + AggregateMarking& getAggregateMarking(); + const AggregateMarking& getAggregateMarking() const; + void setAggregateMarking(const AggregateMarking& pX); + + Vector3Float& getDimensions(); + const Vector3Float& getDimensions() const; + void setDimensions(const Vector3Float& pX); + + Orientation& getOrientation(); + const Orientation& getOrientation() const; + void setOrientation(const Orientation& pX); + + Vector3Double& getCenterOfMass(); + const Vector3Double& getCenterOfMass() const; + void setCenterOfMass(const Vector3Double& pX); + + Vector3Float& getVelocity(); + const Vector3Float& getVelocity() const; + void setVelocity(const Vector3Float& pX); + + uint16_t getNumberOfDisAggregates() const; + + uint16_t getNumberOfDisEntities() const; + + uint16_t getNumberOfSilentAggregateTypes() const; + + uint16_t getNumberOfSilentEntityTypes() const; + + std::vector& getAggregateIDList(); + const std::vector& getAggregateIDList() const; + void setAggregateIDList(const std::vector& pX); + + std::vector& getEntityIDList(); + const std::vector& getEntityIDList() const; + void setEntityIDList(const std::vector& pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + std::vector& getSilentAggregateSystemList(); + const std::vector& getSilentAggregateSystemList() const; + void setSilentAggregateSystemList(const std::vector& pX); + + std::vector& getSilentEntitySystemList(); + const std::vector& getSilentEntitySystemList() const; + void setSilentEntitySystemList(const std::vector& pX); + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getVariableDatumList(); + const std::vector& getVariableDatumList() const; + void setVariableDatumList(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AggregateStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/AggregateType.cpp b/src/dis6/entity_management/AggregateType.cpp new file mode 100644 index 00000000..1ba16a34 --- /dev/null +++ b/src/dis6/entity_management/AggregateType.cpp @@ -0,0 +1,120 @@ +#include "dis6/AggregateType.h" + +using namespace DIS; + +AggregateType::AggregateType() + : _aggregateKind(0), + _domain(0), + _country(0), + _category(0), + _subcategory(0), + _specific(0), + _extra(0) {} + +AggregateType::~AggregateType() {} + +uint8_t AggregateType::getAggregateKind() const { return _aggregateKind; } + +void AggregateType::setAggregateKind(uint8_t pX) { _aggregateKind = pX; } + +uint8_t AggregateType::getDomain() const { return _domain; } + +void AggregateType::setDomain(uint8_t pX) { _domain = pX; } + +uint16_t AggregateType::getCountry() const { return _country; } + +void AggregateType::setCountry(uint16_t pX) { _country = pX; } + +uint8_t AggregateType::getCategory() const { return _category; } + +void AggregateType::setCategory(uint8_t pX) { _category = pX; } + +uint8_t AggregateType::getSubcategory() const { return _subcategory; } + +void AggregateType::setSubcategory(uint8_t pX) { _subcategory = pX; } + +uint8_t AggregateType::getSpecific() const { return _specific; } + +void AggregateType::setSpecific(uint8_t pX) { _specific = pX; } + +uint8_t AggregateType::getExtra() const { return _extra; } + +void AggregateType::setExtra(uint8_t pX) { _extra = pX; } + +void AggregateType::marshal(DataStream& dataStream) const { + dataStream << _aggregateKind; + dataStream << _domain; + dataStream << _country; + dataStream << _category; + dataStream << _subcategory; + dataStream << _specific; + dataStream << _extra; +} + +void AggregateType::unmarshal(DataStream& dataStream) { + dataStream >> _aggregateKind; + dataStream >> _domain; + dataStream >> _country; + dataStream >> _category; + dataStream >> _subcategory; + dataStream >> _specific; + dataStream >> _extra; +} + +bool AggregateType::operator==(const AggregateType& rhs) const { + bool ivarsEqual = true; + + if (!(_aggregateKind == rhs._aggregateKind)) ivarsEqual = false; + if (!(_domain == rhs._domain)) ivarsEqual = false; + if (!(_country == rhs._country)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_subcategory == rhs._subcategory)) ivarsEqual = false; + if (!(_specific == rhs._specific)) ivarsEqual = false; + if (!(_extra == rhs._extra)) ivarsEqual = false; + + return ivarsEqual; +} + +int AggregateType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _aggregateKind + marshalSize = marshalSize + 1; // _domain + marshalSize = marshalSize + 2; // _country + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _subcategory + marshalSize = marshalSize + 1; // _specific + marshalSize = marshalSize + 1; // _extra + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/AggregateType.h b/src/dis6/entity_management/AggregateType.h new file mode 100644 index 00000000..7aa00f3a --- /dev/null +++ b/src/dis6/entity_management/AggregateType.h @@ -0,0 +1,100 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.38. Identifies the type of aggregate including kind of entity, +// domain (surface, subsurface, air, etc) country, category, etc. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AggregateType { + protected: + /** Kind of entity */ + uint8_t _aggregateKind; + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _domain; + + /** country to which the design of the entity is attributed */ + uint16_t _country; + + /** category of entity */ + uint8_t _category; + + /** subcategory of entity */ + uint8_t _subcategory; + + /** specific info based on subcategory field */ + uint8_t _specific; + + uint8_t _extra; + + public: + AggregateType(); + virtual ~AggregateType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getAggregateKind() const; + void setAggregateKind(uint8_t pX); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint16_t getCountry() const; + void setCountry(uint16_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + uint8_t getSpecific() const; + void setSpecific(uint8_t pX); + + uint8_t getExtra() const; + void setExtra(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AggregateType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/CMakeLists.txt b/src/dis6/entity_management/CMakeLists.txt new file mode 100644 index 00000000..49955cf3 --- /dev/null +++ b/src/dis6/entity_management/CMakeLists.txt @@ -0,0 +1,39 @@ +set(entity_management_hdr + AggregateID.cpp + AggregateMarking.cpp + AggregateStatePdu.cpp + AggregateType.cpp + EntityManagementFamilyPdu.cpp + IsGroupOfPdu.cpp + IsPartOfPdu.cpp + Marking.cpp + NamedLocation.cpp + Relationship.cpp + TransferControlRequestPdu.cpp +) + +set(entity_management_src + AggregateID.h + AggregateMarking.h + AggregateStatePdu.h + AggregateType.h + EntityManagementFamilyPdu.h + IsGroupOfPdu.h + IsPartOfPdu.h + Marking.h + NamedLocation.h + Relationship.h + TransferControlRequestPdu.h +) + +list(TRANSFORM entity_management_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND entity_management_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${entity_management_src}) + +install(FILES ${entity_management_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/entity_management +) diff --git a/src/dis6/entity_management/EntityManagementFamilyPdu.cpp b/src/dis6/entity_management/EntityManagementFamilyPdu.cpp new file mode 100644 index 00000000..1b26991d --- /dev/null +++ b/src/dis6/entity_management/EntityManagementFamilyPdu.cpp @@ -0,0 +1,67 @@ +#include "dis6/EntityManagementFamilyPdu.h" + +using namespace DIS; + +EntityManagementFamilyPdu::EntityManagementFamilyPdu() + : Pdu() + +{ + setProtocolFamily(7); +} + +EntityManagementFamilyPdu::~EntityManagementFamilyPdu() {} + +void EntityManagementFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void EntityManagementFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool EntityManagementFamilyPdu::operator==( + const EntityManagementFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int EntityManagementFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/EntityManagementFamilyPdu.h b/src/dis6/entity_management/EntityManagementFamilyPdu.h new file mode 100644 index 00000000..757bd60b --- /dev/null +++ b/src/dis6/entity_management/EntityManagementFamilyPdu.h @@ -0,0 +1,60 @@ +#pragma once + +#include "dis6/Pdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.9. Common superclass for EntityManagment PDUs, including +// aggregate state, isGroupOf, TransferControLRequest, and isPartOf + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EntityManagementFamilyPdu : public Pdu { + protected: + public: + EntityManagementFamilyPdu(); + virtual ~EntityManagementFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityManagementFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/IsGroupOfPdu.cpp b/src/dis6/entity_management/IsGroupOfPdu.cpp new file mode 100644 index 00000000..106f8d58 --- /dev/null +++ b/src/dis6/entity_management/IsGroupOfPdu.cpp @@ -0,0 +1,169 @@ +#include "dis6/IsGroupOfPdu.h" + +using namespace DIS; + +IsGroupOfPdu::IsGroupOfPdu() + : EntityManagementFamilyPdu(), + _groupEntityID(), + _groupedEntityCategory(0), + _numberOfGroupedEntities(0), + _pad2(0), + _latitude(0.0), + _longitude(0.0) { + setPduType(34); +} + +IsGroupOfPdu::~IsGroupOfPdu() { _groupedEntityDescriptions.clear(); } + +EntityID& IsGroupOfPdu::getGroupEntityID() { return _groupEntityID; } + +const EntityID& IsGroupOfPdu::getGroupEntityID() const { + return _groupEntityID; +} + +void IsGroupOfPdu::setGroupEntityID(const EntityID& pX) { _groupEntityID = pX; } + +uint8_t IsGroupOfPdu::getGroupedEntityCategory() const { + return _groupedEntityCategory; +} + +void IsGroupOfPdu::setGroupedEntityCategory(uint8_t pX) { + _groupedEntityCategory = pX; +} + +uint8_t IsGroupOfPdu::getNumberOfGroupedEntities() const { + return _groupedEntityDescriptions.size(); +} + +uint32_t IsGroupOfPdu::getPad2() const { return _pad2; } + +void IsGroupOfPdu::setPad2(uint32_t pX) { _pad2 = pX; } + +double IsGroupOfPdu::getLatitude() const { return _latitude; } + +void IsGroupOfPdu::setLatitude(double pX) { _latitude = pX; } + +double IsGroupOfPdu::getLongitude() const { return _longitude; } + +void IsGroupOfPdu::setLongitude(double pX) { _longitude = pX; } + +std::vector& IsGroupOfPdu::getGroupedEntityDescriptions() { + return _groupedEntityDescriptions; +} + +const std::vector& IsGroupOfPdu::getGroupedEntityDescriptions() + const { + return _groupedEntityDescriptions; +} + +void IsGroupOfPdu::setGroupedEntityDescriptions( + const std::vector& pX) { + _groupedEntityDescriptions = pX; +} + +void IsGroupOfPdu::marshal(DataStream& dataStream) const { + EntityManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _groupEntityID.marshal(dataStream); + dataStream << _groupedEntityCategory; + dataStream << (uint8_t)_groupedEntityDescriptions.size(); + dataStream << _pad2; + dataStream << _latitude; + dataStream << _longitude; + + for (size_t idx = 0; idx < _groupedEntityDescriptions.size(); idx++) { + VariableDatum x = _groupedEntityDescriptions[idx]; + x.marshal(dataStream); + } +} + +void IsGroupOfPdu::unmarshal(DataStream& dataStream) { + EntityManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _groupEntityID.unmarshal(dataStream); + dataStream >> _groupedEntityCategory; + dataStream >> _numberOfGroupedEntities; + dataStream >> _pad2; + dataStream >> _latitude; + dataStream >> _longitude; + + _groupedEntityDescriptions.clear(); + for (size_t idx = 0; idx < _numberOfGroupedEntities; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _groupedEntityDescriptions.push_back(x); + } +} + +bool IsGroupOfPdu::operator==(const IsGroupOfPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); + + if (!(_groupEntityID == rhs._groupEntityID)) ivarsEqual = false; + if (!(_groupedEntityCategory == rhs._groupedEntityCategory)) + ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_latitude == rhs._latitude)) ivarsEqual = false; + if (!(_longitude == rhs._longitude)) ivarsEqual = false; + + for (size_t idx = 0; idx < _groupedEntityDescriptions.size(); idx++) { + if (!(_groupedEntityDescriptions[idx] == + rhs._groupedEntityDescriptions[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int IsGroupOfPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _groupEntityID.getMarshalledSize(); // _groupEntityID + marshalSize = marshalSize + 1; // _groupedEntityCategory + marshalSize = marshalSize + 1; // _numberOfGroupedEntities + marshalSize = marshalSize + 4; // _pad2 + marshalSize = marshalSize + 8; // _latitude + marshalSize = marshalSize + 8; // _longitude + + for (uint64_t idx = 0; idx < _groupedEntityDescriptions.size(); + idx++) { + VariableDatum listElement = _groupedEntityDescriptions[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/IsGroupOfPdu.h b/src/dis6/entity_management/IsGroupOfPdu.h new file mode 100644 index 00000000..4e5d1488 --- /dev/null +++ b/src/dis6/entity_management/IsGroupOfPdu.h @@ -0,0 +1,111 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/EntityManagementFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.9.2 Information about a particular group of entities grouped +// together for the purposes of netowrk bandwidth reduction or +// aggregation. Needs manual cleanup. The GED size requires a database lookup. +// UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class IsGroupOfPdu : public EntityManagementFamilyPdu { + protected: + /** ID of aggregated entities */ + EntityID _groupEntityID; + + /** type of entities constituting the group */ + uint8_t _groupedEntityCategory; + + /** Number of individual entities constituting the group */ + uint8_t _numberOfGroupedEntities; + + /** padding */ + uint32_t _pad2; + + /** latitude */ + double _latitude; + + /** longitude */ + double _longitude; + + /** GED records about each individual entity in the group. ^^^this is + * wrong--need a database lookup to find the actual size of the list elements + */ + std::vector _groupedEntityDescriptions; + + public: + IsGroupOfPdu(); + virtual ~IsGroupOfPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getGroupEntityID(); + const EntityID& getGroupEntityID() const; + void setGroupEntityID(const EntityID& pX); + + uint8_t getGroupedEntityCategory() const; + void setGroupedEntityCategory(uint8_t pX); + + uint8_t getNumberOfGroupedEntities() const; + + uint32_t getPad2() const; + void setPad2(uint32_t pX); + + double getLatitude() const; + void setLatitude(double pX); + + double getLongitude() const; + void setLongitude(double pX); + + std::vector& getGroupedEntityDescriptions(); + const std::vector& getGroupedEntityDescriptions() const; + void setGroupedEntityDescriptions(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IsGroupOfPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/IsPartOfPdu.cpp b/src/dis6/entity_management/IsPartOfPdu.cpp new file mode 100644 index 00000000..58192371 --- /dev/null +++ b/src/dis6/entity_management/IsPartOfPdu.cpp @@ -0,0 +1,163 @@ +#include "dis6/IsPartOfPdu.h" + +using namespace DIS; + +IsPartOfPdu::IsPartOfPdu() + : EntityManagementFamilyPdu(), + _orginatingEntityID(), + _receivingEntityID(), + _relationship(), + _partLocation(), + _namedLocationID(), + _partEntityType() { + setPduType(36); +} + +IsPartOfPdu::~IsPartOfPdu() {} + +EntityID& IsPartOfPdu::getOrginatingEntityID() { return _orginatingEntityID; } + +const EntityID& IsPartOfPdu::getOrginatingEntityID() const { + return _orginatingEntityID; +} + +void IsPartOfPdu::setOrginatingEntityID(const EntityID& pX) { + _orginatingEntityID = pX; +} + +EntityID& IsPartOfPdu::getReceivingEntityID() { return _receivingEntityID; } + +const EntityID& IsPartOfPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void IsPartOfPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +Relationship& IsPartOfPdu::getRelationship() { return _relationship; } + +const Relationship& IsPartOfPdu::getRelationship() const { + return _relationship; +} + +void IsPartOfPdu::setRelationship(const Relationship& pX) { + _relationship = pX; +} + +Vector3Float& IsPartOfPdu::getPartLocation() { return _partLocation; } + +const Vector3Float& IsPartOfPdu::getPartLocation() const { + return _partLocation; +} + +void IsPartOfPdu::setPartLocation(const Vector3Float& pX) { + _partLocation = pX; +} + +NamedLocation& IsPartOfPdu::getNamedLocationID() { return _namedLocationID; } + +const NamedLocation& IsPartOfPdu::getNamedLocationID() const { + return _namedLocationID; +} + +void IsPartOfPdu::setNamedLocationID(const NamedLocation& pX) { + _namedLocationID = pX; +} + +EntityType& IsPartOfPdu::getPartEntityType() { return _partEntityType; } + +const EntityType& IsPartOfPdu::getPartEntityType() const { + return _partEntityType; +} + +void IsPartOfPdu::setPartEntityType(const EntityType& pX) { + _partEntityType = pX; +} + +void IsPartOfPdu::marshal(DataStream& dataStream) const { + EntityManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _orginatingEntityID.marshal(dataStream); + _receivingEntityID.marshal(dataStream); + _relationship.marshal(dataStream); + _partLocation.marshal(dataStream); + _namedLocationID.marshal(dataStream); + _partEntityType.marshal(dataStream); +} + +void IsPartOfPdu::unmarshal(DataStream& dataStream) { + EntityManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _orginatingEntityID.unmarshal(dataStream); + _receivingEntityID.unmarshal(dataStream); + _relationship.unmarshal(dataStream); + _partLocation.unmarshal(dataStream); + _namedLocationID.unmarshal(dataStream); + _partEntityType.unmarshal(dataStream); +} + +bool IsPartOfPdu::operator==(const IsPartOfPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); + + if (!(_orginatingEntityID == rhs._orginatingEntityID)) ivarsEqual = false; + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_relationship == rhs._relationship)) ivarsEqual = false; + if (!(_partLocation == rhs._partLocation)) ivarsEqual = false; + if (!(_namedLocationID == rhs._namedLocationID)) ivarsEqual = false; + if (!(_partEntityType == rhs._partEntityType)) ivarsEqual = false; + + return ivarsEqual; +} + +int IsPartOfPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = + marshalSize + _relationship.getMarshalledSize(); // _relationship + marshalSize = + marshalSize + _partLocation.getMarshalledSize(); // _partLocation + marshalSize = + marshalSize + _namedLocationID.getMarshalledSize(); // _namedLocationID + marshalSize = + marshalSize + _partEntityType.getMarshalledSize(); // _partEntityType + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/IsPartOfPdu.h b/src/dis6/entity_management/IsPartOfPdu.h new file mode 100644 index 00000000..17ec00b7 --- /dev/null +++ b/src/dis6/entity_management/IsPartOfPdu.h @@ -0,0 +1,108 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/EntityManagementFamilyPdu.h" +#include "dis6/EntityType.h" +#include "dis6/NamedLocation.h" +#include "dis6/Relationship.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.9.4 The joining of two or more simulation entities is +// communicated by this PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class IsPartOfPdu : public EntityManagementFamilyPdu { + protected: + /** ID of entity originating PDU */ + EntityID _orginatingEntityID; + + /** ID of entity receiving PDU */ + EntityID _receivingEntityID; + + /** relationship of joined parts */ + Relationship _relationship; + + /** location of part; centroid of part in host's coordinate system. x=range, + * y=bearing, z=0 */ + Vector3Float _partLocation; + + /** named location */ + NamedLocation _namedLocationID; + + /** entity type */ + EntityType _partEntityType; + + public: + IsPartOfPdu(); + virtual ~IsPartOfPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOrginatingEntityID(); + const EntityID& getOrginatingEntityID() const; + void setOrginatingEntityID(const EntityID& pX); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + Relationship& getRelationship(); + const Relationship& getRelationship() const; + void setRelationship(const Relationship& pX); + + Vector3Float& getPartLocation(); + const Vector3Float& getPartLocation() const; + void setPartLocation(const Vector3Float& pX); + + NamedLocation& getNamedLocationID(); + const NamedLocation& getNamedLocationID() const; + void setNamedLocationID(const NamedLocation& pX); + + EntityType& getPartEntityType(); + const EntityType& getPartEntityType() const; + void setPartEntityType(const EntityType& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IsPartOfPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/Marking.cpp b/src/dis6/entity_management/Marking.cpp new file mode 100644 index 00000000..dd47d293 --- /dev/null +++ b/src/dis6/entity_management/Marking.cpp @@ -0,0 +1,102 @@ +#include + +#include "dis6/Marking.h" + +using namespace DIS; + +Marking::Marking() : _characterSet(0) { + // Initialize fixed length array + for (int lengthcharacters = 0; lengthcharacters < 11; lengthcharacters++) { + _characters[lengthcharacters] = 0; + } +} + +Marking::~Marking() {} + +uint8_t Marking::getCharacterSet() const { return _characterSet; } + +void Marking::setCharacterSet(uint8_t pX) { _characterSet = pX; } + +char* Marking::getCharacters() { return _characters; } + +const char* Marking::getCharacters() const { return _characters; } + +void Marking::setCharacters(const char* x) { + for (int i = 0; i < 11; i++) { + _characters[i] = x[i]; + } +} + +// An alternate method to set the value if this could be a string. This is not +// strictly comnpliant with the DIS standard. +void Marking::setByStringCharacters(const char* x) { + std::strncpy(_characters, x, 11 - 1); + _characters[11 - 1] = '\0'; +} + +void Marking::marshal(DataStream& dataStream) const { + dataStream << _characterSet; + + for (size_t idx = 0; idx < 11; idx++) { + dataStream << _characters[idx]; + } +} + +void Marking::unmarshal(DataStream& dataStream) { + dataStream >> _characterSet; + + for (size_t idx = 0; idx < 11; idx++) { + dataStream >> _characters[idx]; + } +} + +bool Marking::operator==(const Marking& rhs) const { + bool ivarsEqual = true; + + if (!(_characterSet == rhs._characterSet)) ivarsEqual = false; + + for (uint8_t idx = 0; idx < 11; idx++) { + if (!(_characters[idx] == rhs._characters[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int Marking::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _characterSet + marshalSize = marshalSize + 11 * 1; // _characters + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/Marking.h b/src/dis6/entity_management/Marking.h new file mode 100644 index 00000000..f47cfd01 --- /dev/null +++ b/src/dis6/entity_management/Marking.h @@ -0,0 +1,73 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.15. Specifies the character set used inthe first byte, followed +// by 11 characters of text data. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class Marking { + protected: + /** The character set */ + uint8_t _characterSet; + + /** The characters */ + char _characters[11]; + + public: + Marking(); + virtual ~Marking(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getCharacterSet() const; + void setCharacterSet(uint8_t pX); + + char* getCharacters(); + const char* getCharacters() const; + void setCharacters(const char* pX); + void setByStringCharacters(const char* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Marking& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/NamedLocation.cpp b/src/dis6/entity_management/NamedLocation.cpp new file mode 100644 index 00000000..817948f7 --- /dev/null +++ b/src/dis6/entity_management/NamedLocation.cpp @@ -0,0 +1,75 @@ +#include "dis6/NamedLocation.h" + +using namespace DIS; + +NamedLocation::NamedLocation() : _stationName(0), _stationNumber(0) {} + +NamedLocation::~NamedLocation() {} + +uint16_t NamedLocation::getStationName() const { return _stationName; } + +void NamedLocation::setStationName(uint16_t pX) { _stationName = pX; } + +uint16_t NamedLocation::getStationNumber() const { + return _stationNumber; +} + +void NamedLocation::setStationNumber(uint16_t pX) { _stationNumber = pX; } + +void NamedLocation::marshal(DataStream& dataStream) const { + dataStream << _stationName; + dataStream << _stationNumber; +} + +void NamedLocation::unmarshal(DataStream& dataStream) { + dataStream >> _stationName; + dataStream >> _stationNumber; +} + +bool NamedLocation::operator==(const NamedLocation& rhs) const { + bool ivarsEqual = true; + + if (!(_stationName == rhs._stationName)) ivarsEqual = false; + if (!(_stationNumber == rhs._stationNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int NamedLocation::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _stationName + marshalSize = marshalSize + 2; // _stationNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/NamedLocation.h b/src/dis6/entity_management/NamedLocation.h new file mode 100644 index 00000000..805e7d1b --- /dev/null +++ b/src/dis6/entity_management/NamedLocation.h @@ -0,0 +1,70 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// discrete ostional relationsihip + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class NamedLocation { + protected: + /** station name enumeration */ + uint16_t _stationName; + + /** station number */ + uint16_t _stationNumber; + + public: + NamedLocation(); + virtual ~NamedLocation(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getStationName() const; + void setStationName(uint16_t pX); + + uint16_t getStationNumber() const; + void setStationNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const NamedLocation& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/Relationship.cpp b/src/dis6/entity_management/Relationship.cpp new file mode 100644 index 00000000..6cf46eb5 --- /dev/null +++ b/src/dis6/entity_management/Relationship.cpp @@ -0,0 +1,73 @@ +#include "dis6/Relationship.h" + +using namespace DIS; + +Relationship::Relationship() : _nature(0), _position(0) {} + +Relationship::~Relationship() {} + +uint16_t Relationship::getNature() const { return _nature; } + +void Relationship::setNature(uint16_t pX) { _nature = pX; } + +uint16_t Relationship::getPosition() const { return _position; } + +void Relationship::setPosition(uint16_t pX) { _position = pX; } + +void Relationship::marshal(DataStream& dataStream) const { + dataStream << _nature; + dataStream << _position; +} + +void Relationship::unmarshal(DataStream& dataStream) { + dataStream >> _nature; + dataStream >> _position; +} + +bool Relationship::operator==(const Relationship& rhs) const { + bool ivarsEqual = true; + + if (!(_nature == rhs._nature)) ivarsEqual = false; + if (!(_position == rhs._position)) ivarsEqual = false; + + return ivarsEqual; +} + +int Relationship::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _nature + marshalSize = marshalSize + 2; // _position + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/Relationship.h b/src/dis6/entity_management/Relationship.h new file mode 100644 index 00000000..3812b0bf --- /dev/null +++ b/src/dis6/entity_management/Relationship.h @@ -0,0 +1,70 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.2.56. Purpose for joinging two entities + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class Relationship { + protected: + /** Nature of join */ + uint16_t _nature; + + /** position of join */ + uint16_t _position; + + public: + Relationship(); + virtual ~Relationship(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getNature() const; + void setNature(uint16_t pX); + + uint16_t getPosition() const; + void setPosition(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Relationship& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/TransferControlRequestPdu.cpp b/src/dis6/entity_management/TransferControlRequestPdu.cpp new file mode 100644 index 00000000..5dd582af --- /dev/null +++ b/src/dis6/entity_management/TransferControlRequestPdu.cpp @@ -0,0 +1,206 @@ +#include "dis6/TransferControlRequestPdu.h" + +using namespace DIS; + +TransferControlRequestPdu::TransferControlRequestPdu() + : EntityManagementFamilyPdu(), + _orginatingEntityID(), + _recevingEntityID(), + _requestID(0), + _requiredReliabilityService(0), + _tranferType(0), + _transferEntityID(), + _numberOfRecordSets(0) { + setPduType(35); +} + +TransferControlRequestPdu::~TransferControlRequestPdu() { _recordSets.clear(); } + +EntityID& TransferControlRequestPdu::getOrginatingEntityID() { + return _orginatingEntityID; +} + +const EntityID& TransferControlRequestPdu::getOrginatingEntityID() const { + return _orginatingEntityID; +} + +void TransferControlRequestPdu::setOrginatingEntityID(const EntityID& pX) { + _orginatingEntityID = pX; +} + +EntityID& TransferControlRequestPdu::getRecevingEntityID() { + return _recevingEntityID; +} + +const EntityID& TransferControlRequestPdu::getRecevingEntityID() const { + return _recevingEntityID; +} + +void TransferControlRequestPdu::setRecevingEntityID(const EntityID& pX) { + _recevingEntityID = pX; +} + +uint32_t TransferControlRequestPdu::getRequestID() const { + return _requestID; +} + +void TransferControlRequestPdu::setRequestID(uint32_t pX) { + _requestID = pX; +} + +uint8_t TransferControlRequestPdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void TransferControlRequestPdu::setRequiredReliabilityService( + uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint8_t TransferControlRequestPdu::getTranferType() const { + return _tranferType; +} + +void TransferControlRequestPdu::setTranferType(uint8_t pX) { + _tranferType = pX; +} + +EntityID& TransferControlRequestPdu::getTransferEntityID() { + return _transferEntityID; +} + +const EntityID& TransferControlRequestPdu::getTransferEntityID() const { + return _transferEntityID; +} + +void TransferControlRequestPdu::setTransferEntityID(const EntityID& pX) { + _transferEntityID = pX; +} + +uint8_t TransferControlRequestPdu::getNumberOfRecordSets() const { + return _recordSets.size(); +} + +std::vector& TransferControlRequestPdu::getRecordSets() { + return _recordSets; +} + +const std::vector& TransferControlRequestPdu::getRecordSets() const { + return _recordSets; +} + +void TransferControlRequestPdu::setRecordSets( + const std::vector& pX) { + _recordSets = pX; +} + +void TransferControlRequestPdu::marshal(DataStream& dataStream) const { + EntityManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _orginatingEntityID.marshal(dataStream); + _recevingEntityID.marshal(dataStream); + dataStream << _requestID; + dataStream << _requiredReliabilityService; + dataStream << _tranferType; + _transferEntityID.marshal(dataStream); + dataStream << (uint8_t)_recordSets.size(); + + for (size_t idx = 0; idx < _recordSets.size(); idx++) { + RecordSet x = _recordSets[idx]; + x.marshal(dataStream); + } +} + +void TransferControlRequestPdu::unmarshal(DataStream& dataStream) { + EntityManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _orginatingEntityID.unmarshal(dataStream); + _recevingEntityID.unmarshal(dataStream); + dataStream >> _requestID; + dataStream >> _requiredReliabilityService; + dataStream >> _tranferType; + _transferEntityID.unmarshal(dataStream); + dataStream >> _numberOfRecordSets; + + _recordSets.clear(); + for (size_t idx = 0; idx < _numberOfRecordSets; idx++) { + RecordSet x; + x.unmarshal(dataStream); + _recordSets.push_back(x); + } +} + +bool TransferControlRequestPdu::operator==( + const TransferControlRequestPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); + + if (!(_orginatingEntityID == rhs._orginatingEntityID)) ivarsEqual = false; + if (!(_recevingEntityID == rhs._recevingEntityID)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_tranferType == rhs._tranferType)) ivarsEqual = false; + if (!(_transferEntityID == rhs._transferEntityID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _recordSets.size(); idx++) { + if (!(_recordSets[idx] == rhs._recordSets[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int TransferControlRequestPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID + marshalSize = + marshalSize + _recevingEntityID.getMarshalledSize(); // _recevingEntityID + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 1; // _tranferType + marshalSize = + marshalSize + _transferEntityID.getMarshalledSize(); // _transferEntityID + marshalSize = marshalSize + 1; // _numberOfRecordSets + + for (uint64_t idx = 0; idx < _recordSets.size(); idx++) { + RecordSet listElement = _recordSets[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/entity_management/TransferControlRequestPdu.h b/src/dis6/entity_management/TransferControlRequestPdu.h new file mode 100644 index 00000000..4a3264b2 --- /dev/null +++ b/src/dis6/entity_management/TransferControlRequestPdu.h @@ -0,0 +1,117 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/EntityManagementFamilyPdu.h" +#include "dis6/RecordSet.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.9.3 Information initiating the dyanic allocation and control of +// simulation entities between two simulation applications. Requires +// manual cleanup. The padding between record sets is variable. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class TransferControlRequestPdu + : public EntityManagementFamilyPdu { + protected: + /** ID of entity originating request */ + EntityID _orginatingEntityID; + + /** ID of entity receiving request */ + EntityID _recevingEntityID; + + /** ID ofrequest */ + uint32_t _requestID; + + /** required level of reliabliity service. */ + uint8_t _requiredReliabilityService; + + /** type of transfer desired */ + uint8_t _tranferType; + + /** The entity for which control is being requested to transfer */ + EntityID _transferEntityID; + + /** number of record sets to transfer */ + uint8_t _numberOfRecordSets; + + /** ^^^This is wrong--the RecordSet class needs more work */ + std::vector _recordSets; + + public: + TransferControlRequestPdu(); + virtual ~TransferControlRequestPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOrginatingEntityID(); + const EntityID& getOrginatingEntityID() const; + void setOrginatingEntityID(const EntityID& pX); + + EntityID& getRecevingEntityID(); + const EntityID& getRecevingEntityID() const; + void setRecevingEntityID(const EntityID& pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint8_t getTranferType() const; + void setTranferType(uint8_t pX); + + EntityID& getTransferEntityID(); + const EntityID& getTransferEntityID() const; + void setTransferEntityID(const EntityID& pX); + + uint8_t getNumberOfRecordSets() const; + + std::vector& getRecordSets(); + const std::vector& getRecordSets() const; + void setRecordSets(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const TransferControlRequestPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/CMakeLists.txt b/src/dis6/logistics/CMakeLists.txt new file mode 100644 index 00000000..e8afa19f --- /dev/null +++ b/src/dis6/logistics/CMakeLists.txt @@ -0,0 +1,33 @@ +set(logistics_hdr + LogisticsFamilyPdu.h + RepairCompletePdu.h + RepairResponsePdu.h + ResupplyCancelPdu.h + ResupplyOfferPdu.h + ResupplyReceivedPdu.h + ServiceRequestPdu.h + SupplyQuantity.h +) + +set(logistics_src + LogisticsFamilyPdu.cpp + RepairCompletePdu.cpp + RepairResponsePdu.cpp + ResupplyCancelPdu.cpp + ResupplyOfferPdu.cpp + ResupplyReceivedPdu.cpp + ServiceRequestPdu.cpp + SupplyQuantity.cpp +) + +list(TRANSFORM logistics_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND logistics_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${logistics_src}) + +install(FILES ${logistics_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/logistics +) diff --git a/src/dis6/logistics/LogisticsFamilyPdu.cpp b/src/dis6/logistics/LogisticsFamilyPdu.cpp new file mode 100644 index 00000000..66cce165 --- /dev/null +++ b/src/dis6/logistics/LogisticsFamilyPdu.cpp @@ -0,0 +1,66 @@ +#include "dis6/LogisticsFamilyPdu.h" + +using namespace DIS; + +LogisticsFamilyPdu::LogisticsFamilyPdu() + : Pdu() + +{ + setProtocolFamily(3); +} + +LogisticsFamilyPdu::~LogisticsFamilyPdu() {} + +void LogisticsFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void LogisticsFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool LogisticsFamilyPdu::operator==(const LogisticsFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int LogisticsFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/LogisticsFamilyPdu.h b/src/dis6/logistics/LogisticsFamilyPdu.h new file mode 100644 index 00000000..e64a7c22 --- /dev/null +++ b/src/dis6/logistics/LogisticsFamilyPdu.h @@ -0,0 +1,59 @@ +#pragma once + +#include "dis6/Pdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.5. Abstract superclass for logistics PDUs. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class LogisticsFamilyPdu : public Pdu { + protected: + public: + LogisticsFamilyPdu(); + virtual ~LogisticsFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const LogisticsFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/RepairCompletePdu.cpp b/src/dis6/logistics/RepairCompletePdu.cpp new file mode 100644 index 00000000..25dfd163 --- /dev/null +++ b/src/dis6/logistics/RepairCompletePdu.cpp @@ -0,0 +1,121 @@ +#include "dis6/RepairCompletePdu.h" + +using namespace DIS; + +RepairCompletePdu::RepairCompletePdu() + : LogisticsFamilyPdu(), + _receivingEntityID(), + _repairingEntityID(), + _repair(0), + _padding2(0) { + setPduType(9); +} + +RepairCompletePdu::~RepairCompletePdu() {} + +EntityID& RepairCompletePdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& RepairCompletePdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void RepairCompletePdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& RepairCompletePdu::getRepairingEntityID() { + return _repairingEntityID; +} + +const EntityID& RepairCompletePdu::getRepairingEntityID() const { + return _repairingEntityID; +} + +void RepairCompletePdu::setRepairingEntityID(const EntityID& pX) { + _repairingEntityID = pX; +} + +uint16_t RepairCompletePdu::getRepair() const { return _repair; } + +void RepairCompletePdu::setRepair(uint16_t pX) { _repair = pX; } + +int16_t RepairCompletePdu::getPadding2() const { return _padding2; } + +void RepairCompletePdu::setPadding2(int16_t pX) { _padding2 = pX; } + +void RepairCompletePdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _repairingEntityID.marshal(dataStream); + dataStream << _repair; + dataStream << _padding2; +} + +void RepairCompletePdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _repairingEntityID.unmarshal(dataStream); + dataStream >> _repair; + dataStream >> _padding2; +} + +bool RepairCompletePdu::operator==(const RepairCompletePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_repairingEntityID == rhs._repairingEntityID)) ivarsEqual = false; + if (!(_repair == rhs._repair)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + return ivarsEqual; +} + +int RepairCompletePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _repairingEntityID.getMarshalledSize(); // _repairingEntityID + marshalSize = marshalSize + 2; // _repair + marshalSize = marshalSize + 2; // _padding2 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/RepairCompletePdu.h b/src/dis6/logistics/RepairCompletePdu.h new file mode 100644 index 00000000..9ffb3850 --- /dev/null +++ b/src/dis6/logistics/RepairCompletePdu.h @@ -0,0 +1,86 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/LogisticsFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.5.5. Repair is complete. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class RepairCompletePdu : public LogisticsFamilyPdu { + protected: + /** Entity that is receiving service */ + EntityID _receivingEntityID; + + /** Entity that is supplying */ + EntityID _repairingEntityID; + + /** Enumeration for type of repair */ + uint16_t _repair; + + /** padding, number prevents conflict with superclass ivar name */ + int16_t _padding2; + + public: + RepairCompletePdu(); + virtual ~RepairCompletePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getRepairingEntityID(); + const EntityID& getRepairingEntityID() const; + void setRepairingEntityID(const EntityID& pX); + + uint16_t getRepair() const; + void setRepair(uint16_t pX); + + int16_t getPadding2() const; + void setPadding2(int16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RepairCompletePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/RepairResponsePdu.cpp b/src/dis6/logistics/RepairResponsePdu.cpp new file mode 100644 index 00000000..7c02741b --- /dev/null +++ b/src/dis6/logistics/RepairResponsePdu.cpp @@ -0,0 +1,134 @@ +#include "dis6/RepairResponsePdu.h" + +using namespace DIS; + +RepairResponsePdu::RepairResponsePdu() + : LogisticsFamilyPdu(), + _receivingEntityID(), + _repairingEntityID(), + _repairResult(0), + _padding1(0), + _padding2(0) { + setPduType(10); +} + +RepairResponsePdu::~RepairResponsePdu() {} + +EntityID& RepairResponsePdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& RepairResponsePdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void RepairResponsePdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& RepairResponsePdu::getRepairingEntityID() { + return _repairingEntityID; +} + +const EntityID& RepairResponsePdu::getRepairingEntityID() const { + return _repairingEntityID; +} + +void RepairResponsePdu::setRepairingEntityID(const EntityID& pX) { + _repairingEntityID = pX; +} + +uint8_t RepairResponsePdu::getRepairResult() const { + return _repairResult; +} + +void RepairResponsePdu::setRepairResult(uint8_t pX) { + _repairResult = pX; +} + +int16_t RepairResponsePdu::getPadding1() const { return _padding1; } + +void RepairResponsePdu::setPadding1(int16_t pX) { _padding1 = pX; } + +char RepairResponsePdu::getPadding2() const { return _padding2; } + +void RepairResponsePdu::setPadding2(char pX) { _padding2 = pX; } + +void RepairResponsePdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _repairingEntityID.marshal(dataStream); + dataStream << _repairResult; + dataStream << _padding1; + dataStream << _padding2; +} + +void RepairResponsePdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _repairingEntityID.unmarshal(dataStream); + dataStream >> _repairResult; + dataStream >> _padding1; + dataStream >> _padding2; +} + +bool RepairResponsePdu::operator==(const RepairResponsePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_repairingEntityID == rhs._repairingEntityID)) ivarsEqual = false; + if (!(_repairResult == rhs._repairResult)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + return ivarsEqual; +} + +int RepairResponsePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _repairingEntityID.getMarshalledSize(); // _repairingEntityID + marshalSize = marshalSize + 1; // _repairResult + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 1; // _padding2 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/RepairResponsePdu.h b/src/dis6/logistics/RepairResponsePdu.h new file mode 100644 index 00000000..39ff8a45 --- /dev/null +++ b/src/dis6/logistics/RepairResponsePdu.h @@ -0,0 +1,92 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/LogisticsFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.5.6. Sent after repair complete PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class RepairResponsePdu : public LogisticsFamilyPdu { + protected: + /** Entity that is receiving service */ + EntityID _receivingEntityID; + + /** Entity that is supplying */ + EntityID _repairingEntityID; + + /** Result of repair operation */ + uint8_t _repairResult; + + /** padding */ + int16_t _padding1; + + /** padding */ + char _padding2; + + public: + RepairResponsePdu(); + virtual ~RepairResponsePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getRepairingEntityID(); + const EntityID& getRepairingEntityID() const; + void setRepairingEntityID(const EntityID& pX); + + uint8_t getRepairResult() const; + void setRepairResult(uint8_t pX); + + int16_t getPadding1() const; + void setPadding1(int16_t pX); + + char getPadding2() const; + void setPadding2(char pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RepairResponsePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/ResupplyCancelPdu.cpp b/src/dis6/logistics/ResupplyCancelPdu.cpp new file mode 100644 index 00000000..5ac83482 --- /dev/null +++ b/src/dis6/logistics/ResupplyCancelPdu.cpp @@ -0,0 +1,101 @@ +#include "dis6/ResupplyCancelPdu.h" + +using namespace DIS; + +ResupplyCancelPdu::ResupplyCancelPdu() + : LogisticsFamilyPdu(), _receivingEntityID(), _supplyingEntityID() { + setPduType(8); +} + +ResupplyCancelPdu::~ResupplyCancelPdu() {} + +EntityID& ResupplyCancelPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& ResupplyCancelPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void ResupplyCancelPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& ResupplyCancelPdu::getSupplyingEntityID() { + return _supplyingEntityID; +} + +const EntityID& ResupplyCancelPdu::getSupplyingEntityID() const { + return _supplyingEntityID; +} + +void ResupplyCancelPdu::setSupplyingEntityID(const EntityID& pX) { + _supplyingEntityID = pX; +} + +void ResupplyCancelPdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _supplyingEntityID.marshal(dataStream); +} + +void ResupplyCancelPdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _supplyingEntityID.unmarshal(dataStream); +} + +bool ResupplyCancelPdu::operator==(const ResupplyCancelPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_supplyingEntityID == rhs._supplyingEntityID)) ivarsEqual = false; + + return ivarsEqual; +} + +int ResupplyCancelPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/ResupplyCancelPdu.h b/src/dis6/logistics/ResupplyCancelPdu.h new file mode 100644 index 00000000..ba62ea44 --- /dev/null +++ b/src/dis6/logistics/ResupplyCancelPdu.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/LogisticsFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.5.4. Cancel of resupply by either the receiving or supplying +// entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ResupplyCancelPdu : public LogisticsFamilyPdu { + protected: + /** Entity that is receiving service */ + EntityID _receivingEntityID; + + /** Entity that is supplying */ + EntityID _supplyingEntityID; + + public: + ResupplyCancelPdu(); + virtual ~ResupplyCancelPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getSupplyingEntityID(); + const EntityID& getSupplyingEntityID() const; + void setSupplyingEntityID(const EntityID& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ResupplyCancelPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/ResupplyOfferPdu.cpp b/src/dis6/logistics/ResupplyOfferPdu.cpp new file mode 100644 index 00000000..1aaac4af --- /dev/null +++ b/src/dis6/logistics/ResupplyOfferPdu.cpp @@ -0,0 +1,163 @@ +#include "dis6/ResupplyOfferPdu.h" + +using namespace DIS; + +ResupplyOfferPdu::ResupplyOfferPdu() + : LogisticsFamilyPdu(), + _receivingEntityID(), + _supplyingEntityID(), + _numberOfSupplyTypes(0), + _padding1(0), + _padding2(0) { + setPduType(6); +} + +ResupplyOfferPdu::~ResupplyOfferPdu() { _supplies.clear(); } + +EntityID& ResupplyOfferPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& ResupplyOfferPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void ResupplyOfferPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& ResupplyOfferPdu::getSupplyingEntityID() { + return _supplyingEntityID; +} + +const EntityID& ResupplyOfferPdu::getSupplyingEntityID() const { + return _supplyingEntityID; +} + +void ResupplyOfferPdu::setSupplyingEntityID(const EntityID& pX) { + _supplyingEntityID = pX; +} + +uint8_t ResupplyOfferPdu::getNumberOfSupplyTypes() const { + return _supplies.size(); +} + +int16_t ResupplyOfferPdu::getPadding1() const { return _padding1; } + +void ResupplyOfferPdu::setPadding1(int16_t pX) { _padding1 = pX; } + +char ResupplyOfferPdu::getPadding2() const { return _padding2; } + +void ResupplyOfferPdu::setPadding2(char pX) { _padding2 = pX; } + +std::vector& ResupplyOfferPdu::getSupplies() { + return _supplies; +} + +const std::vector& ResupplyOfferPdu::getSupplies() const { + return _supplies; +} + +void ResupplyOfferPdu::setSupplies(const std::vector& pX) { + _supplies = pX; +} + +void ResupplyOfferPdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _supplyingEntityID.marshal(dataStream); + dataStream << (uint8_t)_supplies.size(); + dataStream << _padding1; + dataStream << _padding2; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity x = _supplies[idx]; + x.marshal(dataStream); + } +} + +void ResupplyOfferPdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _supplyingEntityID.unmarshal(dataStream); + dataStream >> _numberOfSupplyTypes; + dataStream >> _padding1; + dataStream >> _padding2; + + _supplies.clear(); + for (size_t idx = 0; idx < _numberOfSupplyTypes; idx++) { + SupplyQuantity x; + x.unmarshal(dataStream); + _supplies.push_back(x); + } +} + +bool ResupplyOfferPdu::operator==(const ResupplyOfferPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_supplyingEntityID == rhs._supplyingEntityID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + if (!(_supplies[idx] == rhs._supplies[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ResupplyOfferPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID + marshalSize = marshalSize + 1; // _numberOfSupplyTypes + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 1; // _padding2 + + for (uint64_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity listElement = _supplies[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/ResupplyOfferPdu.h b/src/dis6/logistics/ResupplyOfferPdu.h new file mode 100644 index 00000000..594f4750 --- /dev/null +++ b/src/dis6/logistics/ResupplyOfferPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/LogisticsFamilyPdu.h" +#include "dis6/SupplyQuantity.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.5.2. Information about a request for supplies. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ResupplyOfferPdu : public LogisticsFamilyPdu { + protected: + /** Entity that is receiving service */ + EntityID _receivingEntityID; + + /** Entity that is supplying */ + EntityID _supplyingEntityID; + + /** how many supplies are being offered */ + uint8_t _numberOfSupplyTypes; + + /** padding */ + int16_t _padding1; + + /** padding */ + char _padding2; + + std::vector _supplies; + + public: + ResupplyOfferPdu(); + virtual ~ResupplyOfferPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getSupplyingEntityID(); + const EntityID& getSupplyingEntityID() const; + void setSupplyingEntityID(const EntityID& pX); + + uint8_t getNumberOfSupplyTypes() const; + + int16_t getPadding1() const; + void setPadding1(int16_t pX); + + char getPadding2() const; + void setPadding2(char pX); + + std::vector& getSupplies(); + const std::vector& getSupplies() const; + void setSupplies(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ResupplyOfferPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/ResupplyReceivedPdu.cpp b/src/dis6/logistics/ResupplyReceivedPdu.cpp new file mode 100644 index 00000000..d444144d --- /dev/null +++ b/src/dis6/logistics/ResupplyReceivedPdu.cpp @@ -0,0 +1,163 @@ +#include "dis6/ResupplyReceivedPdu.h" + +using namespace DIS; + +ResupplyReceivedPdu::ResupplyReceivedPdu() + : LogisticsFamilyPdu(), + _receivingEntityID(), + _supplyingEntityID(), + _numberOfSupplyTypes(0), + _padding1(0), + _padding2(0) { + setPduType(7); +} + +ResupplyReceivedPdu::~ResupplyReceivedPdu() { _supplies.clear(); } + +EntityID& ResupplyReceivedPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& ResupplyReceivedPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void ResupplyReceivedPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& ResupplyReceivedPdu::getSupplyingEntityID() { + return _supplyingEntityID; +} + +const EntityID& ResupplyReceivedPdu::getSupplyingEntityID() const { + return _supplyingEntityID; +} + +void ResupplyReceivedPdu::setSupplyingEntityID(const EntityID& pX) { + _supplyingEntityID = pX; +} + +uint8_t ResupplyReceivedPdu::getNumberOfSupplyTypes() const { + return _supplies.size(); +} + +int16_t ResupplyReceivedPdu::getPadding1() const { return _padding1; } + +void ResupplyReceivedPdu::setPadding1(int16_t pX) { _padding1 = pX; } + +char ResupplyReceivedPdu::getPadding2() const { return _padding2; } + +void ResupplyReceivedPdu::setPadding2(char pX) { _padding2 = pX; } + +std::vector& ResupplyReceivedPdu::getSupplies() { + return _supplies; +} + +const std::vector& ResupplyReceivedPdu::getSupplies() const { + return _supplies; +} + +void ResupplyReceivedPdu::setSupplies(const std::vector& pX) { + _supplies = pX; +} + +void ResupplyReceivedPdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _supplyingEntityID.marshal(dataStream); + dataStream << (uint8_t)_supplies.size(); + dataStream << _padding1; + dataStream << _padding2; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity x = _supplies[idx]; + x.marshal(dataStream); + } +} + +void ResupplyReceivedPdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _supplyingEntityID.unmarshal(dataStream); + dataStream >> _numberOfSupplyTypes; + dataStream >> _padding1; + dataStream >> _padding2; + + _supplies.clear(); + for (size_t idx = 0; idx < _numberOfSupplyTypes; idx++) { + SupplyQuantity x; + x.unmarshal(dataStream); + _supplies.push_back(x); + } +} + +bool ResupplyReceivedPdu::operator==(const ResupplyReceivedPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_supplyingEntityID == rhs._supplyingEntityID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + if (!(_supplies[idx] == rhs._supplies[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ResupplyReceivedPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID + marshalSize = marshalSize + 1; // _numberOfSupplyTypes + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 1; // _padding2 + + for (uint64_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity listElement = _supplies[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/ResupplyReceivedPdu.h b/src/dis6/logistics/ResupplyReceivedPdu.h new file mode 100644 index 00000000..525ff0fd --- /dev/null +++ b/src/dis6/logistics/ResupplyReceivedPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/LogisticsFamilyPdu.h" +#include "dis6/SupplyQuantity.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.5.3. Receipt of supplies is communiated. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ResupplyReceivedPdu : public LogisticsFamilyPdu { + protected: + /** Entity that is receiving service */ + EntityID _receivingEntityID; + + /** Entity that is supplying */ + EntityID _supplyingEntityID; + + /** how many supplies are being offered */ + uint8_t _numberOfSupplyTypes; + + /** padding */ + int16_t _padding1; + + /** padding */ + char _padding2; + + std::vector _supplies; + + public: + ResupplyReceivedPdu(); + virtual ~ResupplyReceivedPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getSupplyingEntityID(); + const EntityID& getSupplyingEntityID() const; + void setSupplyingEntityID(const EntityID& pX); + + uint8_t getNumberOfSupplyTypes() const; + + int16_t getPadding1() const; + void setPadding1(int16_t pX); + + char getPadding2() const; + void setPadding2(char pX); + + std::vector& getSupplies(); + const std::vector& getSupplies() const; + void setSupplies(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ResupplyReceivedPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/ServiceRequestPdu.cpp b/src/dis6/logistics/ServiceRequestPdu.cpp new file mode 100644 index 00000000..192db8e4 --- /dev/null +++ b/src/dis6/logistics/ServiceRequestPdu.cpp @@ -0,0 +1,172 @@ +#include "dis6/ServiceRequestPdu.h" + +using namespace DIS; + +ServiceRequestPdu::ServiceRequestPdu() + : LogisticsFamilyPdu(), + _requestingEntityID(), + _servicingEntityID(), + _serviceTypeRequested(0), + _numberOfSupplyTypes(0), + _serviceRequestPadding(0) { + setPduType(5); +} + +ServiceRequestPdu::~ServiceRequestPdu() { _supplies.clear(); } + +EntityID& ServiceRequestPdu::getRequestingEntityID() { + return _requestingEntityID; +} + +const EntityID& ServiceRequestPdu::getRequestingEntityID() const { + return _requestingEntityID; +} + +void ServiceRequestPdu::setRequestingEntityID(const EntityID& pX) { + _requestingEntityID = pX; +} + +EntityID& ServiceRequestPdu::getServicingEntityID() { + return _servicingEntityID; +} + +const EntityID& ServiceRequestPdu::getServicingEntityID() const { + return _servicingEntityID; +} + +void ServiceRequestPdu::setServicingEntityID(const EntityID& pX) { + _servicingEntityID = pX; +} + +uint8_t ServiceRequestPdu::getServiceTypeRequested() const { + return _serviceTypeRequested; +} + +void ServiceRequestPdu::setServiceTypeRequested(uint8_t pX) { + _serviceTypeRequested = pX; +} + +uint8_t ServiceRequestPdu::getNumberOfSupplyTypes() const { + return _supplies.size(); +} + +int16_t ServiceRequestPdu::getServiceRequestPadding() const { + return _serviceRequestPadding; +} + +void ServiceRequestPdu::setServiceRequestPadding(int16_t pX) { + _serviceRequestPadding = pX; +} + +std::vector& ServiceRequestPdu::getSupplies() { + return _supplies; +} + +const std::vector& ServiceRequestPdu::getSupplies() const { + return _supplies; +} + +void ServiceRequestPdu::setSupplies(const std::vector& pX) { + _supplies = pX; +} + +void ServiceRequestPdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _requestingEntityID.marshal(dataStream); + _servicingEntityID.marshal(dataStream); + dataStream << _serviceTypeRequested; + dataStream << (uint8_t)_supplies.size(); + dataStream << _serviceRequestPadding; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity x = _supplies[idx]; + x.marshal(dataStream); + } +} + +void ServiceRequestPdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _requestingEntityID.unmarshal(dataStream); + _servicingEntityID.unmarshal(dataStream); + dataStream >> _serviceTypeRequested; + dataStream >> _numberOfSupplyTypes; + dataStream >> _serviceRequestPadding; + + _supplies.clear(); + for (size_t idx = 0; idx < _numberOfSupplyTypes; idx++) { + SupplyQuantity x; + x.unmarshal(dataStream); + _supplies.push_back(x); + } +} + +bool ServiceRequestPdu::operator==(const ServiceRequestPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_requestingEntityID == rhs._requestingEntityID)) ivarsEqual = false; + if (!(_servicingEntityID == rhs._servicingEntityID)) ivarsEqual = false; + if (!(_serviceTypeRequested == rhs._serviceTypeRequested)) ivarsEqual = false; + if (!(_serviceRequestPadding == rhs._serviceRequestPadding)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + if (!(_supplies[idx] == rhs._supplies[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ServiceRequestPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _requestingEntityID.getMarshalledSize(); // _requestingEntityID + marshalSize = marshalSize + + _servicingEntityID.getMarshalledSize(); // _servicingEntityID + marshalSize = marshalSize + 1; // _serviceTypeRequested + marshalSize = marshalSize + 1; // _numberOfSupplyTypes + marshalSize = marshalSize + 2; // _serviceRequestPadding + + for (uint64_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity listElement = _supplies[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/ServiceRequestPdu.h b/src/dis6/logistics/ServiceRequestPdu.h new file mode 100644 index 00000000..85689e52 --- /dev/null +++ b/src/dis6/logistics/ServiceRequestPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/LogisticsFamilyPdu.h" +#include "dis6/SupplyQuantity.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.5.1. Information about a request for supplies. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ServiceRequestPdu : public LogisticsFamilyPdu { + protected: + /** Entity that is requesting service */ + EntityID _requestingEntityID; + + /** Entity that is providing the service */ + EntityID _servicingEntityID; + + /** type of service requested */ + uint8_t _serviceTypeRequested; + + /** How many requested */ + uint8_t _numberOfSupplyTypes; + + /** padding */ + int16_t _serviceRequestPadding; + + std::vector _supplies; + + public: + ServiceRequestPdu(); + virtual ~ServiceRequestPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getRequestingEntityID(); + const EntityID& getRequestingEntityID() const; + void setRequestingEntityID(const EntityID& pX); + + EntityID& getServicingEntityID(); + const EntityID& getServicingEntityID() const; + void setServicingEntityID(const EntityID& pX); + + uint8_t getServiceTypeRequested() const; + void setServiceTypeRequested(uint8_t pX); + + uint8_t getNumberOfSupplyTypes() const; + + int16_t getServiceRequestPadding() const; + void setServiceRequestPadding(int16_t pX); + + std::vector& getSupplies(); + const std::vector& getSupplies() const; + void setSupplies(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ServiceRequestPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/SupplyQuantity.cpp b/src/dis6/logistics/SupplyQuantity.cpp new file mode 100644 index 00000000..b48c40db --- /dev/null +++ b/src/dis6/logistics/SupplyQuantity.cpp @@ -0,0 +1,75 @@ +#include "dis6/SupplyQuantity.h" + +using namespace DIS; + +SupplyQuantity::SupplyQuantity() : _supplyType(), _quantity(0) {} + +SupplyQuantity::~SupplyQuantity() {} + +EntityType& SupplyQuantity::getSupplyType() { return _supplyType; } + +const EntityType& SupplyQuantity::getSupplyType() const { return _supplyType; } + +void SupplyQuantity::setSupplyType(const EntityType& pX) { _supplyType = pX; } + +uint8_t SupplyQuantity::getQuantity() const { return _quantity; } + +void SupplyQuantity::setQuantity(uint8_t pX) { _quantity = pX; } + +void SupplyQuantity::marshal(DataStream& dataStream) const { + _supplyType.marshal(dataStream); + dataStream << _quantity; +} + +void SupplyQuantity::unmarshal(DataStream& dataStream) { + _supplyType.unmarshal(dataStream); + dataStream >> _quantity; +} + +bool SupplyQuantity::operator==(const SupplyQuantity& rhs) const { + bool ivarsEqual = true; + + if (!(_supplyType == rhs._supplyType)) ivarsEqual = false; + if (!(_quantity == rhs._quantity)) ivarsEqual = false; + + return ivarsEqual; +} + +int SupplyQuantity::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _supplyType.getMarshalledSize(); // _supplyType + marshalSize = marshalSize + 1; // _quantity + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/logistics/SupplyQuantity.h b/src/dis6/logistics/SupplyQuantity.h new file mode 100644 index 00000000..f6bf204b --- /dev/null +++ b/src/dis6/logistics/SupplyQuantity.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis6/EntityType.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.30. A supply, and the amount of that supply. Similar to an entity +// kind but with the addition of a quantity. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SupplyQuantity { + protected: + /** Type of supply */ + EntityType _supplyType; + + /** quantity to be supplied */ + uint8_t _quantity; + + public: + SupplyQuantity(); + virtual ~SupplyQuantity(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getSupplyType(); + const EntityType& getSupplyType() const; + void setSupplyType(const EntityType& pX); + + uint8_t getQuantity() const; + void setQuantity(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SupplyQuantity& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/CMakeLists.txt b/src/dis6/minefield/CMakeLists.txt new file mode 100644 index 00000000..b1524dd6 --- /dev/null +++ b/src/dis6/minefield/CMakeLists.txt @@ -0,0 +1,29 @@ +set(minefield_src + MinefieldDataPdu.cpp + MinefieldFamilyPdu.cpp + MinefieldQueryPdu.cpp + MinefieldResponseNackPdu.cpp + MinefieldStatePdu.cpp + Point.cpp +) + +set(minefield_hdr + MinefieldDataPdu.h + MinefieldFamilyPdu.h + MinefieldQueryPdu.h + MinefieldResponseNackPdu.h + MinefieldStatePdu.h + Point.h +) + +list(TRANSFORM minefield_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND minefield_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${minefield_src}) + +install(FILES ${minefield_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/minefield +) diff --git a/src/dis6/minefield/MinefieldDataPdu.cpp b/src/dis6/minefield/MinefieldDataPdu.cpp new file mode 100644 index 00000000..ec86b8d6 --- /dev/null +++ b/src/dis6/minefield/MinefieldDataPdu.cpp @@ -0,0 +1,272 @@ +#include "dis6/MinefieldDataPdu.h" + +using namespace DIS; + +MinefieldDataPdu::MinefieldDataPdu() + : MinefieldFamilyPdu(), + _minefieldID(), + _requestingEntityID(), + _minefieldSequenceNumbeer(0), + _requestID(0), + _pduSequenceNumber(0), + _numberOfPdus(0), + _numberOfMinesInThisPdu(0), + _numberOfSensorTypes(0), + _pad2(0), + _dataFilter(0), + _mineType(), + _pad3(0) { + setPduType(39); +} + +MinefieldDataPdu::~MinefieldDataPdu() { + _sensorTypes.clear(); + _mineLocation.clear(); +} + +EntityID& MinefieldDataPdu::getMinefieldID() { return _minefieldID; } + +const EntityID& MinefieldDataPdu::getMinefieldID() const { + return _minefieldID; +} + +void MinefieldDataPdu::setMinefieldID(const EntityID& pX) { _minefieldID = pX; } + +EntityID& MinefieldDataPdu::getRequestingEntityID() { + return _requestingEntityID; +} + +const EntityID& MinefieldDataPdu::getRequestingEntityID() const { + return _requestingEntityID; +} + +void MinefieldDataPdu::setRequestingEntityID(const EntityID& pX) { + _requestingEntityID = pX; +} + +uint16_t MinefieldDataPdu::getMinefieldSequenceNumbeer() const { + return _minefieldSequenceNumbeer; +} + +void MinefieldDataPdu::setMinefieldSequenceNumbeer(uint16_t pX) { + _minefieldSequenceNumbeer = pX; +} + +uint8_t MinefieldDataPdu::getRequestID() const { return _requestID; } + +void MinefieldDataPdu::setRequestID(uint8_t pX) { _requestID = pX; } + +uint8_t MinefieldDataPdu::getPduSequenceNumber() const { + return _pduSequenceNumber; +} + +void MinefieldDataPdu::setPduSequenceNumber(uint8_t pX) { + _pduSequenceNumber = pX; +} + +uint8_t MinefieldDataPdu::getNumberOfPdus() const { + return _numberOfPdus; +} + +void MinefieldDataPdu::setNumberOfPdus(uint8_t pX) { _numberOfPdus = pX; } + +uint8_t MinefieldDataPdu::getNumberOfMinesInThisPdu() const { + return _mineLocation.size(); +} + +uint8_t MinefieldDataPdu::getNumberOfSensorTypes() const { + return _sensorTypes.size(); +} + +uint8_t MinefieldDataPdu::getPad2() const { return _pad2; } + +void MinefieldDataPdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t MinefieldDataPdu::getDataFilter() const { return _dataFilter; } + +void MinefieldDataPdu::setDataFilter(uint32_t pX) { _dataFilter = pX; } + +EntityType& MinefieldDataPdu::getMineType() { return _mineType; } + +const EntityType& MinefieldDataPdu::getMineType() const { return _mineType; } + +void MinefieldDataPdu::setMineType(const EntityType& pX) { _mineType = pX; } + +std::vector& MinefieldDataPdu::getSensorTypes() { + return _sensorTypes; +} + +const std::vector& MinefieldDataPdu::getSensorTypes() const { + return _sensorTypes; +} + +void MinefieldDataPdu::setSensorTypes(const std::vector& pX) { + _sensorTypes = pX; +} + +uint8_t MinefieldDataPdu::getPad3() const { return _pad3; } + +void MinefieldDataPdu::setPad3(uint8_t pX) { _pad3 = pX; } + +std::vector& MinefieldDataPdu::getMineLocation() { + return _mineLocation; +} + +const std::vector& MinefieldDataPdu::getMineLocation() const { + return _mineLocation; +} + +void MinefieldDataPdu::setMineLocation(const std::vector& pX) { + _mineLocation = pX; +} + +void MinefieldDataPdu::marshal(DataStream& dataStream) const { + MinefieldFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _minefieldID.marshal(dataStream); + _requestingEntityID.marshal(dataStream); + dataStream << _minefieldSequenceNumbeer; + dataStream << _requestID; + dataStream << _pduSequenceNumber; + dataStream << _numberOfPdus; + dataStream << (uint8_t)_mineLocation.size(); + dataStream << (uint8_t)_sensorTypes.size(); + dataStream << _pad2; + dataStream << _dataFilter; + _mineType.marshal(dataStream); + + for (size_t idx = 0; idx < _sensorTypes.size(); idx++) { + TwoByteChunk x = _sensorTypes[idx]; + x.marshal(dataStream); + } + + dataStream << _pad3; + + for (size_t idx = 0; idx < _mineLocation.size(); idx++) { + Vector3Float x = _mineLocation[idx]; + x.marshal(dataStream); + } +} + +void MinefieldDataPdu::unmarshal(DataStream& dataStream) { + MinefieldFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _minefieldID.unmarshal(dataStream); + _requestingEntityID.unmarshal(dataStream); + dataStream >> _minefieldSequenceNumbeer; + dataStream >> _requestID; + dataStream >> _pduSequenceNumber; + dataStream >> _numberOfPdus; + dataStream >> _numberOfMinesInThisPdu; + dataStream >> _numberOfSensorTypes; + dataStream >> _pad2; + dataStream >> _dataFilter; + _mineType.unmarshal(dataStream); + + _sensorTypes.clear(); + for (size_t idx = 0; idx < _numberOfSensorTypes; idx++) { + TwoByteChunk x; + x.unmarshal(dataStream); + _sensorTypes.push_back(x); + } + dataStream >> _pad3; + + _mineLocation.clear(); + for (size_t idx = 0; idx < _numberOfMinesInThisPdu; idx++) { + Vector3Float x; + x.unmarshal(dataStream); + _mineLocation.push_back(x); + } +} + +bool MinefieldDataPdu::operator==(const MinefieldDataPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = MinefieldFamilyPdu::operator==(rhs); + + if (!(_minefieldID == rhs._minefieldID)) ivarsEqual = false; + if (!(_requestingEntityID == rhs._requestingEntityID)) ivarsEqual = false; + if (!(_minefieldSequenceNumbeer == rhs._minefieldSequenceNumbeer)) + ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_pduSequenceNumber == rhs._pduSequenceNumber)) ivarsEqual = false; + if (!(_numberOfPdus == rhs._numberOfPdus)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_dataFilter == rhs._dataFilter)) ivarsEqual = false; + if (!(_mineType == rhs._mineType)) ivarsEqual = false; + + for (size_t idx = 0; idx < _sensorTypes.size(); idx++) { + if (!(_sensorTypes[idx] == rhs._sensorTypes[idx])) ivarsEqual = false; + } + + if (!(_pad3 == rhs._pad3)) ivarsEqual = false; + + for (size_t idx = 0; idx < _mineLocation.size(); idx++) { + if (!(_mineLocation[idx] == rhs._mineLocation[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int MinefieldDataPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = MinefieldFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID + marshalSize = marshalSize + + _requestingEntityID.getMarshalledSize(); // _requestingEntityID + marshalSize = marshalSize + 2; // _minefieldSequenceNumbeer + marshalSize = marshalSize + 1; // _requestID + marshalSize = marshalSize + 1; // _pduSequenceNumber + marshalSize = marshalSize + 1; // _numberOfPdus + marshalSize = marshalSize + 1; // _numberOfMinesInThisPdu + marshalSize = marshalSize + 1; // _numberOfSensorTypes + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _dataFilter + marshalSize = marshalSize + _mineType.getMarshalledSize(); // _mineType + + for (uint64_t idx = 0; idx < _sensorTypes.size(); idx++) { + TwoByteChunk listElement = _sensorTypes[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + marshalSize = marshalSize + 1; // _pad3 + + for (uint64_t idx = 0; idx < _mineLocation.size(); idx++) { + Vector3Float listElement = _mineLocation[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldDataPdu.h b/src/dis6/minefield/MinefieldDataPdu.h new file mode 100644 index 00000000..2802ea62 --- /dev/null +++ b/src/dis6/minefield/MinefieldDataPdu.h @@ -0,0 +1,154 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/EntityType.h" +#include "dis6/MinefieldFamilyPdu.h" +#include "dis6/TwoByteChunk.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.10.3 Information about individual mines within a minefield. This +// is very, very wrong. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class MinefieldDataPdu : public MinefieldFamilyPdu { + protected: + /** Minefield ID */ + EntityID _minefieldID; + + /** ID of entity making request */ + EntityID _requestingEntityID; + + /** Minefield sequence number */ + uint16_t _minefieldSequenceNumbeer; + + /** request ID */ + uint8_t _requestID; + + /** pdu sequence number */ + uint8_t _pduSequenceNumber; + + /** number of pdus in response */ + uint8_t _numberOfPdus; + + /** how many mines are in this PDU */ + uint8_t _numberOfMinesInThisPdu; + + /** how many sensor type are in this PDU */ + uint8_t _numberOfSensorTypes; + + /** padding */ + uint8_t _pad2; + + /** 32 boolean fields */ + uint32_t _dataFilter; + + /** Mine type */ + EntityType _mineType; + + /** Sensor types, each 16 bits long */ + std::vector _sensorTypes; + + /** Padding to get things 32-bit aligned. ^^^this is wrong--dyanmically sized + * padding needed */ + uint8_t _pad3; + + /** Mine locations */ + std::vector _mineLocation; + + public: + MinefieldDataPdu(); + virtual ~MinefieldDataPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getMinefieldID(); + const EntityID& getMinefieldID() const; + void setMinefieldID(const EntityID& pX); + + EntityID& getRequestingEntityID(); + const EntityID& getRequestingEntityID() const; + void setRequestingEntityID(const EntityID& pX); + + uint16_t getMinefieldSequenceNumbeer() const; + void setMinefieldSequenceNumbeer(uint16_t pX); + + uint8_t getRequestID() const; + void setRequestID(uint8_t pX); + + uint8_t getPduSequenceNumber() const; + void setPduSequenceNumber(uint8_t pX); + + uint8_t getNumberOfPdus() const; + void setNumberOfPdus(uint8_t pX); + + uint8_t getNumberOfMinesInThisPdu() const; + + uint8_t getNumberOfSensorTypes() const; + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getDataFilter() const; + void setDataFilter(uint32_t pX); + + EntityType& getMineType(); + const EntityType& getMineType() const; + void setMineType(const EntityType& pX); + + std::vector& getSensorTypes(); + const std::vector& getSensorTypes() const; + void setSensorTypes(const std::vector& pX); + + uint8_t getPad3() const; + void setPad3(uint8_t pX); + + std::vector& getMineLocation(); + const std::vector& getMineLocation() const; + void setMineLocation(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldDataPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldFamilyPdu.cpp b/src/dis6/minefield/MinefieldFamilyPdu.cpp new file mode 100644 index 00000000..1c8ffd7f --- /dev/null +++ b/src/dis6/minefield/MinefieldFamilyPdu.cpp @@ -0,0 +1,66 @@ +#include "dis6/MinefieldFamilyPdu.h" + +using namespace DIS; + +MinefieldFamilyPdu::MinefieldFamilyPdu() + : Pdu() + +{ + setProtocolFamily(8); +} + +MinefieldFamilyPdu::~MinefieldFamilyPdu() {} + +void MinefieldFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void MinefieldFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool MinefieldFamilyPdu::operator==(const MinefieldFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int MinefieldFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldFamilyPdu.h b/src/dis6/minefield/MinefieldFamilyPdu.h new file mode 100644 index 00000000..4751857b --- /dev/null +++ b/src/dis6/minefield/MinefieldFamilyPdu.h @@ -0,0 +1,59 @@ +#pragma once + +#include "dis6/Pdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.10.1 Abstract superclass for PDUs relating to minefields + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class MinefieldFamilyPdu : public Pdu { + protected: + public: + MinefieldFamilyPdu(); + virtual ~MinefieldFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldQueryPdu.cpp b/src/dis6/minefield/MinefieldQueryPdu.cpp new file mode 100644 index 00000000..356f7c59 --- /dev/null +++ b/src/dis6/minefield/MinefieldQueryPdu.cpp @@ -0,0 +1,235 @@ +#include "dis6/MinefieldQueryPdu.h" + +using namespace DIS; + +MinefieldQueryPdu::MinefieldQueryPdu() + : MinefieldFamilyPdu(), + _minefieldID(), + _requestingEntityID(), + _requestID(0), + _numberOfPerimeterPoints(0), + _pad2(0), + _numberOfSensorTypes(0), + _dataFilter(0), + _requestedMineType() { + setPduType(38); +} + +MinefieldQueryPdu::~MinefieldQueryPdu() { + _requestedPerimeterPoints.clear(); + _sensorTypes.clear(); +} + +EntityID& MinefieldQueryPdu::getMinefieldID() { return _minefieldID; } + +const EntityID& MinefieldQueryPdu::getMinefieldID() const { + return _minefieldID; +} + +void MinefieldQueryPdu::setMinefieldID(const EntityID& pX) { + _minefieldID = pX; +} + +EntityID& MinefieldQueryPdu::getRequestingEntityID() { + return _requestingEntityID; +} + +const EntityID& MinefieldQueryPdu::getRequestingEntityID() const { + return _requestingEntityID; +} + +void MinefieldQueryPdu::setRequestingEntityID(const EntityID& pX) { + _requestingEntityID = pX; +} + +uint8_t MinefieldQueryPdu::getRequestID() const { return _requestID; } + +void MinefieldQueryPdu::setRequestID(uint8_t pX) { _requestID = pX; } + +uint8_t MinefieldQueryPdu::getNumberOfPerimeterPoints() const { + return _requestedPerimeterPoints.size(); +} + +uint8_t MinefieldQueryPdu::getPad2() const { return _pad2; } + +void MinefieldQueryPdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint8_t MinefieldQueryPdu::getNumberOfSensorTypes() const { + return _sensorTypes.size(); +} + +uint32_t MinefieldQueryPdu::getDataFilter() const { return _dataFilter; } + +void MinefieldQueryPdu::setDataFilter(uint32_t pX) { _dataFilter = pX; } + +EntityType& MinefieldQueryPdu::getRequestedMineType() { + return _requestedMineType; +} + +const EntityType& MinefieldQueryPdu::getRequestedMineType() const { + return _requestedMineType; +} + +void MinefieldQueryPdu::setRequestedMineType(const EntityType& pX) { + _requestedMineType = pX; +} + +std::vector& MinefieldQueryPdu::getRequestedPerimeterPoints() { + return _requestedPerimeterPoints; +} + +const std::vector& MinefieldQueryPdu::getRequestedPerimeterPoints() + const { + return _requestedPerimeterPoints; +} + +void MinefieldQueryPdu::setRequestedPerimeterPoints( + const std::vector& pX) { + _requestedPerimeterPoints = pX; +} + +std::vector& MinefieldQueryPdu::getSensorTypes() { + return _sensorTypes; +} + +const std::vector& MinefieldQueryPdu::getSensorTypes() const { + return _sensorTypes; +} + +void MinefieldQueryPdu::setSensorTypes(const std::vector& pX) { + _sensorTypes = pX; +} + +void MinefieldQueryPdu::marshal(DataStream& dataStream) const { + MinefieldFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _minefieldID.marshal(dataStream); + _requestingEntityID.marshal(dataStream); + dataStream << _requestID; + dataStream << (uint8_t)_requestedPerimeterPoints.size(); + dataStream << _pad2; + dataStream << (uint8_t)_sensorTypes.size(); + dataStream << _dataFilter; + _requestedMineType.marshal(dataStream); + + for (size_t idx = 0; idx < _requestedPerimeterPoints.size(); idx++) { + Point x = _requestedPerimeterPoints[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _sensorTypes.size(); idx++) { + TwoByteChunk x = _sensorTypes[idx]; + x.marshal(dataStream); + } +} + +void MinefieldQueryPdu::unmarshal(DataStream& dataStream) { + MinefieldFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _minefieldID.unmarshal(dataStream); + _requestingEntityID.unmarshal(dataStream); + dataStream >> _requestID; + dataStream >> _numberOfPerimeterPoints; + dataStream >> _pad2; + dataStream >> _numberOfSensorTypes; + dataStream >> _dataFilter; + _requestedMineType.unmarshal(dataStream); + + _requestedPerimeterPoints.clear(); + for (size_t idx = 0; idx < _numberOfPerimeterPoints; idx++) { + Point x; + x.unmarshal(dataStream); + _requestedPerimeterPoints.push_back(x); + } + + _sensorTypes.clear(); + for (size_t idx = 0; idx < _numberOfSensorTypes; idx++) { + TwoByteChunk x; + x.unmarshal(dataStream); + _sensorTypes.push_back(x); + } +} + +bool MinefieldQueryPdu::operator==(const MinefieldQueryPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = MinefieldFamilyPdu::operator==(rhs); + + if (!(_minefieldID == rhs._minefieldID)) ivarsEqual = false; + if (!(_requestingEntityID == rhs._requestingEntityID)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_dataFilter == rhs._dataFilter)) ivarsEqual = false; + if (!(_requestedMineType == rhs._requestedMineType)) ivarsEqual = false; + + for (size_t idx = 0; idx < _requestedPerimeterPoints.size(); idx++) { + if (!(_requestedPerimeterPoints[idx] == rhs._requestedPerimeterPoints[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _sensorTypes.size(); idx++) { + if (!(_sensorTypes[idx] == rhs._sensorTypes[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int MinefieldQueryPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = MinefieldFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID + marshalSize = marshalSize + + _requestingEntityID.getMarshalledSize(); // _requestingEntityID + marshalSize = marshalSize + 1; // _requestID + marshalSize = marshalSize + 1; // _numberOfPerimeterPoints + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 1; // _numberOfSensorTypes + marshalSize = marshalSize + 4; // _dataFilter + marshalSize = marshalSize + + _requestedMineType.getMarshalledSize(); // _requestedMineType + + for (uint64_t idx = 0; idx < _requestedPerimeterPoints.size(); + idx++) { + Point listElement = _requestedPerimeterPoints[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _sensorTypes.size(); idx++) { + TwoByteChunk listElement = _sensorTypes[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldQueryPdu.h b/src/dis6/minefield/MinefieldQueryPdu.h new file mode 100644 index 00000000..795eabc8 --- /dev/null +++ b/src/dis6/minefield/MinefieldQueryPdu.h @@ -0,0 +1,129 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/EntityType.h" +#include "dis6/MinefieldFamilyPdu.h" +#include "dis6/Point.h" +#include "dis6/TwoByteChunk.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.10.2 Query a minefield for information about individual mines. +// Requires manual clean up to get the padding right. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class MinefieldQueryPdu : public MinefieldFamilyPdu { + protected: + /** Minefield ID */ + EntityID _minefieldID; + + /** EID of entity making the request */ + EntityID _requestingEntityID; + + /** request ID */ + uint8_t _requestID; + + /** Number of perimeter points for the minefield */ + uint8_t _numberOfPerimeterPoints; + + /** Padding */ + uint8_t _pad2; + + /** Number of sensor types */ + uint8_t _numberOfSensorTypes; + + /** data filter, 32 boolean fields */ + uint32_t _dataFilter; + + /** Entity type of mine being requested */ + EntityType _requestedMineType; + + /** perimeter points of request */ + std::vector _requestedPerimeterPoints; + + /** Sensor types, each 16 bits long */ + std::vector _sensorTypes; + + public: + MinefieldQueryPdu(); + virtual ~MinefieldQueryPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getMinefieldID(); + const EntityID& getMinefieldID() const; + void setMinefieldID(const EntityID& pX); + + EntityID& getRequestingEntityID(); + const EntityID& getRequestingEntityID() const; + void setRequestingEntityID(const EntityID& pX); + + uint8_t getRequestID() const; + void setRequestID(uint8_t pX); + + uint8_t getNumberOfPerimeterPoints() const; + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint8_t getNumberOfSensorTypes() const; + + uint32_t getDataFilter() const; + void setDataFilter(uint32_t pX); + + EntityType& getRequestedMineType(); + const EntityType& getRequestedMineType() const; + void setRequestedMineType(const EntityType& pX); + + std::vector& getRequestedPerimeterPoints(); + const std::vector& getRequestedPerimeterPoints() const; + void setRequestedPerimeterPoints(const std::vector& pX); + + std::vector& getSensorTypes(); + const std::vector& getSensorTypes() const; + void setSensorTypes(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldQueryPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldResponseNackPdu.cpp b/src/dis6/minefield/MinefieldResponseNackPdu.cpp new file mode 100644 index 00000000..53a84a2d --- /dev/null +++ b/src/dis6/minefield/MinefieldResponseNackPdu.cpp @@ -0,0 +1,164 @@ +#include "dis6/MinefieldResponseNackPdu.h" + +using namespace DIS; + +MinefieldResponseNackPdu::MinefieldResponseNackPdu() + : MinefieldFamilyPdu(), + _minefieldID(), + _requestingEntityID(), + _requestID(0), + _numberOfMissingPdus(0) { + setPduType(40); +} + +MinefieldResponseNackPdu::~MinefieldResponseNackPdu() { + _missingPduSequenceNumbers.clear(); +} + +EntityID& MinefieldResponseNackPdu::getMinefieldID() { return _minefieldID; } + +const EntityID& MinefieldResponseNackPdu::getMinefieldID() const { + return _minefieldID; +} + +void MinefieldResponseNackPdu::setMinefieldID(const EntityID& pX) { + _minefieldID = pX; +} + +EntityID& MinefieldResponseNackPdu::getRequestingEntityID() { + return _requestingEntityID; +} + +const EntityID& MinefieldResponseNackPdu::getRequestingEntityID() const { + return _requestingEntityID; +} + +void MinefieldResponseNackPdu::setRequestingEntityID(const EntityID& pX) { + _requestingEntityID = pX; +} + +uint8_t MinefieldResponseNackPdu::getRequestID() const { + return _requestID; +} + +void MinefieldResponseNackPdu::setRequestID(uint8_t pX) { + _requestID = pX; +} + +uint8_t MinefieldResponseNackPdu::getNumberOfMissingPdus() const { + return _missingPduSequenceNumbers.size(); +} + +std::vector& +MinefieldResponseNackPdu::getMissingPduSequenceNumbers() { + return _missingPduSequenceNumbers; +} + +const std::vector& +MinefieldResponseNackPdu::getMissingPduSequenceNumbers() const { + return _missingPduSequenceNumbers; +} + +void MinefieldResponseNackPdu::setMissingPduSequenceNumbers( + const std::vector& pX) { + _missingPduSequenceNumbers = pX; +} + +void MinefieldResponseNackPdu::marshal(DataStream& dataStream) const { + MinefieldFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _minefieldID.marshal(dataStream); + _requestingEntityID.marshal(dataStream); + dataStream << _requestID; + dataStream << (uint8_t)_missingPduSequenceNumbers.size(); + + for (size_t idx = 0; idx < _missingPduSequenceNumbers.size(); idx++) { + EightByteChunk x = _missingPduSequenceNumbers[idx]; + x.marshal(dataStream); + } +} + +void MinefieldResponseNackPdu::unmarshal(DataStream& dataStream) { + MinefieldFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _minefieldID.unmarshal(dataStream); + _requestingEntityID.unmarshal(dataStream); + dataStream >> _requestID; + dataStream >> _numberOfMissingPdus; + + _missingPduSequenceNumbers.clear(); + for (size_t idx = 0; idx < _numberOfMissingPdus; idx++) { + EightByteChunk x; + x.unmarshal(dataStream); + _missingPduSequenceNumbers.push_back(x); + } +} + +bool MinefieldResponseNackPdu::operator==( + const MinefieldResponseNackPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = MinefieldFamilyPdu::operator==(rhs); + + if (!(_minefieldID == rhs._minefieldID)) ivarsEqual = false; + if (!(_requestingEntityID == rhs._requestingEntityID)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _missingPduSequenceNumbers.size(); idx++) { + if (!(_missingPduSequenceNumbers[idx] == + rhs._missingPduSequenceNumbers[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int MinefieldResponseNackPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = MinefieldFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID + marshalSize = marshalSize + + _requestingEntityID.getMarshalledSize(); // _requestingEntityID + marshalSize = marshalSize + 1; // _requestID + marshalSize = marshalSize + 1; // _numberOfMissingPdus + + for (uint64_t idx = 0; idx < _missingPduSequenceNumbers.size(); + idx++) { + EightByteChunk listElement = _missingPduSequenceNumbers[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldResponseNackPdu.h b/src/dis6/minefield/MinefieldResponseNackPdu.h new file mode 100644 index 00000000..4bad320e --- /dev/null +++ b/src/dis6/minefield/MinefieldResponseNackPdu.h @@ -0,0 +1,96 @@ +#pragma once + +#include + +#include "dis6/EightByteChunk.h" +#include "dis6/EntityID.h" +#include "dis6/MinefieldFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.10.4 proivde the means to request a retransmit of a minefield +// data pdu. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class MinefieldResponseNackPdu : public MinefieldFamilyPdu { + protected: + /** Minefield ID */ + EntityID _minefieldID; + + /** entity ID making the request */ + EntityID _requestingEntityID; + + /** request ID */ + uint8_t _requestID; + + /** how many pdus were missing */ + uint8_t _numberOfMissingPdus; + + /** PDU sequence numbers that were missing */ + std::vector _missingPduSequenceNumbers; + + public: + MinefieldResponseNackPdu(); + virtual ~MinefieldResponseNackPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getMinefieldID(); + const EntityID& getMinefieldID() const; + void setMinefieldID(const EntityID& pX); + + EntityID& getRequestingEntityID(); + const EntityID& getRequestingEntityID() const; + void setRequestingEntityID(const EntityID& pX); + + uint8_t getRequestID() const; + void setRequestID(uint8_t pX); + + uint8_t getNumberOfMissingPdus() const; + + std::vector& getMissingPduSequenceNumbers(); + const std::vector& getMissingPduSequenceNumbers() const; + void setMissingPduSequenceNumbers(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldResponseNackPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldStatePdu.cpp b/src/dis6/minefield/MinefieldStatePdu.cpp new file mode 100644 index 00000000..96327e0a --- /dev/null +++ b/src/dis6/minefield/MinefieldStatePdu.cpp @@ -0,0 +1,264 @@ +#include "dis6/MinefieldStatePdu.h" + +using namespace DIS; + +MinefieldStatePdu::MinefieldStatePdu() + : MinefieldFamilyPdu(), + _minefieldID(), + _minefieldSequence(0), + _forceID(0), + _numberOfPerimeterPoints(0), + _minefieldType(), + _numberOfMineTypes(0), + _minefieldLocation(), + _minefieldOrientation(), + _appearance(0), + _protocolMode(0) { + setPduType(37); +} + +MinefieldStatePdu::~MinefieldStatePdu() { + _perimeterPoints.clear(); + _mineType.clear(); +} + +EntityID& MinefieldStatePdu::getMinefieldID() { return _minefieldID; } + +const EntityID& MinefieldStatePdu::getMinefieldID() const { + return _minefieldID; +} + +void MinefieldStatePdu::setMinefieldID(const EntityID& pX) { + _minefieldID = pX; +} + +uint16_t MinefieldStatePdu::getMinefieldSequence() const { + return _minefieldSequence; +} + +void MinefieldStatePdu::setMinefieldSequence(uint16_t pX) { + _minefieldSequence = pX; +} + +uint8_t MinefieldStatePdu::getForceID() const { return _forceID; } + +void MinefieldStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t MinefieldStatePdu::getNumberOfPerimeterPoints() const { + return _perimeterPoints.size(); +} + +EntityType& MinefieldStatePdu::getMinefieldType() { return _minefieldType; } + +const EntityType& MinefieldStatePdu::getMinefieldType() const { + return _minefieldType; +} + +void MinefieldStatePdu::setMinefieldType(const EntityType& pX) { + _minefieldType = pX; +} + +uint16_t MinefieldStatePdu::getNumberOfMineTypes() const { + return _mineType.size(); +} + +Vector3Double& MinefieldStatePdu::getMinefieldLocation() { + return _minefieldLocation; +} + +const Vector3Double& MinefieldStatePdu::getMinefieldLocation() const { + return _minefieldLocation; +} + +void MinefieldStatePdu::setMinefieldLocation(const Vector3Double& pX) { + _minefieldLocation = pX; +} + +Orientation& MinefieldStatePdu::getMinefieldOrientation() { + return _minefieldOrientation; +} + +const Orientation& MinefieldStatePdu::getMinefieldOrientation() const { + return _minefieldOrientation; +} + +void MinefieldStatePdu::setMinefieldOrientation(const Orientation& pX) { + _minefieldOrientation = pX; +} + +uint16_t MinefieldStatePdu::getAppearance() const { return _appearance; } + +void MinefieldStatePdu::setAppearance(uint16_t pX) { _appearance = pX; } + +uint16_t MinefieldStatePdu::getProtocolMode() const { + return _protocolMode; +} + +void MinefieldStatePdu::setProtocolMode(uint16_t pX) { + _protocolMode = pX; +} + +std::vector& MinefieldStatePdu::getPerimeterPoints() { + return _perimeterPoints; +} + +const std::vector& MinefieldStatePdu::getPerimeterPoints() const { + return _perimeterPoints; +} + +void MinefieldStatePdu::setPerimeterPoints(const std::vector& pX) { + _perimeterPoints = pX; +} + +std::vector& MinefieldStatePdu::getMineType() { return _mineType; } + +const std::vector& MinefieldStatePdu::getMineType() const { + return _mineType; +} + +void MinefieldStatePdu::setMineType(const std::vector& pX) { + _mineType = pX; +} + +void MinefieldStatePdu::marshal(DataStream& dataStream) const { + MinefieldFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _minefieldID.marshal(dataStream); + dataStream << _minefieldSequence; + dataStream << _forceID; + dataStream << (uint8_t)_perimeterPoints.size(); + _minefieldType.marshal(dataStream); + dataStream << (uint16_t)_mineType.size(); + _minefieldLocation.marshal(dataStream); + _minefieldOrientation.marshal(dataStream); + dataStream << _appearance; + dataStream << _protocolMode; + + for (size_t idx = 0; idx < _perimeterPoints.size(); idx++) { + Point x = _perimeterPoints[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _mineType.size(); idx++) { + EntityType x = _mineType[idx]; + x.marshal(dataStream); + } +} + +void MinefieldStatePdu::unmarshal(DataStream& dataStream) { + MinefieldFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _minefieldID.unmarshal(dataStream); + dataStream >> _minefieldSequence; + dataStream >> _forceID; + dataStream >> _numberOfPerimeterPoints; + _minefieldType.unmarshal(dataStream); + dataStream >> _numberOfMineTypes; + _minefieldLocation.unmarshal(dataStream); + _minefieldOrientation.unmarshal(dataStream); + dataStream >> _appearance; + dataStream >> _protocolMode; + + _perimeterPoints.clear(); + for (size_t idx = 0; idx < _numberOfPerimeterPoints; idx++) { + Point x; + x.unmarshal(dataStream); + _perimeterPoints.push_back(x); + } + + _mineType.clear(); + for (size_t idx = 0; idx < _numberOfMineTypes; idx++) { + EntityType x; + x.unmarshal(dataStream); + _mineType.push_back(x); + } +} + +bool MinefieldStatePdu::operator==(const MinefieldStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = MinefieldFamilyPdu::operator==(rhs); + + if (!(_minefieldID == rhs._minefieldID)) ivarsEqual = false; + if (!(_minefieldSequence == rhs._minefieldSequence)) ivarsEqual = false; + if (!(_forceID == rhs._forceID)) ivarsEqual = false; + if (!(_minefieldType == rhs._minefieldType)) ivarsEqual = false; + if (!(_minefieldLocation == rhs._minefieldLocation)) ivarsEqual = false; + if (!(_minefieldOrientation == rhs._minefieldOrientation)) ivarsEqual = false; + if (!(_appearance == rhs._appearance)) ivarsEqual = false; + if (!(_protocolMode == rhs._protocolMode)) ivarsEqual = false; + + for (size_t idx = 0; idx < _perimeterPoints.size(); idx++) { + if (!(_perimeterPoints[idx] == rhs._perimeterPoints[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _mineType.size(); idx++) { + if (!(_mineType[idx] == rhs._mineType[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int MinefieldStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = MinefieldFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID + marshalSize = marshalSize + 2; // _minefieldSequence + marshalSize = marshalSize + 1; // _forceID + marshalSize = marshalSize + 1; // _numberOfPerimeterPoints + marshalSize = + marshalSize + _minefieldType.getMarshalledSize(); // _minefieldType + marshalSize = marshalSize + 2; // _numberOfMineTypes + marshalSize = marshalSize + + _minefieldLocation.getMarshalledSize(); // _minefieldLocation + marshalSize = + marshalSize + + _minefieldOrientation.getMarshalledSize(); // _minefieldOrientation + marshalSize = marshalSize + 2; // _appearance + marshalSize = marshalSize + 2; // _protocolMode + + for (uint64_t idx = 0; idx < _perimeterPoints.size(); idx++) { + Point listElement = _perimeterPoints[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _mineType.size(); idx++) { + EntityType listElement = _mineType[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/MinefieldStatePdu.h b/src/dis6/minefield/MinefieldStatePdu.h new file mode 100644 index 00000000..f4325ff3 --- /dev/null +++ b/src/dis6/minefield/MinefieldStatePdu.h @@ -0,0 +1,143 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/EntityType.h" +#include "dis6/MinefieldFamilyPdu.h" +#include "dis6/Orientation.h" +#include "dis6/Point.h" +#include "dis6/Vector3Double.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.10.1 Abstract superclass for PDUs relating to minefields. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class MinefieldStatePdu : public MinefieldFamilyPdu { + protected: + /** Minefield ID */ + EntityID _minefieldID; + + /** Minefield sequence */ + uint16_t _minefieldSequence; + + /** force ID */ + uint8_t _forceID; + + /** Number of permieter points */ + uint8_t _numberOfPerimeterPoints; + + /** type of minefield */ + EntityType _minefieldType; + + /** how many mine types */ + uint16_t _numberOfMineTypes; + + /** location of minefield in world coords */ + Vector3Double _minefieldLocation; + + /** orientation of minefield */ + Orientation _minefieldOrientation; + + /** appearance bitflags */ + uint16_t _appearance; + + /** protocolMode */ + uint16_t _protocolMode; + + /** perimeter points for the minefield */ + std::vector _perimeterPoints; + + /** Type of mines */ + std::vector _mineType; + + public: + MinefieldStatePdu(); + virtual ~MinefieldStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getMinefieldID(); + const EntityID& getMinefieldID() const; + void setMinefieldID(const EntityID& pX); + + uint16_t getMinefieldSequence() const; + void setMinefieldSequence(uint16_t pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getNumberOfPerimeterPoints() const; + + EntityType& getMinefieldType(); + const EntityType& getMinefieldType() const; + void setMinefieldType(const EntityType& pX); + + uint16_t getNumberOfMineTypes() const; + + Vector3Double& getMinefieldLocation(); + const Vector3Double& getMinefieldLocation() const; + void setMinefieldLocation(const Vector3Double& pX); + + Orientation& getMinefieldOrientation(); + const Orientation& getMinefieldOrientation() const; + void setMinefieldOrientation(const Orientation& pX); + + uint16_t getAppearance() const; + void setAppearance(uint16_t pX); + + uint16_t getProtocolMode() const; + void setProtocolMode(uint16_t pX); + + std::vector& getPerimeterPoints(); + const std::vector& getPerimeterPoints() const; + void setPerimeterPoints(const std::vector& pX); + + std::vector& getMineType(); + const std::vector& getMineType() const; + void setMineType(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/minefield/Point.cpp b/src/dis6/minefield/Point.cpp new file mode 100644 index 00000000..da2fd596 --- /dev/null +++ b/src/dis6/minefield/Point.cpp @@ -0,0 +1,73 @@ +#include "dis6/Point.h" + +using namespace DIS; + +Point::Point() : _x(0.0), _y(0.0) {} + +Point::~Point() {} + +float Point::getX() const { return _x; } + +void Point::setX(float pX) { _x = pX; } + +float Point::getY() const { return _y; } + +void Point::setY(float pX) { _y = pX; } + +void Point::marshal(DataStream& dataStream) const { + dataStream << _x; + dataStream << _y; +} + +void Point::unmarshal(DataStream& dataStream) { + dataStream >> _x; + dataStream >> _y; +} + +bool Point::operator==(const Point& rhs) const { + bool ivarsEqual = true; + + if (!(_x == rhs._x)) ivarsEqual = false; + if (!(_y == rhs._y)) ivarsEqual = false; + + return ivarsEqual; +} + +int Point::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _x + marshalSize = marshalSize + 4; // _y + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/Point.h b/src/dis6/minefield/Point.h similarity index 78% rename from src/dis6/Point.h rename to src/dis6/minefield/Point.h index f6a19225..abccc65d 100644 --- a/src/dis6/Point.h +++ b/src/dis6/minefield/Point.h @@ -1,52 +1,48 @@ #pragma once -#include -#include +#include "dis6/utils/DataStream.h" -namespace DIS -{ +namespace DIS { // x,y point -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. // // @author DMcG, jkg -class OPENDIS6_EXPORT Point -{ -protected: +class Point { + protected: /** x */ - float _x; + float _x; /** y */ - float _y; - + float _y; public: - Point(); - virtual ~Point(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); + Point(); + virtual ~Point(); - float getX() const; - void setX(float pX); + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); - float getY() const; - void setY(float pX); + float getX() const; + void setX(float pX); + float getY() const; + void setY(float pX); -virtual int getMarshalledSize() const; + virtual int getMarshalledSize() const; - bool operator ==(const Point& rhs) const; + bool operator==(const Point& rhs) const; }; -} +} // namespace DIS // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright @@ -59,7 +55,7 @@ virtual int getMarshalledSize() const; // nor the names of its contributors may be used to endorse or // promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/src/dis6/radio_communications/AntennaLocation.cpp b/src/dis6/radio_communications/AntennaLocation.cpp new file mode 100644 index 00000000..a6d0e0fd --- /dev/null +++ b/src/dis6/radio_communications/AntennaLocation.cpp @@ -0,0 +1,94 @@ +#include "dis6/AntennaLocation.h" + +using namespace DIS; + +AntennaLocation::AntennaLocation() + : _antennaLocation(), _relativeAntennaLocation() {} + +AntennaLocation::~AntennaLocation() {} + +Vector3Double& AntennaLocation::getAntennaLocation() { + return _antennaLocation; +} + +const Vector3Double& AntennaLocation::getAntennaLocation() const { + return _antennaLocation; +} + +void AntennaLocation::setAntennaLocation(const Vector3Double& pX) { + _antennaLocation = pX; +} + +Vector3Float& AntennaLocation::getRelativeAntennaLocation() { + return _relativeAntennaLocation; +} + +const Vector3Float& AntennaLocation::getRelativeAntennaLocation() const { + return _relativeAntennaLocation; +} + +void AntennaLocation::setRelativeAntennaLocation(const Vector3Float& pX) { + _relativeAntennaLocation = pX; +} + +void AntennaLocation::marshal(DataStream& dataStream) const { + _antennaLocation.marshal(dataStream); + _relativeAntennaLocation.marshal(dataStream); +} + +void AntennaLocation::unmarshal(DataStream& dataStream) { + _antennaLocation.unmarshal(dataStream); + _relativeAntennaLocation.unmarshal(dataStream); +} + +bool AntennaLocation::operator==(const AntennaLocation& rhs) const { + bool ivarsEqual = true; + + if (!(_antennaLocation == rhs._antennaLocation)) ivarsEqual = false; + if (!(_relativeAntennaLocation == rhs._relativeAntennaLocation)) + ivarsEqual = false; + + return ivarsEqual; +} + +int AntennaLocation::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _antennaLocation.getMarshalledSize(); // _antennaLocation + marshalSize = + marshalSize + + _relativeAntennaLocation.getMarshalledSize(); // _relativeAntennaLocation + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/AntennaLocation.h b/src/dis6/radio_communications/AntennaLocation.h new file mode 100644 index 00000000..56e19a49 --- /dev/null +++ b/src/dis6/radio_communications/AntennaLocation.h @@ -0,0 +1,77 @@ +#pragma once + +#include "dis6/Vector3Double.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.2.3: location of the radiating portion of the antenna, specified in world +// coordinates and entity coordinates. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AntennaLocation { + protected: + /** Location of the radiating portion of the antenna in world coordinates + */ + Vector3Double _antennaLocation; + + /** Location of the radiating portion of the antenna in entity coordinates + */ + Vector3Float _relativeAntennaLocation; + + public: + AntennaLocation(); + virtual ~AntennaLocation(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + Vector3Double& getAntennaLocation(); + const Vector3Double& getAntennaLocation() const; + void setAntennaLocation(const Vector3Double& pX); + + Vector3Float& getRelativeAntennaLocation(); + const Vector3Float& getRelativeAntennaLocation() const; + void setRelativeAntennaLocation(const Vector3Float& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AntennaLocation& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/CMakeLists.txt b/src/dis6/radio_communications/CMakeLists.txt new file mode 100644 index 00000000..2ed89f0e --- /dev/null +++ b/src/dis6/radio_communications/CMakeLists.txt @@ -0,0 +1,37 @@ +set(radio_communications_src + AntennaLocation.cpp + IntercomCommunicationsParameters.cpp + IntercomControlPdu.cpp + IntercomSignalPdu.cpp + ModulationType.cpp + RadioCommunicationsFamilyPdu.cpp + RadioEntityType.cpp + ReceiverPdu.cpp + SignalPdu.cpp + TransmitterPdu.cpp +) + +set(radio_communications_hdr + AntennaLocation.h + IntercomCommunicationsParameters.h + IntercomControlPdu.h + IntercomSignalPdu.h + ModulationType.h + RadioCommunicationsFamilyPdu.h + RadioEntityType.h + ReceiverPdu.h + SignalPdu.h + TransmitterPdu.h +) + +list(TRANSFORM radio_communications_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND radio_communications_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${radio_communications_src}) + +install(FILES ${radio_communications_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/radio_communications +) diff --git a/src/dis6/radio_communications/IntercomCommunicationsParameters.cpp b/src/dis6/radio_communications/IntercomCommunicationsParameters.cpp new file mode 100644 index 00000000..9d451e69 --- /dev/null +++ b/src/dis6/radio_communications/IntercomCommunicationsParameters.cpp @@ -0,0 +1,95 @@ +#include "dis6/IntercomCommunicationsParameters.h" + +using namespace DIS; + +IntercomCommunicationsParameters::IntercomCommunicationsParameters() + : _recordType(0), _recordLength(0), _recordSpecificField(0) {} + +IntercomCommunicationsParameters::~IntercomCommunicationsParameters() {} + +uint16_t IntercomCommunicationsParameters::getRecordType() const { + return _recordType; +} + +void IntercomCommunicationsParameters::setRecordType(uint16_t pX) { + _recordType = pX; +} + +uint16_t IntercomCommunicationsParameters::getRecordLength() const { + return _recordLength; +} + +void IntercomCommunicationsParameters::setRecordLength(uint16_t pX) { + _recordLength = pX; +} + +uint32_t IntercomCommunicationsParameters::getRecordSpecificField() const { + return _recordSpecificField; +} + +void IntercomCommunicationsParameters::setRecordSpecificField(uint32_t pX) { + _recordSpecificField = pX; +} + +void IntercomCommunicationsParameters::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _recordSpecificField; +} + +void IntercomCommunicationsParameters::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _recordSpecificField; +} + +bool IntercomCommunicationsParameters::operator==( + const IntercomCommunicationsParameters& rhs) const { + auto ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_recordSpecificField == rhs._recordSpecificField)) ivarsEqual = false; + + return ivarsEqual; +} + +int IntercomCommunicationsParameters::getMarshalledSize() const { + auto marshalSize = 0; + + marshalSize = marshalSize + 2; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 4; // _recordSpecificField + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/IntercomCommunicationsParameters.h b/src/dis6/radio_communications/IntercomCommunicationsParameters.h new file mode 100644 index 00000000..caad8d1b --- /dev/null +++ b/src/dis6/radio_communications/IntercomCommunicationsParameters.h @@ -0,0 +1,77 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.2.46. Intercom communcations parameters + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class IntercomCommunicationsParameters { + protected: + /** Type of intercom parameters record */ + uint16_t _recordType; + + /** length of record */ + uint16_t _recordLength; + + /** Jerks. Looks like the committee is forcing a lookup of the record type + * parameter to find out how long the field is. This is a placeholder. */ + uint32_t _recordSpecificField; + + public: + IntercomCommunicationsParameters(); + virtual ~IntercomCommunicationsParameters(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getRecordType() const; + void setRecordType(uint16_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint32_t getRecordSpecificField() const; + void setRecordSpecificField(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IntercomCommunicationsParameters& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/IntercomControlPdu.cpp b/src/dis6/radio_communications/IntercomControlPdu.cpp new file mode 100644 index 00000000..96df7b3e --- /dev/null +++ b/src/dis6/radio_communications/IntercomControlPdu.cpp @@ -0,0 +1,246 @@ +#include "dis6/IntercomControlPdu.h" + +using namespace DIS; + +IntercomControlPdu::IntercomControlPdu() + : RadioCommunicationsFamilyPdu(), + _controlType(0), + _communicationsChannelType(0), + _sourceEntityID(), + _sourceCommunicationsDeviceID(0), + _sourceLineID(0), + _transmitPriority(0), + _transmitLineState(0), + _command(0), + _masterEntityID(), + _masterCommunicationsDeviceID(0), + _intercomParametersLength(0) { + setPduType(32); +} + +IntercomControlPdu::~IntercomControlPdu() { _intercomParameters.clear(); } + +uint8_t IntercomControlPdu::getControlType() const { + return _controlType; +} + +void IntercomControlPdu::setControlType(uint8_t pX) { _controlType = pX; } + +uint8_t IntercomControlPdu::getCommunicationsChannelType() const { + return _communicationsChannelType; +} + +void IntercomControlPdu::setCommunicationsChannelType(uint8_t pX) { + _communicationsChannelType = pX; +} + +EntityID& IntercomControlPdu::getSourceEntityID() { return _sourceEntityID; } + +const EntityID& IntercomControlPdu::getSourceEntityID() const { + return _sourceEntityID; +} + +void IntercomControlPdu::setSourceEntityID(const EntityID& pX) { + _sourceEntityID = pX; +} + +uint8_t IntercomControlPdu::getSourceCommunicationsDeviceID() const { + return _sourceCommunicationsDeviceID; +} + +void IntercomControlPdu::setSourceCommunicationsDeviceID(uint8_t pX) { + _sourceCommunicationsDeviceID = pX; +} + +uint8_t IntercomControlPdu::getSourceLineID() const { + return _sourceLineID; +} + +void IntercomControlPdu::setSourceLineID(uint8_t pX) { + _sourceLineID = pX; +} + +uint8_t IntercomControlPdu::getTransmitPriority() const { + return _transmitPriority; +} + +void IntercomControlPdu::setTransmitPriority(uint8_t pX) { + _transmitPriority = pX; +} + +uint8_t IntercomControlPdu::getTransmitLineState() const { + return _transmitLineState; +} + +void IntercomControlPdu::setTransmitLineState(uint8_t pX) { + _transmitLineState = pX; +} + +uint8_t IntercomControlPdu::getCommand() const { return _command; } + +void IntercomControlPdu::setCommand(uint8_t pX) { _command = pX; } + +EntityID& IntercomControlPdu::getMasterEntityID() { return _masterEntityID; } + +const EntityID& IntercomControlPdu::getMasterEntityID() const { + return _masterEntityID; +} + +void IntercomControlPdu::setMasterEntityID(const EntityID& pX) { + _masterEntityID = pX; +} + +uint16_t IntercomControlPdu::getMasterCommunicationsDeviceID() const { + return _masterCommunicationsDeviceID; +} + +void IntercomControlPdu::setMasterCommunicationsDeviceID(uint16_t pX) { + _masterCommunicationsDeviceID = pX; +} + +uint32_t IntercomControlPdu::getIntercomParametersLength() const { + return _intercomParameters.size(); +} + +std::vector& +IntercomControlPdu::getIntercomParameters() { + return _intercomParameters; +} + +const std::vector& +IntercomControlPdu::getIntercomParameters() const { + return _intercomParameters; +} + +void IntercomControlPdu::setIntercomParameters( + const std::vector& pX) { + _intercomParameters = pX; +} + +void IntercomControlPdu::marshal(DataStream& dataStream) const { + RadioCommunicationsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _controlType; + dataStream << _communicationsChannelType; + _sourceEntityID.marshal(dataStream); + dataStream << _sourceCommunicationsDeviceID; + dataStream << _sourceLineID; + dataStream << _transmitPriority; + dataStream << _transmitLineState; + dataStream << _command; + _masterEntityID.marshal(dataStream); + dataStream << _masterCommunicationsDeviceID; + dataStream << (uint32_t)_intercomParameters.size(); + + for (size_t idx = 0; idx < _intercomParameters.size(); idx++) { + IntercomCommunicationsParameters x = _intercomParameters[idx]; + x.marshal(dataStream); + } +} + +void IntercomControlPdu::unmarshal(DataStream& dataStream) { + RadioCommunicationsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _controlType; + dataStream >> _communicationsChannelType; + _sourceEntityID.unmarshal(dataStream); + dataStream >> _sourceCommunicationsDeviceID; + dataStream >> _sourceLineID; + dataStream >> _transmitPriority; + dataStream >> _transmitLineState; + dataStream >> _command; + _masterEntityID.unmarshal(dataStream); + dataStream >> _masterCommunicationsDeviceID; + dataStream >> _intercomParametersLength; + + _intercomParameters.clear(); + for (size_t idx = 0; idx < _intercomParametersLength; idx++) { + IntercomCommunicationsParameters x; + x.unmarshal(dataStream); + _intercomParameters.push_back(x); + } +} + +bool IntercomControlPdu::operator==(const IntercomControlPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); + + if (!(_controlType == rhs._controlType)) ivarsEqual = false; + if (!(_communicationsChannelType == rhs._communicationsChannelType)) + ivarsEqual = false; + if (!(_sourceEntityID == rhs._sourceEntityID)) ivarsEqual = false; + if (!(_sourceCommunicationsDeviceID == rhs._sourceCommunicationsDeviceID)) + ivarsEqual = false; + if (!(_sourceLineID == rhs._sourceLineID)) ivarsEqual = false; + if (!(_transmitPriority == rhs._transmitPriority)) ivarsEqual = false; + if (!(_transmitLineState == rhs._transmitLineState)) ivarsEqual = false; + if (!(_command == rhs._command)) ivarsEqual = false; + if (!(_masterEntityID == rhs._masterEntityID)) ivarsEqual = false; + if (!(_masterCommunicationsDeviceID == rhs._masterCommunicationsDeviceID)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _intercomParameters.size(); idx++) { + if (!(_intercomParameters[idx] == rhs._intercomParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int IntercomControlPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _controlType + marshalSize = marshalSize + 1; // _communicationsChannelType + marshalSize = + marshalSize + _sourceEntityID.getMarshalledSize(); // _sourceEntityID + marshalSize = marshalSize + 1; // _sourceCommunicationsDeviceID + marshalSize = marshalSize + 1; // _sourceLineID + marshalSize = marshalSize + 1; // _transmitPriority + marshalSize = marshalSize + 1; // _transmitLineState + marshalSize = marshalSize + 1; // _command + marshalSize = + marshalSize + _masterEntityID.getMarshalledSize(); // _masterEntityID + marshalSize = marshalSize + 2; // _masterCommunicationsDeviceID + marshalSize = marshalSize + 4; // _intercomParametersLength + + for (uint64_t idx = 0; idx < _intercomParameters.size(); idx++) { + IntercomCommunicationsParameters listElement = _intercomParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/IntercomControlPdu.h b/src/dis6/radio_communications/IntercomControlPdu.h new file mode 100644 index 00000000..44f9030e --- /dev/null +++ b/src/dis6/radio_communications/IntercomControlPdu.h @@ -0,0 +1,144 @@ +#pragma once + +#include + +#include "dis6/EntityID.h" +#include "dis6/IntercomCommunicationsParameters.h" +#include "dis6/RadioCommunicationsFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.8.5. Detailed inofrmation about the state of an intercom device +// and the actions it is requestion of another intercom device, or the +// response to a requested action. Required manual intervention to fix the +// intercom parameters, which can be of varialbe length. UNFINSISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class IntercomControlPdu : public RadioCommunicationsFamilyPdu { + protected: + /** control type */ + uint8_t _controlType; + + /** control type */ + uint8_t _communicationsChannelType; + + /** Source entity ID */ + EntityID _sourceEntityID; + + /** The specific intercom device being simulated within an entity. */ + uint8_t _sourceCommunicationsDeviceID; + + /** Line number to which the intercom control refers */ + uint8_t _sourceLineID; + + /** priority of this message relative to transmissons from other intercom + * devices */ + uint8_t _transmitPriority; + + /** current transmit state of the line */ + uint8_t _transmitLineState; + + /** detailed type requested. */ + uint8_t _command; + + /** eid of the entity that has created this intercom channel. */ + EntityID _masterEntityID; + + /** specific intercom device that has created this intercom channel */ + uint16_t _masterCommunicationsDeviceID; + + /** number of intercom parameters */ + uint32_t _intercomParametersLength; + + /** ^^^This is wrong--the length of the data field is variable. Using a long + * for now. */ + std::vector _intercomParameters; + + public: + IntercomControlPdu(); + virtual ~IntercomControlPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getControlType() const; + void setControlType(uint8_t pX); + + uint8_t getCommunicationsChannelType() const; + void setCommunicationsChannelType(uint8_t pX); + + EntityID& getSourceEntityID(); + const EntityID& getSourceEntityID() const; + void setSourceEntityID(const EntityID& pX); + + uint8_t getSourceCommunicationsDeviceID() const; + void setSourceCommunicationsDeviceID(uint8_t pX); + + uint8_t getSourceLineID() const; + void setSourceLineID(uint8_t pX); + + uint8_t getTransmitPriority() const; + void setTransmitPriority(uint8_t pX); + + uint8_t getTransmitLineState() const; + void setTransmitLineState(uint8_t pX); + + uint8_t getCommand() const; + void setCommand(uint8_t pX); + + EntityID& getMasterEntityID(); + const EntityID& getMasterEntityID() const; + void setMasterEntityID(const EntityID& pX); + + uint16_t getMasterCommunicationsDeviceID() const; + void setMasterCommunicationsDeviceID(uint16_t pX); + + uint32_t getIntercomParametersLength() const; + + std::vector& getIntercomParameters(); + const std::vector& getIntercomParameters() + const; + void setIntercomParameters( + const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IntercomControlPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/IntercomSignalPdu.cpp b/src/dis6/radio_communications/IntercomSignalPdu.cpp new file mode 100644 index 00000000..ae13fe61 --- /dev/null +++ b/src/dis6/radio_communications/IntercomSignalPdu.cpp @@ -0,0 +1,159 @@ +#include "dis6/IntercomSignalPdu.h" + +using namespace DIS; + +IntercomSignalPdu::IntercomSignalPdu() + : RadioCommunicationsFamilyPdu(), + _entityID(), + _communicationsDeviceID(0), + _encodingScheme(0), + _tdlType(0), + _sampleRate(0), + _dataLength(0), + _samples(0) { + setPduType(31); +} + +IntercomSignalPdu::~IntercomSignalPdu() { _data.clear(); } + +EntityID& IntercomSignalPdu::getEntityID() { return _entityID; } + +const EntityID& IntercomSignalPdu::getEntityID() const { return _entityID; } + +void IntercomSignalPdu::setEntityID(const EntityID& pX) { _entityID = pX; } + +uint16_t IntercomSignalPdu::getCommunicationsDeviceID() const { + return _communicationsDeviceID; +} + +void IntercomSignalPdu::setCommunicationsDeviceID(uint16_t pX) { + _communicationsDeviceID = pX; +} + +uint16_t IntercomSignalPdu::getEncodingScheme() const { + return _encodingScheme; +} + +void IntercomSignalPdu::setEncodingScheme(uint16_t pX) { + _encodingScheme = pX; +} + +uint16_t IntercomSignalPdu::getTdlType() const { return _tdlType; } + +void IntercomSignalPdu::setTdlType(uint16_t pX) { _tdlType = pX; } + +uint32_t IntercomSignalPdu::getSampleRate() const { return _sampleRate; } + +void IntercomSignalPdu::setSampleRate(uint32_t pX) { _sampleRate = pX; } + +uint16_t IntercomSignalPdu::getDataLength() const { return _data.size(); } + +uint16_t IntercomSignalPdu::getSamples() const { return _samples; } + +void IntercomSignalPdu::setSamples(uint16_t pX) { _samples = pX; } + +std::vector& IntercomSignalPdu::getData() { return _data; } + +const std::vector& IntercomSignalPdu::getData() const { return _data; } + +void IntercomSignalPdu::setData(const std::vector& pX) { _data = pX; } + +void IntercomSignalPdu::marshal(DataStream& dataStream) const { + RadioCommunicationsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _entityID.marshal(dataStream); + dataStream << _communicationsDeviceID; + dataStream << _encodingScheme; + dataStream << _tdlType; + dataStream << _sampleRate; + dataStream << (uint16_t)_data.size(); + dataStream << _samples; + + for (auto& byte : _data) { + dataStream << byte; + } +} + +void IntercomSignalPdu::unmarshal(DataStream& dataStream) { + RadioCommunicationsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _entityID.unmarshal(dataStream); + dataStream >> _communicationsDeviceID; + dataStream >> _encodingScheme; + dataStream >> _tdlType; + dataStream >> _sampleRate; + dataStream >> _dataLength; + dataStream >> _samples; + + _data.clear(); + for (auto idx = 0; idx < _dataLength; idx++) { + uint8_t x; + dataStream >> x; + _data.push_back(x); + } +} + +bool IntercomSignalPdu::operator==(const IntercomSignalPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); + + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_communicationsDeviceID == rhs._communicationsDeviceID)) + ivarsEqual = false; + if (!(_encodingScheme == rhs._encodingScheme)) ivarsEqual = false; + if (!(_tdlType == rhs._tdlType)) ivarsEqual = false; + if (!(_sampleRate == rhs._sampleRate)) ivarsEqual = false; + if (!(_samples == rhs._samples)) ivarsEqual = false; + + ivarsEqual = (_data == rhs._data); + + return ivarsEqual; +} + +int IntercomSignalPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); + marshalSize += _entityID.getMarshalledSize(); // _entityID + marshalSize += 2; // _communicationsDeviceID + marshalSize += 2; // _encodingScheme + marshalSize += 2; // _tdlType + marshalSize += 4; // _sampleRate + marshalSize += 2; // _dataLength + marshalSize += 2; // _samples + marshalSize += _data.size(); + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/IntercomSignalPdu.h b/src/dis6/radio_communications/IntercomSignalPdu.h new file mode 100644 index 00000000..fc389501 --- /dev/null +++ b/src/dis6/radio_communications/IntercomSignalPdu.h @@ -0,0 +1,112 @@ +#pragma once + +#include +#include + +#include "dis6/EntityID.h" +#include "dis6/RadioCommunicationsFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.8.4. Actual transmission of intercome voice data. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class IntercomSignalPdu : public RadioCommunicationsFamilyPdu { + protected: + /** entity ID */ + EntityID _entityID; + + /** ID of communications device */ + uint16_t _communicationsDeviceID; + + /** encoding scheme */ + uint16_t _encodingScheme; + + /** tactical data link type */ + uint16_t _tdlType; + + /** sample rate */ + uint32_t _sampleRate; + + /** data length */ + uint16_t _dataLength; + + /** samples */ + uint16_t _samples; + + /** data bytes */ + std::vector _data; + + public: + IntercomSignalPdu(); + virtual ~IntercomSignalPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + uint16_t getCommunicationsDeviceID() const; + void setCommunicationsDeviceID(uint16_t pX); + + uint16_t getEncodingScheme() const; + void setEncodingScheme(uint16_t pX); + + uint16_t getTdlType() const; + void setTdlType(uint16_t pX); + + uint32_t getSampleRate() const; + void setSampleRate(uint32_t pX); + + uint16_t getDataLength() const; + + uint16_t getSamples() const; + void setSamples(uint16_t pX); + + std::vector& getData(); + const std::vector& getData() const; + void setData(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IntercomSignalPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/ModulationType.cpp b/src/dis6/radio_communications/ModulationType.cpp new file mode 100644 index 00000000..9820735f --- /dev/null +++ b/src/dis6/radio_communications/ModulationType.cpp @@ -0,0 +1,94 @@ +#include "dis6/ModulationType.h" + +using namespace DIS; + +ModulationType::ModulationType() + : _spreadSpectrum(0), _major(0), _detail(0), _system(0) {} + +ModulationType::~ModulationType() {} + +uint16_t ModulationType::getSpreadSpectrum() const { + return _spreadSpectrum; +} + +void ModulationType::setSpreadSpectrum(uint16_t pX) { + _spreadSpectrum = pX; +} + +uint16_t ModulationType::getMajor() const { return _major; } + +void ModulationType::setMajor(uint16_t pX) { _major = pX; } + +uint16_t ModulationType::getDetail() const { return _detail; } + +void ModulationType::setDetail(uint16_t pX) { _detail = pX; } + +uint16_t ModulationType::getSystem() const { return _system; } + +void ModulationType::setSystem(uint16_t pX) { _system = pX; } + +void ModulationType::marshal(DataStream& dataStream) const { + dataStream << _spreadSpectrum; + dataStream << _major; + dataStream << _detail; + dataStream << _system; +} + +void ModulationType::unmarshal(DataStream& dataStream) { + dataStream >> _spreadSpectrum; + dataStream >> _major; + dataStream >> _detail; + dataStream >> _system; +} + +bool ModulationType::operator==(const ModulationType& rhs) const { + bool ivarsEqual = true; + + if (!(_spreadSpectrum == rhs._spreadSpectrum)) ivarsEqual = false; + if (!(_major == rhs._major)) ivarsEqual = false; + if (!(_detail == rhs._detail)) ivarsEqual = false; + if (!(_system == rhs._system)) ivarsEqual = false; + + return ivarsEqual; +} + +int ModulationType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _spreadSpectrum + marshalSize = marshalSize + 2; // _major + marshalSize = marshalSize + 2; // _detail + marshalSize = marshalSize + 2; // _system + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/ModulationType.h b/src/dis6/radio_communications/ModulationType.h new file mode 100644 index 00000000..5e6458cd --- /dev/null +++ b/src/dis6/radio_communications/ModulationType.h @@ -0,0 +1,82 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Radio modulation + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ModulationType { + protected: + /** spread spectrum, 16 bit boolean array */ + uint16_t _spreadSpectrum; + + /** major */ + uint16_t _major; + + /** detail */ + uint16_t _detail; + + /** system */ + uint16_t _system; + + public: + ModulationType(); + virtual ~ModulationType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSpreadSpectrum() const; + void setSpreadSpectrum(uint16_t pX); + + uint16_t getMajor() const; + void setMajor(uint16_t pX); + + uint16_t getDetail() const; + void setDetail(uint16_t pX); + + uint16_t getSystem() const; + void setSystem(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ModulationType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/RadioCommunicationsFamilyPdu.cpp b/src/dis6/radio_communications/RadioCommunicationsFamilyPdu.cpp new file mode 100644 index 00000000..e1bc7f75 --- /dev/null +++ b/src/dis6/radio_communications/RadioCommunicationsFamilyPdu.cpp @@ -0,0 +1,92 @@ +#include "dis6/RadioCommunicationsFamilyPdu.h" + +using namespace DIS; + +RadioCommunicationsFamilyPdu::RadioCommunicationsFamilyPdu() + : Pdu(), _entityId(), _radioId(0) { + setProtocolFamily(4); +} + +RadioCommunicationsFamilyPdu::~RadioCommunicationsFamilyPdu() {} + +EntityID& RadioCommunicationsFamilyPdu::getEntityId() { return _entityId; } + +const EntityID& RadioCommunicationsFamilyPdu::getEntityId() const { + return _entityId; +} + +void RadioCommunicationsFamilyPdu::setEntityId(const EntityID& pX) { + _entityId = pX; +} + +uint16_t RadioCommunicationsFamilyPdu::getRadioId() const { + return _radioId; +} + +void RadioCommunicationsFamilyPdu::setRadioId(uint16_t pX) { + _radioId = pX; +} + +void RadioCommunicationsFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first + _entityId.marshal(dataStream); + dataStream << _radioId; +} + +void RadioCommunicationsFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first + _entityId.unmarshal(dataStream); + dataStream >> _radioId; +} + +bool RadioCommunicationsFamilyPdu::operator==( + const RadioCommunicationsFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + if (!(_entityId == rhs._entityId)) ivarsEqual = false; + if (!(_radioId == rhs._radioId)) ivarsEqual = false; + + return ivarsEqual; +} + +int RadioCommunicationsFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + marshalSize = marshalSize + _entityId.getMarshalledSize(); // _entityId + marshalSize = marshalSize + 2; // _radioId + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/RadioCommunicationsFamilyPdu.h b/src/dis6/radio_communications/RadioCommunicationsFamilyPdu.h new file mode 100644 index 00000000..09935d35 --- /dev/null +++ b/src/dis6/radio_communications/RadioCommunicationsFamilyPdu.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/Pdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.8. Abstract superclass for radio communications PDUs. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class RadioCommunicationsFamilyPdu : public Pdu { + protected: + /** ID of the entitythat is the source of the communication */ + EntityID _entityId; + + /** particular radio within an entity */ + uint16_t _radioId; + + public: + RadioCommunicationsFamilyPdu(); + virtual ~RadioCommunicationsFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityId(); + const EntityID& getEntityId() const; + void setEntityId(const EntityID& pX); + + uint16_t getRadioId() const; + void setRadioId(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RadioCommunicationsFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/RadioEntityType.cpp b/src/dis6/radio_communications/RadioEntityType.cpp new file mode 100644 index 00000000..a1271a29 --- /dev/null +++ b/src/dis6/radio_communications/RadioEntityType.cpp @@ -0,0 +1,117 @@ +#include "dis6/RadioEntityType.h" + +using namespace DIS; + +RadioEntityType::RadioEntityType() + : _entityKind(0), + _domain(0), + _country(0), + _category(0), + _nomenclatureVersion(0), + _nomenclature(0) {} + +RadioEntityType::~RadioEntityType() {} + +uint8_t RadioEntityType::getEntityKind() const { return _entityKind; } + +void RadioEntityType::setEntityKind(uint8_t pX) { _entityKind = pX; } + +uint8_t RadioEntityType::getDomain() const { return _domain; } + +void RadioEntityType::setDomain(uint8_t pX) { _domain = pX; } + +uint16_t RadioEntityType::getCountry() const { return _country; } + +void RadioEntityType::setCountry(uint16_t pX) { _country = pX; } + +uint8_t RadioEntityType::getCategory() const { return _category; } + +void RadioEntityType::setCategory(uint8_t pX) { _category = pX; } + +uint8_t RadioEntityType::getNomenclatureVersion() const { + return _nomenclatureVersion; +} + +void RadioEntityType::setNomenclatureVersion(uint8_t pX) { + _nomenclatureVersion = pX; +} + +uint16_t RadioEntityType::getNomenclature() const { + return _nomenclature; +} + +void RadioEntityType::setNomenclature(uint16_t pX) { _nomenclature = pX; } + +void RadioEntityType::marshal(DataStream& dataStream) const { + dataStream << _entityKind; + dataStream << _domain; + dataStream << _country; + dataStream << _category; + dataStream << _nomenclatureVersion; + dataStream << _nomenclature; +} + +void RadioEntityType::unmarshal(DataStream& dataStream) { + dataStream >> _entityKind; + dataStream >> _domain; + dataStream >> _country; + dataStream >> _category; + dataStream >> _nomenclatureVersion; + dataStream >> _nomenclature; +} + +bool RadioEntityType::operator==(const RadioEntityType& rhs) const { + bool ivarsEqual = true; + + if (!(_entityKind == rhs._entityKind)) ivarsEqual = false; + if (!(_domain == rhs._domain)) ivarsEqual = false; + if (!(_country == rhs._country)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_nomenclatureVersion == rhs._nomenclatureVersion)) ivarsEqual = false; + if (!(_nomenclature == rhs._nomenclature)) ivarsEqual = false; + + return ivarsEqual; +} + +int RadioEntityType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _entityKind + marshalSize = marshalSize + 1; // _domain + marshalSize = marshalSize + 2; // _country + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _nomenclatureVersion + marshalSize = marshalSize + 2; // _nomenclature + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/RadioEntityType.h b/src/dis6/radio_communications/RadioEntityType.h new file mode 100644 index 00000000..cba282c9 --- /dev/null +++ b/src/dis6/radio_communications/RadioEntityType.h @@ -0,0 +1,93 @@ +#pragma once + + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.25. Identifies the type of radio + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class RadioEntityType { + protected: + /** Kind of entity */ + uint8_t _entityKind; + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _domain; + + /** country to which the design of the entity is attributed */ + uint16_t _country; + + /** category of entity */ + uint8_t _category; + + /** specific info based on subcategory field */ + uint8_t _nomenclatureVersion; + + uint16_t _nomenclature; + + public: + RadioEntityType(); + virtual ~RadioEntityType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getEntityKind() const; + void setEntityKind(uint8_t pX); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint16_t getCountry() const; + void setCountry(uint16_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getNomenclatureVersion() const; + void setNomenclatureVersion(uint8_t pX); + + uint16_t getNomenclature() const; + void setNomenclature(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RadioEntityType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/ReceiverPdu.cpp b/src/dis6/radio_communications/ReceiverPdu.cpp new file mode 100644 index 00000000..245e9617 --- /dev/null +++ b/src/dis6/radio_communications/ReceiverPdu.cpp @@ -0,0 +1,124 @@ +#include "dis6/ReceiverPdu.h" + +using namespace DIS; + +ReceiverPdu::ReceiverPdu() + : RadioCommunicationsFamilyPdu(), + _receiverState(0), + _padding1(0), + _receivedPower(0.0), + _transmitterEntityId(), + _transmitterRadioId(0) { + setPduType(27); +} + +ReceiverPdu::~ReceiverPdu() {} + +uint16_t ReceiverPdu::getReceiverState() const { return _receiverState; } + +void ReceiverPdu::setReceiverState(uint16_t pX) { _receiverState = pX; } + +uint16_t ReceiverPdu::getPadding1() const { return _padding1; } + +void ReceiverPdu::setPadding1(uint16_t pX) { _padding1 = pX; } + +float ReceiverPdu::getReceivedPower() const { return _receivedPower; } + +void ReceiverPdu::setReceivedPower(float pX) { _receivedPower = pX; } + +EntityID& ReceiverPdu::getTransmitterEntityId() { return _transmitterEntityId; } + +const EntityID& ReceiverPdu::getTransmitterEntityId() const { + return _transmitterEntityId; +} + +void ReceiverPdu::setTransmitterEntityId(const EntityID& pX) { + _transmitterEntityId = pX; +} + +uint16_t ReceiverPdu::getTransmitterRadioId() const { + return _transmitterRadioId; +} + +void ReceiverPdu::setTransmitterRadioId(uint16_t pX) { + _transmitterRadioId = pX; +} + +void ReceiverPdu::marshal(DataStream& dataStream) const { + RadioCommunicationsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _receiverState; + dataStream << _padding1; + dataStream << _receivedPower; + _transmitterEntityId.marshal(dataStream); + dataStream << _transmitterRadioId; +} + +void ReceiverPdu::unmarshal(DataStream& dataStream) { + RadioCommunicationsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _receiverState; + dataStream >> _padding1; + dataStream >> _receivedPower; + _transmitterEntityId.unmarshal(dataStream); + dataStream >> _transmitterRadioId; +} + +bool ReceiverPdu::operator==(const ReceiverPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); + + if (!(_receiverState == rhs._receiverState)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_receivedPower == rhs._receivedPower)) ivarsEqual = false; + if (!(_transmitterEntityId == rhs._transmitterEntityId)) ivarsEqual = false; + if (!(_transmitterRadioId == rhs._transmitterRadioId)) ivarsEqual = false; + + return ivarsEqual; +} + +int ReceiverPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 2; // _receiverState + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 4; // _receivedPoser + marshalSize = + marshalSize + + _transmitterEntityId.getMarshalledSize(); // _transmitterEntityId + marshalSize = marshalSize + 2; // _transmitterRadioId + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/ReceiverPdu.h b/src/dis6/radio_communications/ReceiverPdu.h new file mode 100644 index 00000000..ef81deb8 --- /dev/null +++ b/src/dis6/radio_communications/ReceiverPdu.h @@ -0,0 +1,91 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/RadioCommunicationsFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.8.3. Communication of a receiver state. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ReceiverPdu : public RadioCommunicationsFamilyPdu { + protected: + /** encoding scheme used, and enumeration */ + uint16_t _receiverState; + + /** padding */ + uint16_t _padding1; + + /** received power */ + float _receivedPower; + + /** ID of transmitter */ + EntityID _transmitterEntityId; + + /** ID of transmitting radio */ + uint16_t _transmitterRadioId; + + public: + ReceiverPdu(); + virtual ~ReceiverPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getReceiverState() const; + void setReceiverState(uint16_t pX); + + uint16_t getPadding1() const; + void setPadding1(uint16_t pX); + + float getReceivedPower() const; + void setReceivedPower(float pX); + + EntityID& getTransmitterEntityId(); + const EntityID& getTransmitterEntityId() const; + void setTransmitterEntityId(const EntityID& pX); + + uint16_t getTransmitterRadioId() const; + void setTransmitterRadioId(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ReceiverPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/SignalPdu.cpp b/src/dis6/radio_communications/SignalPdu.cpp new file mode 100644 index 00000000..b8e21b68 --- /dev/null +++ b/src/dis6/radio_communications/SignalPdu.cpp @@ -0,0 +1,125 @@ +#include "dis6/SignalPdu.h" + +using namespace DIS; + +SignalPdu::SignalPdu() + : RadioCommunicationsFamilyPdu(), + _encodingScheme(0), + _tdlType(0), + _sampleRate(0), + _dataLength(0), + _samples(0) { + setPduType(26); +} + +SignalPdu::~SignalPdu() { _data.clear(); } + +uint16_t SignalPdu::getEncodingScheme() const { return _encodingScheme; } + +void SignalPdu::setEncodingScheme(uint16_t pX) { _encodingScheme = pX; } + +uint16_t SignalPdu::getTdlType() const { return _tdlType; } + +void SignalPdu::setTdlType(uint16_t pX) { _tdlType = pX; } + +uint32_t SignalPdu::getSampleRate() const { return _sampleRate; } + +void SignalPdu::setSampleRate(uint32_t pX) { _sampleRate = pX; } + +int16_t SignalPdu::getDataLength() const { return _data.size(); } + +int16_t SignalPdu::getSamples() const { return _samples; } + +void SignalPdu::setSamples(int16_t pX) { _samples = pX; } + +std::vector& SignalPdu::getData() { return _data; } + +const std::vector& SignalPdu::getData() const { return _data; } + +void SignalPdu::setData(const std::vector& pX) { _data = pX; } + +void SignalPdu::marshal(DataStream& dataStream) const { + RadioCommunicationsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _encodingScheme; + dataStream << _tdlType; + dataStream << _sampleRate; + dataStream << (int16_t)_data.size(); + dataStream << _samples; + for (auto byte : _data) { + dataStream << byte; + } +} + +void SignalPdu::unmarshal(DataStream& dataStream) { + RadioCommunicationsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _encodingScheme; + dataStream >> _tdlType; + dataStream >> _sampleRate; + dataStream >> _dataLength; + dataStream >> _samples; + + _data.clear(); + for (auto idx = 0; idx < _dataLength; ++idx) { + uint8_t x; + dataStream >> x; + _data.push_back(x); + } +} + +bool SignalPdu::operator==(const SignalPdu& rhs) const { + auto ivarsEqual = true; + + ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs) && + _encodingScheme == rhs._encodingScheme && + _tdlType == rhs._tdlType && _sampleRate == rhs._sampleRate && + _samples == rhs._samples && _data == rhs._data; + + return ivarsEqual; +} + +int SignalPdu::getMarshalledSize() const { + auto marshalSize = 0; + + marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); + marshalSize += 2; // _encodingScheme + marshalSize += 2; // _tdlType + marshalSize += 4; // _sampleRate + marshalSize += 2; // _dataLength + marshalSize += 2; // _samples + marshalSize += _data.size(); + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/SignalPdu.h b/src/dis6/radio_communications/SignalPdu.h new file mode 100644 index 00000000..0e93430c --- /dev/null +++ b/src/dis6/radio_communications/SignalPdu.h @@ -0,0 +1,101 @@ +#pragma once + +#include +#include + +#include "dis6/RadioCommunicationsFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.8.2. Detailed information about a radio transmitter. This PDU +// requires manually written code to complete. The encodingScheme field +// can be used in multiple ways, which requires hand-written code to +// finish. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SignalPdu : public RadioCommunicationsFamilyPdu { + protected: + /** encoding scheme used, and enumeration */ + uint16_t _encodingScheme; + + /** tdl type */ + uint16_t _tdlType; + + /** sample rate */ + uint32_t _sampleRate; + + /** length od data */ + int16_t _dataLength; + + /** number of samples */ + int16_t _samples; + + /** list of eight bit values */ + std::vector _data; + + public: + SignalPdu(); + virtual ~SignalPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getEncodingScheme() const; + void setEncodingScheme(uint16_t pX); + + uint16_t getTdlType() const; + void setTdlType(uint16_t pX); + + uint32_t getSampleRate() const; + void setSampleRate(uint32_t pX); + + int16_t getDataLength() const; + + int16_t getSamples() const; + void setSamples(int16_t pX); + + std::vector& getData(); + const std::vector& getData() const; + void setData(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SignalPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/TransmitterPdu.cpp b/src/dis6/radio_communications/TransmitterPdu.cpp new file mode 100644 index 00000000..09566a17 --- /dev/null +++ b/src/dis6/radio_communications/TransmitterPdu.cpp @@ -0,0 +1,339 @@ +#include "dis6/TransmitterPdu.h" + +using namespace DIS; + +TransmitterPdu::TransmitterPdu() + : RadioCommunicationsFamilyPdu(), + _radioEntityType(), + _transmitState(0), + _inputSource(0), + _padding1(0), + _antennaLocation(), + _relativeAntennaLocation(), + _antennaPatternType(0), + _antennaPatternCount(0), + _frequency(0), + _transmitFrequencyBandwidth(0.0), + _power(0.0), + _modulationType(), + _cryptoSystem(0), + _cryptoKeyId(0), + _modulationParameterCount(0), + _padding2(0), + _padding3(0) { + setPduType(25); +} + +TransmitterPdu::~TransmitterPdu() { + _modulationParametersList.clear(); + _antennaPatternList.clear(); +} + +RadioEntityType& TransmitterPdu::getRadioEntityType() { + return _radioEntityType; +} + +const RadioEntityType& TransmitterPdu::getRadioEntityType() const { + return _radioEntityType; +} + +void TransmitterPdu::setRadioEntityType(const RadioEntityType& pX) { + _radioEntityType = pX; +} + +uint8_t TransmitterPdu::getTransmitState() const { + return _transmitState; +} + +void TransmitterPdu::setTransmitState(uint8_t pX) { _transmitState = pX; } + +uint8_t TransmitterPdu::getInputSource() const { return _inputSource; } + +void TransmitterPdu::setInputSource(uint8_t pX) { _inputSource = pX; } + +uint16_t TransmitterPdu::getPadding1() const { return _padding1; } + +void TransmitterPdu::setPadding1(uint16_t pX) { _padding1 = pX; } + +Vector3Double& TransmitterPdu::getAntennaLocation() { return _antennaLocation; } + +const Vector3Double& TransmitterPdu::getAntennaLocation() const { + return _antennaLocation; +} + +void TransmitterPdu::setAntennaLocation(const Vector3Double& pX) { + _antennaLocation = pX; +} + +Vector3Float& TransmitterPdu::getRelativeAntennaLocation() { + return _relativeAntennaLocation; +} + +const Vector3Float& TransmitterPdu::getRelativeAntennaLocation() const { + return _relativeAntennaLocation; +} + +void TransmitterPdu::setRelativeAntennaLocation(const Vector3Float& pX) { + _relativeAntennaLocation = pX; +} + +uint16_t TransmitterPdu::getAntennaPatternType() const { + return _antennaPatternType; +} + +void TransmitterPdu::setAntennaPatternType(uint16_t pX) { + _antennaPatternType = pX; +} + +uint16_t TransmitterPdu::getAntennaPatternCount() const { + return _antennaPatternList.size(); +} + +uint64_t TransmitterPdu::getFrequency() const { return _frequency; } + +void TransmitterPdu::setFrequency(uint64_t pX) { _frequency = pX; } + +float TransmitterPdu::getTransmitFrequencyBandwidth() const { + return _transmitFrequencyBandwidth; +} + +void TransmitterPdu::setTransmitFrequencyBandwidth(float pX) { + _transmitFrequencyBandwidth = pX; +} + +float TransmitterPdu::getPower() const { return _power; } + +void TransmitterPdu::setPower(float pX) { _power = pX; } + +ModulationType& TransmitterPdu::getModulationType() { return _modulationType; } + +const ModulationType& TransmitterPdu::getModulationType() const { + return _modulationType; +} + +void TransmitterPdu::setModulationType(const ModulationType& pX) { + _modulationType = pX; +} + +uint16_t TransmitterPdu::getCryptoSystem() const { return _cryptoSystem; } + +void TransmitterPdu::setCryptoSystem(uint16_t pX) { _cryptoSystem = pX; } + +uint16_t TransmitterPdu::getCryptoKeyId() const { return _cryptoKeyId; } + +void TransmitterPdu::setCryptoKeyId(uint16_t pX) { _cryptoKeyId = pX; } + +uint8_t TransmitterPdu::getModulationParameterCount() const { + return _modulationParametersList.size(); +} + +uint16_t TransmitterPdu::getPadding2() const { return _padding2; } + +void TransmitterPdu::setPadding2(uint16_t pX) { _padding2 = pX; } + +uint8_t TransmitterPdu::getPadding3() const { return _padding3; } + +void TransmitterPdu::setPadding3(uint8_t pX) { _padding3 = pX; } + +std::vector& TransmitterPdu::getModulationParametersList() { + return _modulationParametersList; +} + +const std::vector& TransmitterPdu::getModulationParametersList() + const { + return _modulationParametersList; +} + +void TransmitterPdu::setModulationParametersList( + const std::vector& pX) { + _modulationParametersList = pX; +} + +std::vector& TransmitterPdu::getAntennaPatternList() { + return _antennaPatternList; +} + +const std::vector& TransmitterPdu::getAntennaPatternList() const { + return _antennaPatternList; +} + +void TransmitterPdu::setAntennaPatternList( + const std::vector& pX) { + _antennaPatternList = pX; +} + +void TransmitterPdu::marshal(DataStream& dataStream) const { + RadioCommunicationsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _radioEntityType.marshal(dataStream); + dataStream << _transmitState; + dataStream << _inputSource; + dataStream << _padding1; + _antennaLocation.marshal(dataStream); + _relativeAntennaLocation.marshal(dataStream); + dataStream << _antennaPatternType; + dataStream << (uint16_t)_antennaPatternList.size(); + dataStream << _frequency; + dataStream << _transmitFrequencyBandwidth; + dataStream << _power; + _modulationType.marshal(dataStream); + dataStream << _cryptoSystem; + dataStream << _cryptoKeyId; + dataStream << (uint8_t)_modulationParametersList.size(); + dataStream << _padding2; + dataStream << _padding3; + + for (size_t idx = 0; idx < _modulationParametersList.size(); idx++) { + Vector3Float x = _modulationParametersList[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _antennaPatternList.size(); idx++) { + Vector3Float x = _antennaPatternList[idx]; + x.marshal(dataStream); + } +} + +void TransmitterPdu::unmarshal(DataStream& dataStream) { + RadioCommunicationsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _radioEntityType.unmarshal(dataStream); + dataStream >> _transmitState; + dataStream >> _inputSource; + dataStream >> _padding1; + _antennaLocation.unmarshal(dataStream); + _relativeAntennaLocation.unmarshal(dataStream); + dataStream >> _antennaPatternType; + dataStream >> _antennaPatternCount; + dataStream >> _frequency; + dataStream >> _transmitFrequencyBandwidth; + dataStream >> _power; + _modulationType.unmarshal(dataStream); + dataStream >> _cryptoSystem; + dataStream >> _cryptoKeyId; + dataStream >> _modulationParameterCount; + dataStream >> _padding2; + dataStream >> _padding3; + + _modulationParametersList.clear(); + for (size_t idx = 0; idx < _modulationParameterCount; idx++) { + Vector3Float x; + x.unmarshal(dataStream); + _modulationParametersList.push_back(x); + } + + _antennaPatternList.clear(); + for (size_t idx = 0; idx < _antennaPatternCount; idx++) { + Vector3Float x; + x.unmarshal(dataStream); + _antennaPatternList.push_back(x); + } +} + +bool TransmitterPdu::operator==(const TransmitterPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); + + if (!(_radioEntityType == rhs._radioEntityType)) ivarsEqual = false; + if (!(_transmitState == rhs._transmitState)) ivarsEqual = false; + if (!(_inputSource == rhs._inputSource)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_antennaLocation == rhs._antennaLocation)) ivarsEqual = false; + if (!(_relativeAntennaLocation == rhs._relativeAntennaLocation)) + ivarsEqual = false; + if (!(_antennaPatternType == rhs._antennaPatternType)) ivarsEqual = false; + if (!(_frequency == rhs._frequency)) ivarsEqual = false; + if (!(_transmitFrequencyBandwidth == rhs._transmitFrequencyBandwidth)) + ivarsEqual = false; + if (!(_power == rhs._power)) ivarsEqual = false; + if (!(_modulationType == rhs._modulationType)) ivarsEqual = false; + if (!(_cryptoSystem == rhs._cryptoSystem)) ivarsEqual = false; + if (!(_cryptoKeyId == rhs._cryptoKeyId)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_padding3 == rhs._padding3)) ivarsEqual = false; + + for (size_t idx = 0; idx < _modulationParametersList.size(); idx++) { + if (!(_modulationParametersList[idx] == rhs._modulationParametersList[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _antennaPatternList.size(); idx++) { + if (!(_antennaPatternList[idx] == rhs._antennaPatternList[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int TransmitterPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _radioEntityType.getMarshalledSize(); // _radioEntityType + marshalSize = marshalSize + 1; // _transmitState + marshalSize = marshalSize + 1; // _inputSource + marshalSize = marshalSize + 2; // _padding1 + marshalSize = + marshalSize + _antennaLocation.getMarshalledSize(); // _antennaLocation + marshalSize = + marshalSize + + _relativeAntennaLocation.getMarshalledSize(); // _relativeAntennaLocation + marshalSize = marshalSize + 2; // _antennaPatternType + marshalSize = marshalSize + 2; // _antennaPatternCount + marshalSize = marshalSize + 8; // _frequency + marshalSize = marshalSize + 4; // _transmitFrequencyBandwidth + marshalSize = marshalSize + 4; // _power + marshalSize = + marshalSize + _modulationType.getMarshalledSize(); // _modulationType + marshalSize = marshalSize + 2; // _cryptoSystem + marshalSize = marshalSize + 2; // _cryptoKeyId + marshalSize = marshalSize + 1; // _modulationParameterCount + marshalSize = marshalSize + 2; // _padding2 + marshalSize = marshalSize + 1; // _padding3 + + for (uint64_t idx = 0; idx < _modulationParametersList.size(); + idx++) { + Vector3Float listElement = _modulationParametersList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _antennaPatternList.size(); idx++) { + Vector3Float listElement = _antennaPatternList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/radio_communications/TransmitterPdu.h b/src/dis6/radio_communications/TransmitterPdu.h new file mode 100644 index 00000000..73ae3596 --- /dev/null +++ b/src/dis6/radio_communications/TransmitterPdu.h @@ -0,0 +1,185 @@ +#pragma once + +#include + +#include "dis6/ModulationType.h" +#include "dis6/RadioCommunicationsFamilyPdu.h" +#include "dis6/RadioEntityType.h" +#include "dis6/Vector3Double.h" +#include "dis6/Vector3Float.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.8.1. Detailed information about a radio transmitter. This PDU +// requires manually written code to complete, since the modulation +// parameters are of variable length. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class TransmitterPdu : public RadioCommunicationsFamilyPdu { + protected: + /** linear accelleration of entity */ + RadioEntityType _radioEntityType; + + /** transmit state */ + uint8_t _transmitState; + + /** input source */ + uint8_t _inputSource; + + /** padding */ + uint16_t _padding1; + + /** Location of antenna */ + Vector3Double _antennaLocation; + + /** relative location of antenna */ + Vector3Float _relativeAntennaLocation; + + /** antenna pattern type */ + uint16_t _antennaPatternType; + + /** atenna pattern length */ + uint16_t _antennaPatternCount; + + /** frequency */ + uint64_t _frequency; + + /** transmit frequency Bandwidth */ + float _transmitFrequencyBandwidth; + + /** transmission power */ + float _power; + + /** modulation */ + ModulationType _modulationType; + + /** crypto system enumeration */ + uint16_t _cryptoSystem; + + /** crypto system key identifer */ + uint16_t _cryptoKeyId; + + /** how many modulation parameters we have */ + uint8_t _modulationParameterCount; + + /** padding2 */ + uint16_t _padding2; + + /** padding3 */ + uint8_t _padding3; + + /** variable length list of modulation parameters */ + std::vector _modulationParametersList; + + /** variable length list of antenna pattern records */ + std::vector _antennaPatternList; + + public: + TransmitterPdu(); + virtual ~TransmitterPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + RadioEntityType& getRadioEntityType(); + const RadioEntityType& getRadioEntityType() const; + void setRadioEntityType(const RadioEntityType& pX); + + uint8_t getTransmitState() const; + void setTransmitState(uint8_t pX); + + uint8_t getInputSource() const; + void setInputSource(uint8_t pX); + + uint16_t getPadding1() const; + void setPadding1(uint16_t pX); + + Vector3Double& getAntennaLocation(); + const Vector3Double& getAntennaLocation() const; + void setAntennaLocation(const Vector3Double& pX); + + Vector3Float& getRelativeAntennaLocation(); + const Vector3Float& getRelativeAntennaLocation() const; + void setRelativeAntennaLocation(const Vector3Float& pX); + + uint16_t getAntennaPatternType() const; + void setAntennaPatternType(uint16_t pX); + + uint16_t getAntennaPatternCount() const; + + uint64_t getFrequency() const; + void setFrequency(uint64_t pX); + + float getTransmitFrequencyBandwidth() const; + void setTransmitFrequencyBandwidth(float pX); + + float getPower() const; + void setPower(float pX); + + ModulationType& getModulationType(); + const ModulationType& getModulationType() const; + void setModulationType(const ModulationType& pX); + + uint16_t getCryptoSystem() const; + void setCryptoSystem(uint16_t pX); + + uint16_t getCryptoKeyId() const; + void setCryptoKeyId(uint16_t pX); + + uint8_t getModulationParameterCount() const; + + uint16_t getPadding2() const; + void setPadding2(uint16_t pX); + + uint8_t getPadding3() const; + void setPadding3(uint8_t pX); + + std::vector& getModulationParametersList(); + const std::vector& getModulationParametersList() const; + void setModulationParametersList(const std::vector& pX); + + std::vector& getAntennaPatternList(); + const std::vector& getAntennaPatternList() const; + void setAntennaPatternList(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const TransmitterPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/AcknowledgePdu.cpp b/src/dis6/simulation_management/AcknowledgePdu.cpp new file mode 100644 index 00000000..84e6a42f --- /dev/null +++ b/src/dis6/simulation_management/AcknowledgePdu.cpp @@ -0,0 +1,98 @@ +#include "dis6/AcknowledgePdu.h" + +using namespace DIS; + +AcknowledgePdu::AcknowledgePdu() + : SimulationManagementFamilyPdu(), + _acknowledgeFlag(0), + _responseFlag(0), + _requestID(0) { + setPduType(15); +} + +AcknowledgePdu::~AcknowledgePdu() {} + +uint16_t AcknowledgePdu::getAcknowledgeFlag() const { + return _acknowledgeFlag; +} + +void AcknowledgePdu::setAcknowledgeFlag(uint16_t pX) { + _acknowledgeFlag = pX; +} + +uint16_t AcknowledgePdu::getResponseFlag() const { return _responseFlag; } + +void AcknowledgePdu::setResponseFlag(uint16_t pX) { _responseFlag = pX; } + +uint32_t AcknowledgePdu::getRequestID() const { return _requestID; } + +void AcknowledgePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void AcknowledgePdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _acknowledgeFlag; + dataStream << _responseFlag; + dataStream << _requestID; +} + +void AcknowledgePdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _acknowledgeFlag; + dataStream >> _responseFlag; + dataStream >> _requestID; +} + +bool AcknowledgePdu::operator==(const AcknowledgePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_acknowledgeFlag == rhs._acknowledgeFlag)) ivarsEqual = false; + if (!(_responseFlag == rhs._responseFlag)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int AcknowledgePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 2; // _acknowledgeFlag + marshalSize = marshalSize + 2; // _responseFlag + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/AcknowledgePdu.h b/src/dis6/simulation_management/AcknowledgePdu.h new file mode 100644 index 00000000..eadd2464 --- /dev/null +++ b/src/dis6/simulation_management/AcknowledgePdu.h @@ -0,0 +1,79 @@ +#pragma once + +#include +#include "dis6/SimulationManagementFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.5. Acknowledge the receiptof a start/resume, stop/freeze, or +// RemoveEntityPDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AcknowledgePdu : public SimulationManagementFamilyPdu { + protected: + /** type of message being acknowledged */ + uint16_t _acknowledgeFlag; + + /** Whether or not the receiving entity was able to comply with the request */ + uint16_t _responseFlag; + + /** Request ID that is unique */ + uint32_t _requestID; + + public: + AcknowledgePdu(); + virtual ~AcknowledgePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getAcknowledgeFlag() const; + void setAcknowledgeFlag(uint16_t pX); + + uint16_t getResponseFlag() const; + void setResponseFlag(uint16_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AcknowledgePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/ActionRequestPdu.cpp b/src/dis6/simulation_management/ActionRequestPdu.cpp new file mode 100644 index 00000000..feaa9db7 --- /dev/null +++ b/src/dis6/simulation_management/ActionRequestPdu.cpp @@ -0,0 +1,171 @@ +#include "dis6/ActionRequestPdu.h" + +using namespace DIS; + +ActionRequestPdu::ActionRequestPdu() + : SimulationManagementFamilyPdu(), + _requestID(0), + _actionID(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(16); +} + +ActionRequestPdu::~ActionRequestPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t ActionRequestPdu::getRequestID() const { return _requestID; } + +void ActionRequestPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t ActionRequestPdu::getActionID() const { return _actionID; } + +void ActionRequestPdu::setActionID(uint32_t pX) { _actionID = pX; } + +uint32_t ActionRequestPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t ActionRequestPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& ActionRequestPdu::getFixedDatums() { + return _fixedDatums; +} + +const std::vector& ActionRequestPdu::getFixedDatums() const { + return _fixedDatums; +} + +void ActionRequestPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& ActionRequestPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& ActionRequestPdu::getVariableDatums() const { + return _variableDatums; +} + +void ActionRequestPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void ActionRequestPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _actionID; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void ActionRequestPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _actionID; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool ActionRequestPdu::operator==(const ActionRequestPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_actionID == rhs._actionID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ActionRequestPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _actionID + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/ActionRequestPdu.h b/src/dis6/simulation_management/ActionRequestPdu.h new file mode 100644 index 00000000..63bdbfe1 --- /dev/null +++ b/src/dis6/simulation_management/ActionRequestPdu.h @@ -0,0 +1,99 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.6. Request from simulation manager to an entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ActionRequestPdu : public SimulationManagementFamilyPdu { + protected: + /** Request ID that is unique */ + uint32_t _requestID; + + /** identifies the action being requested */ + uint32_t _actionID; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + ActionRequestPdu(); + virtual ~ActionRequestPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getActionID() const; + void setActionID(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ActionRequestPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/ActionResponsePdu.cpp b/src/dis6/simulation_management/ActionResponsePdu.cpp new file mode 100644 index 00000000..e04944db --- /dev/null +++ b/src/dis6/simulation_management/ActionResponsePdu.cpp @@ -0,0 +1,176 @@ +#include "dis6/ActionResponsePdu.h" + +using namespace DIS; + +ActionResponsePdu::ActionResponsePdu() + : SimulationManagementFamilyPdu(), + _requestID(0), + _requestStatus(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(17); +} + +ActionResponsePdu::~ActionResponsePdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t ActionResponsePdu::getRequestID() const { return _requestID; } + +void ActionResponsePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t ActionResponsePdu::getRequestStatus() const { + return _requestStatus; +} + +void ActionResponsePdu::setRequestStatus(uint32_t pX) { + _requestStatus = pX; +} + +uint32_t ActionResponsePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t ActionResponsePdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& ActionResponsePdu::getFixedDatums() { + return _fixedDatums; +} + +const std::vector& ActionResponsePdu::getFixedDatums() const { + return _fixedDatums; +} + +void ActionResponsePdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& ActionResponsePdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& ActionResponsePdu::getVariableDatums() const { + return _variableDatums; +} + +void ActionResponsePdu::setVariableDatums( + const std::vector& pX) { + _variableDatums = pX; +} + +void ActionResponsePdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _requestStatus; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void ActionResponsePdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _requestStatus; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool ActionResponsePdu::operator==(const ActionResponsePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_requestStatus == rhs._requestStatus)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ActionResponsePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _requestStatus + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/ActionResponsePdu.h b/src/dis6/simulation_management/ActionResponsePdu.h new file mode 100644 index 00000000..a81746a9 --- /dev/null +++ b/src/dis6/simulation_management/ActionResponsePdu.h @@ -0,0 +1,99 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.7. response to an action request PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ActionResponsePdu : public SimulationManagementFamilyPdu { + protected: + /** Request ID that is unique */ + uint32_t _requestID; + + /** Status of response */ + uint32_t _requestStatus; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + ActionResponsePdu(); + virtual ~ActionResponsePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getRequestStatus() const; + void setRequestStatus(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ActionResponsePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/CMakeLists.txt b/src/dis6/simulation_management/CMakeLists.txt new file mode 100644 index 00000000..404bbbb5 --- /dev/null +++ b/src/dis6/simulation_management/CMakeLists.txt @@ -0,0 +1,43 @@ +set(simulation_management_hdr + AcknowledgePdu.h + ActionRequestPdu.h + ActionResponsePdu.h + CommentPdu.h + CreateEntityPdu.h + DataPdu.h + DataQueryPdu.h + EventReportPdu.h + RemoveEntityPdu.h + SetDataPdu.h + SimulationManagementFamilyPdu.h + StartResumePdu.h + StopFreezePdu.h +) + +set(simulation_management_src + AcknowledgePdu.cpp + ActionRequestPdu.cpp + ActionResponsePdu.cpp + CommentPdu.cpp + CreateEntityPdu.cpp + DataPdu.cpp + DataQueryPdu.cpp + EventReportPdu.cpp + RemoveEntityPdu.cpp + SetDataPdu.cpp + SimulationManagementFamilyPdu.cpp + StartResumePdu.cpp + StopFreezePdu.cpp +) + +list(TRANSFORM simulation_management_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND simulation_management_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${simulation_management_src}) + +install(FILES ${simulation_management_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/simulation_management +) diff --git a/src/dis6/simulation_management/CommentPdu.cpp b/src/dis6/simulation_management/CommentPdu.cpp new file mode 100644 index 00000000..10bbc6f3 --- /dev/null +++ b/src/dis6/simulation_management/CommentPdu.cpp @@ -0,0 +1,150 @@ +#include "dis6/CommentPdu.h" + +using namespace DIS; + +CommentPdu::CommentPdu() + : SimulationManagementFamilyPdu(), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(22); +} + +CommentPdu::~CommentPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t CommentPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t CommentPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& CommentPdu::getFixedDatums() { return _fixedDatums; } + +const std::vector& CommentPdu::getFixedDatums() const { + return _fixedDatums; +} + +void CommentPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& CommentPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& CommentPdu::getVariableDatums() const { + return _variableDatums; +} + +void CommentPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void CommentPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void CommentPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool CommentPdu::operator==(const CommentPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int CommentPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/CommentPdu.h b/src/dis6/simulation_management/CommentPdu.h new file mode 100644 index 00000000..259a8aaf --- /dev/null +++ b/src/dis6/simulation_management/CommentPdu.h @@ -0,0 +1,88 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.12. Arbitrary messages can be entered into the data stream via +// use of this PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class CommentPdu : public SimulationManagementFamilyPdu { + protected: + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + CommentPdu(); + virtual ~CommentPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CommentPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/CreateEntityPdu.cpp b/src/dis6/simulation_management/CreateEntityPdu.cpp new file mode 100644 index 00000000..3089c738 --- /dev/null +++ b/src/dis6/simulation_management/CreateEntityPdu.cpp @@ -0,0 +1,75 @@ +#include "dis6/CreateEntityPdu.h" + +using namespace DIS; + +CreateEntityPdu::CreateEntityPdu() + : SimulationManagementFamilyPdu(), _requestID(0) { + setPduType(11); +} + +CreateEntityPdu::~CreateEntityPdu() {} + +uint32_t CreateEntityPdu::getRequestID() const { return _requestID; } + +void CreateEntityPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void CreateEntityPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; +} + +void CreateEntityPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; +} + +bool CreateEntityPdu::operator==(const CreateEntityPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int CreateEntityPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/CreateEntityPdu.h b/src/dis6/simulation_management/CreateEntityPdu.h new file mode 100644 index 00000000..6313eb50 --- /dev/null +++ b/src/dis6/simulation_management/CreateEntityPdu.h @@ -0,0 +1,65 @@ +#pragma once + +#include "dis6/SimulationManagementFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.1. Create a new entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class CreateEntityPdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for the request */ + uint32_t _requestID; + + public: + CreateEntityPdu(); + virtual ~CreateEntityPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CreateEntityPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/DataPdu.cpp b/src/dis6/simulation_management/DataPdu.cpp new file mode 100644 index 00000000..1c5483b4 --- /dev/null +++ b/src/dis6/simulation_management/DataPdu.cpp @@ -0,0 +1,169 @@ +#include "dis6/DataPdu.h" + +using namespace DIS; + +DataPdu::DataPdu() + : SimulationManagementFamilyPdu(), + _requestID(0), + _padding1(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(20); +} + +DataPdu::~DataPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t DataPdu::getRequestID() const { return _requestID; } + +void DataPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t DataPdu::getPadding1() const { return _padding1; } + +void DataPdu::setPadding1(uint32_t pX) { _padding1 = pX; } + +uint32_t DataPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t DataPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& DataPdu::getFixedDatums() { return _fixedDatums; } + +const std::vector& DataPdu::getFixedDatums() const { + return _fixedDatums; +} + +void DataPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& DataPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& DataPdu::getVariableDatums() const { + return _variableDatums; +} + +void DataPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void DataPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _padding1; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void DataPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _padding1; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool DataPdu::operator==(const DataPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _padding1 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/DataPdu.h b/src/dis6/simulation_management/DataPdu.h new file mode 100644 index 00000000..4d9e2027 --- /dev/null +++ b/src/dis6/simulation_management/DataPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.10. Information issued in response to a data query pdu or a set +// data pdu is communicated using a data pdu. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class DataPdu : public SimulationManagementFamilyPdu { + protected: + /** ID of request */ + uint32_t _requestID; + + /** padding */ + uint32_t _padding1; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + DataPdu(); + virtual ~DataPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getPadding1() const; + void setPadding1(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/DataQueryPdu.cpp b/src/dis6/simulation_management/DataQueryPdu.cpp new file mode 100644 index 00000000..8702e016 --- /dev/null +++ b/src/dis6/simulation_management/DataQueryPdu.cpp @@ -0,0 +1,169 @@ +#include "dis6/DataQueryPdu.h" + +using namespace DIS; + +DataQueryPdu::DataQueryPdu() + : SimulationManagementFamilyPdu(), + _requestID(0), + _timeInterval(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(18); +} + +DataQueryPdu::~DataQueryPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t DataQueryPdu::getRequestID() const { return _requestID; } + +void DataQueryPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t DataQueryPdu::getTimeInterval() const { return _timeInterval; } + +void DataQueryPdu::setTimeInterval(uint32_t pX) { _timeInterval = pX; } + +uint32_t DataQueryPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t DataQueryPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& DataQueryPdu::getFixedDatums() { return _fixedDatums; } + +const std::vector& DataQueryPdu::getFixedDatums() const { + return _fixedDatums; +} + +void DataQueryPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& DataQueryPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& DataQueryPdu::getVariableDatums() const { + return _variableDatums; +} + +void DataQueryPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void DataQueryPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _timeInterval; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void DataQueryPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _timeInterval; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool DataQueryPdu::operator==(const DataQueryPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_timeInterval == rhs._timeInterval)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataQueryPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _timeInterval + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/DataQueryPdu.h b/src/dis6/simulation_management/DataQueryPdu.h new file mode 100644 index 00000000..c7d836ac --- /dev/null +++ b/src/dis6/simulation_management/DataQueryPdu.h @@ -0,0 +1,99 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.8. Request for data from an entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class DataQueryPdu : public SimulationManagementFamilyPdu { + protected: + /** ID of request */ + uint32_t _requestID; + + /** time issues between issues of Data PDUs. Zero means send once only. */ + uint32_t _timeInterval; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + DataQueryPdu(); + virtual ~DataQueryPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getTimeInterval() const; + void setTimeInterval(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataQueryPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/EventReportPdu.cpp b/src/dis6/simulation_management/EventReportPdu.cpp new file mode 100644 index 00000000..fb9a906b --- /dev/null +++ b/src/dis6/simulation_management/EventReportPdu.cpp @@ -0,0 +1,171 @@ +#include "dis6/EventReportPdu.h" + +using namespace DIS; + +EventReportPdu::EventReportPdu() + : SimulationManagementFamilyPdu(), + _eventType(0), + _padding1(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(21); +} + +EventReportPdu::~EventReportPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t EventReportPdu::getEventType() const { return _eventType; } + +void EventReportPdu::setEventType(uint32_t pX) { _eventType = pX; } + +uint32_t EventReportPdu::getPadding1() const { return _padding1; } + +void EventReportPdu::setPadding1(uint32_t pX) { _padding1 = pX; } + +uint32_t EventReportPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t EventReportPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& EventReportPdu::getFixedDatums() { + return _fixedDatums; +} + +const std::vector& EventReportPdu::getFixedDatums() const { + return _fixedDatums; +} + +void EventReportPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& EventReportPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& EventReportPdu::getVariableDatums() const { + return _variableDatums; +} + +void EventReportPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void EventReportPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _eventType; + dataStream << _padding1; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void EventReportPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _eventType; + dataStream >> _padding1; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool EventReportPdu::operator==(const EventReportPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_eventType == rhs._eventType)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int EventReportPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _eventType + marshalSize = marshalSize + 4; // _padding1 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/EventReportPdu.h b/src/dis6/simulation_management/EventReportPdu.h new file mode 100644 index 00000000..5ba16c69 --- /dev/null +++ b/src/dis6/simulation_management/EventReportPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.11. Reports occurance of a significant event to the simulation +// manager. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EventReportPdu : public SimulationManagementFamilyPdu { + protected: + /** Type of event */ + uint32_t _eventType; + + /** padding */ + uint32_t _padding1; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + EventReportPdu(); + virtual ~EventReportPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getEventType() const; + void setEventType(uint32_t pX); + + uint32_t getPadding1() const; + void setPadding1(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EventReportPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/RemoveEntityPdu.cpp b/src/dis6/simulation_management/RemoveEntityPdu.cpp new file mode 100644 index 00000000..09fee38a --- /dev/null +++ b/src/dis6/simulation_management/RemoveEntityPdu.cpp @@ -0,0 +1,75 @@ +#include "dis6/RemoveEntityPdu.h" + +using namespace DIS; + +RemoveEntityPdu::RemoveEntityPdu() + : SimulationManagementFamilyPdu(), _requestID(0) { + setPduType(12); +} + +RemoveEntityPdu::~RemoveEntityPdu() {} + +uint32_t RemoveEntityPdu::getRequestID() const { return _requestID; } + +void RemoveEntityPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void RemoveEntityPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; +} + +void RemoveEntityPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; +} + +bool RemoveEntityPdu::operator==(const RemoveEntityPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int RemoveEntityPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/RemoveEntityPdu.h b/src/dis6/simulation_management/RemoveEntityPdu.h new file mode 100644 index 00000000..dd3ad1e4 --- /dev/null +++ b/src/dis6/simulation_management/RemoveEntityPdu.h @@ -0,0 +1,65 @@ +#pragma once + +#include "dis6/SimulationManagementFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.2. Remove an entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class RemoveEntityPdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for the request */ + uint32_t _requestID; + + public: + RemoveEntityPdu(); + virtual ~RemoveEntityPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RemoveEntityPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/SetDataPdu.cpp b/src/dis6/simulation_management/SetDataPdu.cpp new file mode 100644 index 00000000..d2aef22d --- /dev/null +++ b/src/dis6/simulation_management/SetDataPdu.cpp @@ -0,0 +1,169 @@ +#include "dis6/SetDataPdu.h" + +using namespace DIS; + +SetDataPdu::SetDataPdu() + : SimulationManagementFamilyPdu(), + _requestID(0), + _padding1(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(19); +} + +SetDataPdu::~SetDataPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t SetDataPdu::getRequestID() const { return _requestID; } + +void SetDataPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t SetDataPdu::getPadding1() const { return _padding1; } + +void SetDataPdu::setPadding1(uint32_t pX) { _padding1 = pX; } + +uint32_t SetDataPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t SetDataPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& SetDataPdu::getFixedDatums() { return _fixedDatums; } + +const std::vector& SetDataPdu::getFixedDatums() const { + return _fixedDatums; +} + +void SetDataPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& SetDataPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& SetDataPdu::getVariableDatums() const { + return _variableDatums; +} + +void SetDataPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void SetDataPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _padding1; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void SetDataPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _padding1; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool SetDataPdu::operator==(const SetDataPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int SetDataPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _padding1 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/SetDataPdu.h b/src/dis6/simulation_management/SetDataPdu.h new file mode 100644 index 00000000..0e985aa4 --- /dev/null +++ b/src/dis6/simulation_management/SetDataPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6.9. Change state information with the data contained in this. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SetDataPdu : public SimulationManagementFamilyPdu { + protected: + /** ID of request */ + uint32_t _requestID; + + /** padding */ + uint32_t _padding1; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + SetDataPdu(); + virtual ~SetDataPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getPadding1() const; + void setPadding1(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SetDataPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/SimulationManagementFamilyPdu.cpp b/src/dis6/simulation_management/SimulationManagementFamilyPdu.cpp new file mode 100644 index 00000000..4c760cf2 --- /dev/null +++ b/src/dis6/simulation_management/SimulationManagementFamilyPdu.cpp @@ -0,0 +1,101 @@ +#include "dis6/SimulationManagementFamilyPdu.h" + +using namespace DIS; + +SimulationManagementFamilyPdu::SimulationManagementFamilyPdu() + : Pdu(), _originatingEntityID(), _receivingEntityID() { + setProtocolFamily(5); +} + +SimulationManagementFamilyPdu::~SimulationManagementFamilyPdu() {} + +EntityID& SimulationManagementFamilyPdu::getOriginatingEntityID() { + return _originatingEntityID; +} + +const EntityID& SimulationManagementFamilyPdu::getOriginatingEntityID() const { + return _originatingEntityID; +} + +void SimulationManagementFamilyPdu::setOriginatingEntityID(const EntityID& pX) { + _originatingEntityID = pX; +} + +EntityID& SimulationManagementFamilyPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& SimulationManagementFamilyPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void SimulationManagementFamilyPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +void SimulationManagementFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first + _originatingEntityID.marshal(dataStream); + _receivingEntityID.marshal(dataStream); +} + +void SimulationManagementFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first + _originatingEntityID.unmarshal(dataStream); + _receivingEntityID.unmarshal(dataStream); +} + +bool SimulationManagementFamilyPdu::operator==( + const SimulationManagementFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + if (!(_originatingEntityID == rhs._originatingEntityID)) ivarsEqual = false; + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + + return ivarsEqual; +} + +int SimulationManagementFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + marshalSize = + marshalSize + + _originatingEntityID.getMarshalledSize(); // _originatingEntityID + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/SimulationManagementFamilyPdu.h b/src/dis6/simulation_management/SimulationManagementFamilyPdu.h new file mode 100644 index 00000000..cb47575e --- /dev/null +++ b/src/dis6/simulation_management/SimulationManagementFamilyPdu.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/Pdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.6. Abstract superclass for PDUs relating to the simulation +// itself. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SimulationManagementFamilyPdu : public Pdu { + protected: + /** Entity that is sending message */ + EntityID _originatingEntityID; + + /** Entity that is intended to receive message */ + EntityID _receivingEntityID; + + public: + SimulationManagementFamilyPdu(); + virtual ~SimulationManagementFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingEntityID(); + const EntityID& getOriginatingEntityID() const; + void setOriginatingEntityID(const EntityID& pX); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SimulationManagementFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/StartResumePdu.cpp b/src/dis6/simulation_management/StartResumePdu.cpp new file mode 100644 index 00000000..e6299a51 --- /dev/null +++ b/src/dis6/simulation_management/StartResumePdu.cpp @@ -0,0 +1,108 @@ +#include "dis6/StartResumePdu.h" + +using namespace DIS; + +StartResumePdu::StartResumePdu() + : SimulationManagementFamilyPdu(), + _realWorldTime(), + _simulationTime(), + _requestID(0) { + setPduType(13); +} + +StartResumePdu::~StartResumePdu() {} + +ClockTime& StartResumePdu::getRealWorldTime() { return _realWorldTime; } + +const ClockTime& StartResumePdu::getRealWorldTime() const { + return _realWorldTime; +} + +void StartResumePdu::setRealWorldTime(const ClockTime& pX) { + _realWorldTime = pX; +} + +ClockTime& StartResumePdu::getSimulationTime() { return _simulationTime; } + +const ClockTime& StartResumePdu::getSimulationTime() const { + return _simulationTime; +} + +void StartResumePdu::setSimulationTime(const ClockTime& pX) { + _simulationTime = pX; +} + +uint32_t StartResumePdu::getRequestID() const { return _requestID; } + +void StartResumePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void StartResumePdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _realWorldTime.marshal(dataStream); + _simulationTime.marshal(dataStream); + dataStream << _requestID; +} + +void StartResumePdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _realWorldTime.unmarshal(dataStream); + _simulationTime.unmarshal(dataStream); + dataStream >> _requestID; +} + +bool StartResumePdu::operator==(const StartResumePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_realWorldTime == rhs._realWorldTime)) ivarsEqual = false; + if (!(_simulationTime == rhs._simulationTime)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int StartResumePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime + marshalSize = + marshalSize + _simulationTime.getMarshalledSize(); // _simulationTime + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/StartResumePdu.h b/src/dis6/simulation_management/StartResumePdu.h new file mode 100644 index 00000000..2d0fc5d7 --- /dev/null +++ b/src/dis6/simulation_management/StartResumePdu.h @@ -0,0 +1,80 @@ +#pragma once + +#include "dis6/ClockTime.h" +#include "dis6/SimulationManagementFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.6.3. Start or resume an exercise. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class StartResumePdu : public SimulationManagementFamilyPdu { + protected: + /** UTC time at which the simulation shall start or resume */ + ClockTime _realWorldTime; + + /** Simulation clock time at which the simulation shall start or resume */ + ClockTime _simulationTime; + + /** Identifier for the request */ + uint32_t _requestID; + + public: + StartResumePdu(); + virtual ~StartResumePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + ClockTime& getRealWorldTime(); + const ClockTime& getRealWorldTime() const; + void setRealWorldTime(const ClockTime& pX); + + ClockTime& getSimulationTime(); + const ClockTime& getSimulationTime() const; + void setSimulationTime(const ClockTime& pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StartResumePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/StopFreezePdu.cpp b/src/dis6/simulation_management/StopFreezePdu.cpp new file mode 100644 index 00000000..49766974 --- /dev/null +++ b/src/dis6/simulation_management/StopFreezePdu.cpp @@ -0,0 +1,123 @@ +#include "dis6/StopFreezePdu.h" + +using namespace DIS; + +StopFreezePdu::StopFreezePdu() + : SimulationManagementFamilyPdu(), + _realWorldTime(), + _reason(0), + _frozenBehavior(0), + _padding1(0), + _requestID(0) { + setPduType(14); +} + +StopFreezePdu::~StopFreezePdu() {} + +ClockTime& StopFreezePdu::getRealWorldTime() { return _realWorldTime; } + +const ClockTime& StopFreezePdu::getRealWorldTime() const { + return _realWorldTime; +} + +void StopFreezePdu::setRealWorldTime(const ClockTime& pX) { + _realWorldTime = pX; +} + +uint8_t StopFreezePdu::getReason() const { return _reason; } + +void StopFreezePdu::setReason(uint8_t pX) { _reason = pX; } + +uint8_t StopFreezePdu::getFrozenBehavior() const { + return _frozenBehavior; +} + +void StopFreezePdu::setFrozenBehavior(uint8_t pX) { + _frozenBehavior = pX; +} + +int16_t StopFreezePdu::getPadding1() const { return _padding1; } + +void StopFreezePdu::setPadding1(int16_t pX) { _padding1 = pX; } + +uint32_t StopFreezePdu::getRequestID() const { return _requestID; } + +void StopFreezePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +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; +} + +bool StopFreezePdu::operator==(const StopFreezePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_realWorldTime == rhs._realWorldTime)) ivarsEqual = false; + if (!(_reason == rhs._reason)) ivarsEqual = false; + if (!(_frozenBehavior == rhs._frozenBehavior)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int StopFreezePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime + marshalSize = marshalSize + 1; // _reason + marshalSize = marshalSize + 1; // _frozenBehavior + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management/StopFreezePdu.h b/src/dis6/simulation_management/StopFreezePdu.h new file mode 100644 index 00000000..ca617826 --- /dev/null +++ b/src/dis6/simulation_management/StopFreezePdu.h @@ -0,0 +1,92 @@ +#pragma once + +#include "dis6/ClockTime.h" +#include "dis6/SimulationManagementFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.3.4. Stop or freeze an exercise. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class StopFreezePdu : public SimulationManagementFamilyPdu { + protected: + /** UTC time at which the simulation shall stop or freeze */ + ClockTime _realWorldTime; + + /** Reason the simulation was stopped or frozen */ + uint8_t _reason; + + /** Internal behavior of the simulation and its appearance while frozento the + * other participants */ + uint8_t _frozenBehavior; + + /** padding */ + int16_t _padding1; + + /** Request ID that is unique */ + uint32_t _requestID; + + public: + StopFreezePdu(); + virtual ~StopFreezePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + ClockTime& getRealWorldTime(); + const ClockTime& getRealWorldTime() const; + void setRealWorldTime(const ClockTime& pX); + + uint8_t getReason() const; + void setReason(uint8_t pX); + + uint8_t getFrozenBehavior() const; + void setFrozenBehavior(uint8_t pX); + + int16_t getPadding1() const; + void setPadding1(int16_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StopFreezePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/AcknowledgeReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/AcknowledgeReliablePdu.cpp new file mode 100644 index 00000000..6069fd2e --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/AcknowledgeReliablePdu.cpp @@ -0,0 +1,104 @@ +#include "dis6/AcknowledgeReliablePdu.h" + +using namespace DIS; + +AcknowledgeReliablePdu::AcknowledgeReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _acknowledgeFlag(0), + _responseFlag(0), + _requestID(0) { + setPduType(55); +} + +AcknowledgeReliablePdu::~AcknowledgeReliablePdu() {} + +uint16_t AcknowledgeReliablePdu::getAcknowledgeFlag() const { + return _acknowledgeFlag; +} + +void AcknowledgeReliablePdu::setAcknowledgeFlag(uint16_t pX) { + _acknowledgeFlag = pX; +} + +uint16_t AcknowledgeReliablePdu::getResponseFlag() const { + return _responseFlag; +} + +void AcknowledgeReliablePdu::setResponseFlag(uint16_t pX) { + _responseFlag = pX; +} + +uint32_t AcknowledgeReliablePdu::getRequestID() const { return _requestID; } + +void AcknowledgeReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void AcknowledgeReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _acknowledgeFlag; + dataStream << _responseFlag; + dataStream << _requestID; +} + +void AcknowledgeReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _acknowledgeFlag; + dataStream >> _responseFlag; + dataStream >> _requestID; +} + +bool AcknowledgeReliablePdu::operator==( + const AcknowledgeReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_acknowledgeFlag == rhs._acknowledgeFlag)) ivarsEqual = false; + if (!(_responseFlag == rhs._responseFlag)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int AcknowledgeReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 2; // _acknowledgeFlag + marshalSize = marshalSize + 2; // _responseFlag + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/AcknowledgeReliablePdu.h b/src/dis6/simulation_management_with_reliability/AcknowledgeReliablePdu.h new file mode 100644 index 00000000..83e5337b --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/AcknowledgeReliablePdu.h @@ -0,0 +1,79 @@ +#pragma once + +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.5: Ack receipt of a start-resume, stop-freeze, create-entity +// or remove enitty (reliable) pdus. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class AcknowledgeReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** ack flags */ + uint16_t _acknowledgeFlag; + + /** response flags */ + uint16_t _responseFlag; + + /** Request ID */ + uint32_t _requestID; + + public: + AcknowledgeReliablePdu(); + virtual ~AcknowledgeReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getAcknowledgeFlag() const; + void setAcknowledgeFlag(uint16_t pX); + + uint16_t getResponseFlag() const; + void setResponseFlag(uint16_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AcknowledgeReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/ActionRequestReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/ActionRequestReliablePdu.cpp new file mode 100644 index 00000000..13caaa1e --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/ActionRequestReliablePdu.cpp @@ -0,0 +1,216 @@ +#include "dis6/ActionRequestReliablePdu.h" + +using namespace DIS; + +ActionRequestReliablePdu::ActionRequestReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0), + _actionID(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(56); +} + +ActionRequestReliablePdu::~ActionRequestReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint8_t ActionRequestReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void ActionRequestReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t ActionRequestReliablePdu::getPad1() const { return _pad1; } + +void ActionRequestReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t ActionRequestReliablePdu::getPad2() const { return _pad2; } + +void ActionRequestReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t ActionRequestReliablePdu::getRequestID() const { + return _requestID; +} + +void ActionRequestReliablePdu::setRequestID(uint32_t pX) { + _requestID = pX; +} + +uint32_t ActionRequestReliablePdu::getActionID() const { return _actionID; } + +void ActionRequestReliablePdu::setActionID(uint32_t pX) { _actionID = pX; } + +uint32_t ActionRequestReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t ActionRequestReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& ActionRequestReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& ActionRequestReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void ActionRequestReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& +ActionRequestReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& +ActionRequestReliablePdu::getVariableDatumRecords() const { + return _variableDatumRecords; +} + +void ActionRequestReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void ActionRequestReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; + dataStream << _actionID; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void ActionRequestReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; + dataStream >> _actionID; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool ActionRequestReliablePdu::operator==( + const ActionRequestReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_actionID == rhs._actionID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int ActionRequestReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _actionID + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/ActionRequestReliablePdu.h b/src/dis6/simulation_management_with_reliability/ActionRequestReliablePdu.h new file mode 100644 index 00000000..46d8e7f5 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/ActionRequestReliablePdu.h @@ -0,0 +1,119 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.6: request from a simulation manager to a managed entity to +// perform a specified action. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ActionRequestReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** request ID */ + uint32_t _requestID; + + /** request ID */ + uint32_t _actionID; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + ActionRequestReliablePdu(); + virtual ~ActionRequestReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getActionID() const; + void setActionID(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ActionRequestReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/ActionResponseReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/ActionResponseReliablePdu.cpp new file mode 100644 index 00000000..4a51ccfc --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/ActionResponseReliablePdu.cpp @@ -0,0 +1,189 @@ +#include "dis6/ActionResponseReliablePdu.h" + +using namespace DIS; + +ActionResponseReliablePdu::ActionResponseReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requestID(0), + _responseStatus(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(57); +} + +ActionResponseReliablePdu::~ActionResponseReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint32_t ActionResponseReliablePdu::getRequestID() const { + return _requestID; +} + +void ActionResponseReliablePdu::setRequestID(uint32_t pX) { + _requestID = pX; +} + +uint32_t ActionResponseReliablePdu::getResponseStatus() const { + return _responseStatus; +} + +void ActionResponseReliablePdu::setResponseStatus(uint32_t pX) { + _responseStatus = pX; +} + +uint32_t ActionResponseReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t ActionResponseReliablePdu::getNumberOfVariableDatumRecords() + const { + return _variableDatumRecords.size(); +} + +std::vector& ActionResponseReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& ActionResponseReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void ActionResponseReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& +ActionResponseReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& +ActionResponseReliablePdu::getVariableDatumRecords() const { + return _variableDatumRecords; +} + +void ActionResponseReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void ActionResponseReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _responseStatus; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void ActionResponseReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _responseStatus; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool ActionResponseReliablePdu::operator==( + const ActionResponseReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_responseStatus == rhs._responseStatus)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int ActionResponseReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _responseStatus + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/ActionResponseReliablePdu.h b/src/dis6/simulation_management_with_reliability/ActionResponseReliablePdu.h new file mode 100644 index 00000000..9492c5bb --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/ActionResponseReliablePdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.7: Response from an entity to an action request PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ActionResponseReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** request ID */ + uint32_t _requestID; + + /** status of response */ + uint32_t _responseStatus; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + ActionResponseReliablePdu(); + virtual ~ActionResponseReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getResponseStatus() const; + void setResponseStatus(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ActionResponseReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/CMakeLists.txt b/src/dis6/simulation_management_with_reliability/CMakeLists.txt new file mode 100644 index 00000000..5ee28a05 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/CMakeLists.txt @@ -0,0 +1,47 @@ +set(simulation_management_with_reliability_hdr + AcknowledgeReliablePdu.h + ActionRequestReliablePdu.h + ActionResponseReliablePdu.h + CommentReliablePdu.h + CreateEntityReliablePdu.h + DataQueryReliablePdu.h + DataReliablePdu.h + EventReportReliablePdu.h + RecordQueryReliablePdu.h + RemoveEntityReliablePdu.h + SetDataReliablePdu.h + SetRecordReliablePdu.h + SimulationManagementWithReliabilityFamilyPdu.h + StartResumeReliablePdu.h + StopFreezeReliablePdu.h +) + +set(simulation_management_with_reliability_src + AcknowledgeReliablePdu.cpp + ActionRequestReliablePdu.cpp + ActionResponseReliablePdu.cpp + CommentReliablePdu.cpp + CreateEntityReliablePdu.cpp + DataQueryReliablePdu.cpp + DataReliablePdu.cpp + EventReportReliablePdu.cpp + RecordQueryReliablePdu.cpp + RemoveEntityReliablePdu.cpp + SetDataReliablePdu.cpp + SetRecordReliablePdu.cpp + SimulationManagementWithReliabilityFamilyPdu.cpp + StartResumeReliablePdu.cpp + StopFreezeReliablePdu.cpp +) + +list(TRANSFORM simulation_management_with_reliability_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND simulation_management_with_reliability_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${simulation_management_with_reliability_src}) + +install(FILES ${simulation_management_with_reliability_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/simulation_management_with_reliability +) diff --git a/src/dis6/simulation_management_with_reliability/CommentReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/CommentReliablePdu.cpp new file mode 100644 index 00000000..84764418 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/CommentReliablePdu.cpp @@ -0,0 +1,159 @@ +#include "dis6/CommentReliablePdu.h" + +using namespace DIS; + +CommentReliablePdu::CommentReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(62); +} + +CommentReliablePdu::~CommentReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint32_t CommentReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t CommentReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& CommentReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& CommentReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void CommentReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& CommentReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& CommentReliablePdu::getVariableDatumRecords() + const { + return _variableDatumRecords; +} + +void CommentReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void CommentReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void CommentReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool CommentReliablePdu::operator==(const CommentReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int CommentReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/CommentReliablePdu.h b/src/dis6/simulation_management_with_reliability/CommentReliablePdu.h new file mode 100644 index 00000000..1c59af66 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/CommentReliablePdu.h @@ -0,0 +1,89 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.12: Arbitrary messages. Only reliable this time. Neds manual +// intervention to fix padding in variable datums. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class CommentReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + CommentReliablePdu(); + virtual ~CommentReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CommentReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/CreateEntityReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/CreateEntityReliablePdu.cpp new file mode 100644 index 00000000..c7e02d73 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/CreateEntityReliablePdu.cpp @@ -0,0 +1,112 @@ +#include "dis6/CreateEntityReliablePdu.h" + +using namespace DIS; + +CreateEntityReliablePdu::CreateEntityReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0) { + setPduType(51); +} + +CreateEntityReliablePdu::~CreateEntityReliablePdu() {} + +uint8_t CreateEntityReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void CreateEntityReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t CreateEntityReliablePdu::getPad1() const { return _pad1; } + +void CreateEntityReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t CreateEntityReliablePdu::getPad2() const { return _pad2; } + +void CreateEntityReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t CreateEntityReliablePdu::getRequestID() const { + return _requestID; +} + +void CreateEntityReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void CreateEntityReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; +} + +void CreateEntityReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; +} + +bool CreateEntityReliablePdu::operator==( + const CreateEntityReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int CreateEntityReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/CreateEntityReliablePdu.h b/src/dis6/simulation_management_with_reliability/CreateEntityReliablePdu.h new file mode 100644 index 00000000..1e5bff80 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/CreateEntityReliablePdu.h @@ -0,0 +1,84 @@ +#pragma once + +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.1: creation of an entity , reliable. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class CreateEntityReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Request ID */ + uint32_t _requestID; + + public: + CreateEntityReliablePdu(); + virtual ~CreateEntityReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CreateEntityReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/DataQueryReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/DataQueryReliablePdu.cpp new file mode 100644 index 00000000..3de84934 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/DataQueryReliablePdu.cpp @@ -0,0 +1,214 @@ +#include "dis6/DataQueryReliablePdu.h" + +using namespace DIS; + +DataQueryReliablePdu::DataQueryReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0), + _timeInterval(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(58); +} + +DataQueryReliablePdu::~DataQueryReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint8_t DataQueryReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void DataQueryReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t DataQueryReliablePdu::getPad1() const { return _pad1; } + +void DataQueryReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t DataQueryReliablePdu::getPad2() const { return _pad2; } + +void DataQueryReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t DataQueryReliablePdu::getRequestID() const { return _requestID; } + +void DataQueryReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t DataQueryReliablePdu::getTimeInterval() const { + return _timeInterval; +} + +void DataQueryReliablePdu::setTimeInterval(uint32_t pX) { + _timeInterval = pX; +} + +uint32_t DataQueryReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t DataQueryReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& DataQueryReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& DataQueryReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void DataQueryReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& DataQueryReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& +DataQueryReliablePdu::getVariableDatumRecords() const { + return _variableDatumRecords; +} + +void DataQueryReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void DataQueryReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; + dataStream << _timeInterval; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void DataQueryReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; + dataStream >> _timeInterval; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool DataQueryReliablePdu::operator==(const DataQueryReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_timeInterval == rhs._timeInterval)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataQueryReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _timeInterval + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/DataQueryReliablePdu.h b/src/dis6/simulation_management_with_reliability/DataQueryReliablePdu.h new file mode 100644 index 00000000..a5abba9c --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/DataQueryReliablePdu.h @@ -0,0 +1,118 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.8: request for data from an entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class DataQueryReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** request ID */ + uint32_t _requestID; + + /** time interval between issuing data query PDUs */ + uint32_t _timeInterval; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + DataQueryReliablePdu(); + virtual ~DataQueryReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getTimeInterval() const; + void setTimeInterval(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataQueryReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/DataReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/DataReliablePdu.cpp new file mode 100644 index 00000000..b8954e49 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/DataReliablePdu.cpp @@ -0,0 +1,199 @@ +#include "dis6/DataReliablePdu.h" + +using namespace DIS; + +DataReliablePdu::DataReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requestID(0), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(60); +} + +DataReliablePdu::~DataReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint32_t DataReliablePdu::getRequestID() const { return _requestID; } + +void DataReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint8_t DataReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void DataReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t DataReliablePdu::getPad1() const { return _pad1; } + +void DataReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t DataReliablePdu::getPad2() const { return _pad2; } + +void DataReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t DataReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t DataReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& DataReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& DataReliablePdu::getFixedDatumRecords() const { + return _fixedDatumRecords; +} + +void DataReliablePdu::setFixedDatumRecords(const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& DataReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& DataReliablePdu::getVariableDatumRecords() + const { + return _variableDatumRecords; +} + +void DataReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void DataReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void DataReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool DataReliablePdu::operator==(const DataReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/DataReliablePdu.h b/src/dis6/simulation_management_with_reliability/DataReliablePdu.h new file mode 100644 index 00000000..fd1c03a2 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/DataReliablePdu.h @@ -0,0 +1,113 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.10: issued in response to a data query R or set dataR pdu. +// Needs manual intervention to fix padding on variable datums. UNFINSIHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class DataReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** Request ID */ + uint32_t _requestID; + + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + DataReliablePdu(); + virtual ~DataReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/EventReportReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/EventReportReliablePdu.cpp new file mode 100644 index 00000000..71dc53e9 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/EventReportReliablePdu.cpp @@ -0,0 +1,183 @@ +#include "dis6/EventReportReliablePdu.h" + +using namespace DIS; + +EventReportReliablePdu::EventReportReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _eventType(0), + _pad1(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(61); +} + +EventReportReliablePdu::~EventReportReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint16_t EventReportReliablePdu::getEventType() const { + return _eventType; +} + +void EventReportReliablePdu::setEventType(uint16_t pX) { + _eventType = pX; +} + +uint32_t EventReportReliablePdu::getPad1() const { return _pad1; } + +void EventReportReliablePdu::setPad1(uint32_t pX) { _pad1 = pX; } + +uint32_t EventReportReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t EventReportReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& EventReportReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& EventReportReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void EventReportReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& EventReportReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& +EventReportReliablePdu::getVariableDatumRecords() const { + return _variableDatumRecords; +} + +void EventReportReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void EventReportReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _eventType; + dataStream << _pad1; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void EventReportReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _eventType; + dataStream >> _pad1; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool EventReportReliablePdu::operator==( + const EventReportReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_eventType == rhs._eventType)) ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int EventReportReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 2; // _eventType + marshalSize = marshalSize + 4; // _pad1 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/EventReportReliablePdu.h b/src/dis6/simulation_management_with_reliability/EventReportReliablePdu.h new file mode 100644 index 00000000..fb994026 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/EventReportReliablePdu.h @@ -0,0 +1,102 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.11: reports the occurance of a significatnt event to the +// simulation manager. Needs manual intervention to fix padding in variable +// datums. UNFINISHED. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EventReportReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** Event type */ + uint16_t _eventType; + + /** padding */ + uint32_t _pad1; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + EventReportReliablePdu(); + virtual ~EventReportReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getEventType() const; + void setEventType(uint16_t pX); + + uint32_t getPad1() const; + void setPad1(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EventReportReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/RecordQueryReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/RecordQueryReliablePdu.cpp new file mode 100644 index 00000000..6272b77a --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/RecordQueryReliablePdu.cpp @@ -0,0 +1,175 @@ +#include "dis6/RecordQueryReliablePdu.h" + +using namespace DIS; + +RecordQueryReliablePdu::RecordQueryReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requestID(0), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _eventType(0), + _time(0), + _numberOfRecords(0) { + setPduType(63); +} + +RecordQueryReliablePdu::~RecordQueryReliablePdu() { _recordIDs.clear(); } + +uint32_t RecordQueryReliablePdu::getRequestID() const { return _requestID; } + +void RecordQueryReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint8_t RecordQueryReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void RecordQueryReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t RecordQueryReliablePdu::getPad1() const { return _pad1; } + +void RecordQueryReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t RecordQueryReliablePdu::getPad2() const { return _pad2; } + +void RecordQueryReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint16_t RecordQueryReliablePdu::getEventType() const { + return _eventType; +} + +void RecordQueryReliablePdu::setEventType(uint16_t pX) { + _eventType = pX; +} + +uint32_t RecordQueryReliablePdu::getTime() const { return _time; } + +void RecordQueryReliablePdu::setTime(uint32_t pX) { _time = pX; } + +uint32_t RecordQueryReliablePdu::getNumberOfRecords() const { + return _recordIDs.size(); +} + +std::vector& RecordQueryReliablePdu::getRecordIDs() { + return _recordIDs; +} + +const std::vector& RecordQueryReliablePdu::getRecordIDs() const { + return _recordIDs; +} + +void RecordQueryReliablePdu::setRecordIDs( + const std::vector& pX) { + _recordIDs = pX; +} + +void RecordQueryReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _eventType; + dataStream << _time; + dataStream << (uint32_t)_recordIDs.size(); + + for (size_t idx = 0; idx < _recordIDs.size(); idx++) { + FourByteChunk x = _recordIDs[idx]; + x.marshal(dataStream); + } +} + +void RecordQueryReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _eventType; + dataStream >> _time; + dataStream >> _numberOfRecords; + + _recordIDs.clear(); + for (size_t idx = 0; idx < _numberOfRecords; idx++) { + FourByteChunk x; + x.unmarshal(dataStream); + _recordIDs.push_back(x); + } +} + +bool RecordQueryReliablePdu::operator==( + const RecordQueryReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_eventType == rhs._eventType)) ivarsEqual = false; + if (!(_time == rhs._time)) ivarsEqual = false; + + for (size_t idx = 0; idx < _recordIDs.size(); idx++) { + if (!(_recordIDs[idx] == rhs._recordIDs[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int RecordQueryReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 2; // _eventType + marshalSize = marshalSize + 4; // _time + marshalSize = marshalSize + 4; // _numberOfRecords + + for (uint64_t idx = 0; idx < _recordIDs.size(); idx++) { + FourByteChunk listElement = _recordIDs[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/RecordQueryReliablePdu.h b/src/dis6/simulation_management_with_reliability/RecordQueryReliablePdu.h new file mode 100644 index 00000000..554862c9 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/RecordQueryReliablePdu.h @@ -0,0 +1,112 @@ +#pragma once + +#include + +#include "dis6/FourByteChunk.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.13: A request for one or more records of data from an entity. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class RecordQueryReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** request ID */ + uint32_t _requestID; + + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding. The spec is unclear and contradictory here. */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** event type */ + uint16_t _eventType; + + /** time */ + uint32_t _time; + + /** numberOfRecords */ + uint32_t _numberOfRecords; + + /** record IDs */ + std::vector _recordIDs; + + public: + RecordQueryReliablePdu(); + virtual ~RecordQueryReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint16_t getEventType() const; + void setEventType(uint16_t pX); + + uint32_t getTime() const; + void setTime(uint32_t pX); + + uint32_t getNumberOfRecords() const; + + std::vector& getRecordIDs(); + const std::vector& getRecordIDs() const; + void setRecordIDs(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RecordQueryReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/RemoveEntityReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/RemoveEntityReliablePdu.cpp new file mode 100644 index 00000000..c47976df --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/RemoveEntityReliablePdu.cpp @@ -0,0 +1,112 @@ +#include "dis6/RemoveEntityReliablePdu.h" + +using namespace DIS; + +RemoveEntityReliablePdu::RemoveEntityReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0) { + setPduType(52); +} + +RemoveEntityReliablePdu::~RemoveEntityReliablePdu() {} + +uint8_t RemoveEntityReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void RemoveEntityReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t RemoveEntityReliablePdu::getPad1() const { return _pad1; } + +void RemoveEntityReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t RemoveEntityReliablePdu::getPad2() const { return _pad2; } + +void RemoveEntityReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t RemoveEntityReliablePdu::getRequestID() const { + return _requestID; +} + +void RemoveEntityReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void RemoveEntityReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; +} + +void RemoveEntityReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; +} + +bool RemoveEntityReliablePdu::operator==( + const RemoveEntityReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int RemoveEntityReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/RemoveEntityReliablePdu.h b/src/dis6/simulation_management_with_reliability/RemoveEntityReliablePdu.h new file mode 100644 index 00000000..f072a381 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/RemoveEntityReliablePdu.h @@ -0,0 +1,84 @@ +#pragma once + +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.2: Removal of an entity , reliable. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class RemoveEntityReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Request ID */ + uint32_t _requestID; + + public: + RemoveEntityReliablePdu(); + virtual ~RemoveEntityReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RemoveEntityReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/SetDataReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/SetDataReliablePdu.cpp new file mode 100644 index 00000000..98e579ef --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/SetDataReliablePdu.cpp @@ -0,0 +1,201 @@ +#include "dis6/SetDataReliablePdu.h" + +using namespace DIS; + +SetDataReliablePdu::SetDataReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(59); +} + +SetDataReliablePdu::~SetDataReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint8_t SetDataReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void SetDataReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t SetDataReliablePdu::getPad1() const { return _pad1; } + +void SetDataReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t SetDataReliablePdu::getPad2() const { return _pad2; } + +void SetDataReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t SetDataReliablePdu::getRequestID() const { return _requestID; } + +void SetDataReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t SetDataReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t SetDataReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& SetDataReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& SetDataReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void SetDataReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& SetDataReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& SetDataReliablePdu::getVariableDatumRecords() + const { + return _variableDatumRecords; +} + +void SetDataReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void SetDataReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void SetDataReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool SetDataReliablePdu::operator==(const SetDataReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int SetDataReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/SetDataReliablePdu.h b/src/dis6/simulation_management_with_reliability/SetDataReliablePdu.h new file mode 100644 index 00000000..0059fa13 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/SetDataReliablePdu.h @@ -0,0 +1,114 @@ +#pragma once + +#include + +#include "dis6/FixedDatum.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis6/VariableDatum.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.9: initializing or chaning internal state information, +// reliable. Needs manual intervention to fix padding on variable datums. +// UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SetDataReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Request ID */ + uint32_t _requestID; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + SetDataReliablePdu(); + virtual ~SetDataReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SetDataReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/SetRecordReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/SetRecordReliablePdu.cpp new file mode 100644 index 00000000..2001db90 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/SetRecordReliablePdu.cpp @@ -0,0 +1,151 @@ +#include "dis6/SetRecordReliablePdu.h" + +using namespace DIS; + +SetRecordReliablePdu::SetRecordReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requestID(0), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _numberOfRecordSets(0) { + setPduType(64); +} + +SetRecordReliablePdu::~SetRecordReliablePdu() { _recordSets.clear(); } + +uint32_t SetRecordReliablePdu::getRequestID() const { return _requestID; } + +void SetRecordReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint8_t SetRecordReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void SetRecordReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t SetRecordReliablePdu::getPad1() const { return _pad1; } + +void SetRecordReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t SetRecordReliablePdu::getPad2() const { return _pad2; } + +void SetRecordReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t SetRecordReliablePdu::getNumberOfRecordSets() const { + return _recordSets.size(); +} + +std::vector& SetRecordReliablePdu::getRecordSets() { + return _recordSets; +} + +const std::vector& SetRecordReliablePdu::getRecordSets() const { + return _recordSets; +} + +void SetRecordReliablePdu::setRecordSets(const std::vector& pX) { + _recordSets = pX; +} + +void SetRecordReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << (uint32_t)_recordSets.size(); + + for (size_t idx = 0; idx < _recordSets.size(); idx++) { + RecordSet x = _recordSets[idx]; + x.marshal(dataStream); + } +} + +void SetRecordReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _numberOfRecordSets; + + _recordSets.clear(); + for (size_t idx = 0; idx < _numberOfRecordSets; idx++) { + RecordSet x; + x.unmarshal(dataStream); + _recordSets.push_back(x); + } +} + +bool SetRecordReliablePdu::operator==(const SetRecordReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _recordSets.size(); idx++) { + if (!(_recordSets[idx] == rhs._recordSets[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int SetRecordReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _numberOfRecordSets + + for (uint64_t idx = 0; idx < _recordSets.size(); idx++) { + RecordSet listElement = _recordSets[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/SetRecordReliablePdu.h b/src/dis6/simulation_management_with_reliability/SetRecordReliablePdu.h new file mode 100644 index 00000000..a4cf7d15 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/SetRecordReliablePdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis6/RecordSet.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.14: Initializing or changing internal parameter info. Needs +// manual intervention to fix padding in recrod set PDUs. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SetRecordReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** request ID */ + uint32_t _requestID; + + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding. The spec is unclear and contradictory here. */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Number of record sets in list */ + uint32_t _numberOfRecordSets; + + /** record sets */ + std::vector _recordSets; + + public: + SetRecordReliablePdu(); + virtual ~SetRecordReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getNumberOfRecordSets() const; + + std::vector& getRecordSets(); + const std::vector& getRecordSets() const; + void setRecordSets(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SetRecordReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.cpp b/src/dis6/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.cpp new file mode 100644 index 00000000..67bcecec --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.cpp @@ -0,0 +1,110 @@ +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" + +using namespace DIS; + +SimulationManagementWithReliabilityFamilyPdu:: + SimulationManagementWithReliabilityFamilyPdu() + : Pdu(), _originatingEntityID(), _receivingEntityID() { + setProtocolFamily(10); +} + +SimulationManagementWithReliabilityFamilyPdu:: + ~SimulationManagementWithReliabilityFamilyPdu() {} + +EntityID& +SimulationManagementWithReliabilityFamilyPdu::getOriginatingEntityID() { + return _originatingEntityID; +} + +const EntityID& +SimulationManagementWithReliabilityFamilyPdu::getOriginatingEntityID() const { + return _originatingEntityID; +} + +void SimulationManagementWithReliabilityFamilyPdu::setOriginatingEntityID( + const EntityID& pX) { + _originatingEntityID = pX; +} + +EntityID& SimulationManagementWithReliabilityFamilyPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& +SimulationManagementWithReliabilityFamilyPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void SimulationManagementWithReliabilityFamilyPdu::setReceivingEntityID( + const EntityID& pX) { + _receivingEntityID = pX; +} + +void SimulationManagementWithReliabilityFamilyPdu::marshal( + DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first + _originatingEntityID.marshal(dataStream); + _receivingEntityID.marshal(dataStream); +} + +void SimulationManagementWithReliabilityFamilyPdu::unmarshal( + DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first + _originatingEntityID.unmarshal(dataStream); + _receivingEntityID.unmarshal(dataStream); +} + +bool SimulationManagementWithReliabilityFamilyPdu::operator==( + const SimulationManagementWithReliabilityFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + if (!(_originatingEntityID == rhs._originatingEntityID)) ivarsEqual = false; + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + + return ivarsEqual; +} + +int SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + marshalSize = + marshalSize + + _originatingEntityID.getMarshalledSize(); // _originatingEntityID + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.h b/src/dis6/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.h new file mode 100644 index 00000000..3c4ff60d --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.h @@ -0,0 +1,76 @@ +#pragma once + +#include "dis6/EntityID.h" +#include "dis6/Pdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12: Abstract superclass for reliable simulation management PDUs + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SimulationManagementWithReliabilityFamilyPdu + : public Pdu { + protected: + /** Object originatig the request */ + EntityID _originatingEntityID; + + /** Object with which this point object is associated */ + EntityID _receivingEntityID; + + public: + SimulationManagementWithReliabilityFamilyPdu(); + virtual ~SimulationManagementWithReliabilityFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingEntityID(); + const EntityID& getOriginatingEntityID() const; + void setOriginatingEntityID(const EntityID& pX); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + virtual int getMarshalledSize() const; + + bool operator==( + const SimulationManagementWithReliabilityFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/StartResumeReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/StartResumeReliablePdu.cpp new file mode 100644 index 00000000..04f2ec12 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/StartResumeReliablePdu.cpp @@ -0,0 +1,144 @@ +#include "dis6/StartResumeReliablePdu.h" + +using namespace DIS; + +StartResumeReliablePdu::StartResumeReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _realWorldTime(), + _simulationTime(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0) { + setPduType(53); +} + +StartResumeReliablePdu::~StartResumeReliablePdu() {} + +ClockTime& StartResumeReliablePdu::getRealWorldTime() { return _realWorldTime; } + +const ClockTime& StartResumeReliablePdu::getRealWorldTime() const { + return _realWorldTime; +} + +void StartResumeReliablePdu::setRealWorldTime(const ClockTime& pX) { + _realWorldTime = pX; +} + +ClockTime& StartResumeReliablePdu::getSimulationTime() { + return _simulationTime; +} + +const ClockTime& StartResumeReliablePdu::getSimulationTime() const { + return _simulationTime; +} + +void StartResumeReliablePdu::setSimulationTime(const ClockTime& pX) { + _simulationTime = pX; +} + +uint8_t StartResumeReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void StartResumeReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t StartResumeReliablePdu::getPad1() const { return _pad1; } + +void StartResumeReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t StartResumeReliablePdu::getPad2() const { return _pad2; } + +void StartResumeReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t StartResumeReliablePdu::getRequestID() const { return _requestID; } + +void StartResumeReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void StartResumeReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _realWorldTime.marshal(dataStream); + _simulationTime.marshal(dataStream); + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; +} + +void StartResumeReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _realWorldTime.unmarshal(dataStream); + _simulationTime.unmarshal(dataStream); + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; +} + +bool StartResumeReliablePdu::operator==( + const StartResumeReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_realWorldTime == rhs._realWorldTime)) ivarsEqual = false; + if (!(_simulationTime == rhs._simulationTime)) ivarsEqual = false; + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int StartResumeReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime + marshalSize = + marshalSize + _simulationTime.getMarshalledSize(); // _simulationTime + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/StartResumeReliablePdu.h b/src/dis6/simulation_management_with_reliability/StartResumeReliablePdu.h new file mode 100644 index 00000000..37fa23c5 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/StartResumeReliablePdu.h @@ -0,0 +1,99 @@ +#pragma once + +#include "dis6/ClockTime.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.3: Start resume simulation, relaible. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class StartResumeReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** time in real world for this operation to happen */ + ClockTime _realWorldTime; + + /** time in simulation for the simulation to resume */ + ClockTime _simulationTime; + + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Request ID */ + uint32_t _requestID; + + public: + StartResumeReliablePdu(); + virtual ~StartResumeReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + ClockTime& getRealWorldTime(); + const ClockTime& getRealWorldTime() const; + void setRealWorldTime(const ClockTime& pX); + + ClockTime& getSimulationTime(); + const ClockTime& getSimulationTime() const; + void setSimulationTime(const ClockTime& pX); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StartResumeReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/StopFreezeReliablePdu.cpp b/src/dis6/simulation_management_with_reliability/StopFreezeReliablePdu.cpp new file mode 100644 index 00000000..391b86b8 --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/StopFreezeReliablePdu.cpp @@ -0,0 +1,138 @@ +#include "dis6/StopFreezeReliablePdu.h" + +using namespace DIS; + +StopFreezeReliablePdu::StopFreezeReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _realWorldTime(), + _reason(0), + _frozenBehavior(0), + _requiredReliablityService(0), + _pad1(0), + _requestID(0) { + setPduType(54); +} + +StopFreezeReliablePdu::~StopFreezeReliablePdu() {} + +ClockTime& StopFreezeReliablePdu::getRealWorldTime() { return _realWorldTime; } + +const ClockTime& StopFreezeReliablePdu::getRealWorldTime() const { + return _realWorldTime; +} + +void StopFreezeReliablePdu::setRealWorldTime(const ClockTime& pX) { + _realWorldTime = pX; +} + +uint8_t StopFreezeReliablePdu::getReason() const { return _reason; } + +void StopFreezeReliablePdu::setReason(uint8_t pX) { _reason = pX; } + +uint8_t StopFreezeReliablePdu::getFrozenBehavior() const { + return _frozenBehavior; +} + +void StopFreezeReliablePdu::setFrozenBehavior(uint8_t pX) { + _frozenBehavior = pX; +} + +uint8_t StopFreezeReliablePdu::getRequiredReliablityService() const { + return _requiredReliablityService; +} + +void StopFreezeReliablePdu::setRequiredReliablityService(uint8_t pX) { + _requiredReliablityService = pX; +} + +uint8_t StopFreezeReliablePdu::getPad1() const { return _pad1; } + +void StopFreezeReliablePdu::setPad1(uint8_t pX) { _pad1 = pX; } + +uint32_t StopFreezeReliablePdu::getRequestID() const { return _requestID; } + +void StopFreezeReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void StopFreezeReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _realWorldTime.marshal(dataStream); + dataStream << _reason; + dataStream << _frozenBehavior; + dataStream << _requiredReliablityService; + dataStream << _pad1; + dataStream << _requestID; +} + +void StopFreezeReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _realWorldTime.unmarshal(dataStream); + dataStream >> _reason; + dataStream >> _frozenBehavior; + dataStream >> _requiredReliablityService; + dataStream >> _pad1; + dataStream >> _requestID; +} + +bool StopFreezeReliablePdu::operator==(const StopFreezeReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_realWorldTime == rhs._realWorldTime)) ivarsEqual = false; + if (!(_reason == rhs._reason)) ivarsEqual = false; + if (!(_frozenBehavior == rhs._frozenBehavior)) ivarsEqual = false; + if (!(_requiredReliablityService == rhs._requiredReliablityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int StopFreezeReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime + marshalSize = marshalSize + 1; // _reason + marshalSize = marshalSize + 1; // _frozenBehavior + marshalSize = marshalSize + 1; // _requiredReliablityService + marshalSize = marshalSize + 1; // _pad1 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/simulation_management_with_reliability/StopFreezeReliablePdu.h b/src/dis6/simulation_management_with_reliability/StopFreezeReliablePdu.h new file mode 100644 index 00000000..a918999d --- /dev/null +++ b/src/dis6/simulation_management_with_reliability/StopFreezeReliablePdu.h @@ -0,0 +1,98 @@ +#pragma once + +#include "dis6/ClockTime.h" +#include "dis6/SimulationManagementWithReliabilityFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.4: Stop freeze simulation, relaible. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class StopFreezeReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** time in real world for this operation to happen */ + ClockTime _realWorldTime; + + /** Reason for stopping/freezing simulation */ + uint8_t _reason; + + /** internal behvior of the simulation while frozen */ + uint8_t _frozenBehavior; + + /** reliablity level */ + uint8_t _requiredReliablityService; + + /** padding */ + uint8_t _pad1; + + /** Request ID */ + uint32_t _requestID; + + public: + StopFreezeReliablePdu(); + virtual ~StopFreezeReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + ClockTime& getRealWorldTime(); + const ClockTime& getRealWorldTime() const; + void setRealWorldTime(const ClockTime& pX); + + uint8_t getReason() const; + void setReason(uint8_t pX); + + uint8_t getFrozenBehavior() const; + void setFrozenBehavior(uint8_t pX); + + uint8_t getRequiredReliablityService() const; + void setRequiredReliablityService(uint8_t pX); + + uint8_t getPad1() const; + void setPad1(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StopFreezeReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/symbolic_names.h b/src/dis6/symbolic_names.h deleted file mode 100644 index 37376534..00000000 --- a/src/dis6/symbolic_names.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include - -/** - * Symbolic names as defined in 5.1.4 - */ -namespace DIS { -const unsigned int AGG_HRT_BEAT_TIMER = 30U; //s -const unsigned int AGG_RESPONSE_DFLT = 10U; //s -const unsigned short ALL_AGGS = 0xFFFFU; -const unsigned short ALL_APPLIC = 0xFFFFU; -const unsigned short ALL_ENTITIES = 0xFFFFU; -const unsigned short ALL_OBJECTS = 0xFFFFU; -const unsigned short ALL_SITES = 0xFFFFU; -const unsigned int APPEAR_HRT_BEAT_TIMER = 60U; //se -const unsigned int COLLISION_ELASTIC_TO = 5U; //s -const unsigned int COLLISION_THRSH_DFLT = 1U; //m/s - -const unsigned int DRA_ORIENT_THRSH_DFLT = 3U; //degrees -const unsigned int DRA_POS_THRSH_DFLT = 1U; //m -const unsigned int EE_AZ_THRSH_DFLT = 1U; //degrees -const unsigned int EE_EL_THRSH_DFLT = 1U; //degrees - -const unsigned int EP_DIMENSION_THRSH_DFLT = 1U; //m -const unsigned short EP_NO_SEQUENCE = 0xFFFFU; -const unsigned int EP_POS_THRSH_DFLT = 1U; //m shift -const unsigned int EP_STATE_THRSH_DFLT = 10U; //% -const unsigned int GD_HRT_BEAT_TIMER = 15U; //min -const unsigned int HRT_BEAT_MOVE_TIMER = 2U; //s -const float HRT_BEAT_MPLIER = 2.4f; -const unsigned int HRT_BEAT_TIMER = 5U; //s -const unsigned int IFF_ATC_NAVAIDS_DFLT = 10U; //s -const unsigned int IFF_ATC_NAVAIDS_CLAT = 2U; //s -const unsigned int LE_HRT_BEAT_TIMER = 30; //s -//MINEFIELD_CHANGE_DFLT between 0 and MINEFIELD_DATA_DFLT -const unsigned int MINEFIELD_DATA_DFLT = 5U; //s -const unsigned int MINEFIELD_DATA_TIMEOUT_DLFT = 5U; //s -const unsigned int MINEFIELD_DFLT = 5U; //s -const unsigned int MINEFIELD_RESPONSE_DFLT = 1U; //s - -const unsigned short NO_AGG = 0U; -const unsigned short NO_APPLIC = 0U; -const unsigned short NO_ENTITY = 0U; - -const unsigned int NO_FIRE_MISSION = 0U; - -const unsigned short NO_OBJECT = 0U; -const unsigned short NO_SITE = 0U; - -const unsigned int REPAR_REC_T1_DFLT = 5U; //s -const unsigned int REPAR_SUP_T1_DFLT = 12U; //s -const unsigned int REPAR_SUP_T2_DFLT = 12U; //s -const unsigned int RESUP_REC_T1_DFLT = 5U; //s -const unsigned int RESUP_REC_T2_DFLT = 55U; //s -const unsigned int RESUP_SUP_T1_DFLT = 1U; //min -const unsigned short RQST_ASSIGN_ID = 0xFFFEU; -const unsigned int SEES_NDA_THRSH_DFLT = 2U; //degrees in the axis of deflection -const unsigned int SEES_PS_THRSH_DFLT = 10U; //% of the maximum value of the Power Setting -const unsigned int SEES_RPM_DELTA_THRSH_DFLT = 5U; //% of the maximum engine speed in RPM -const unsigned int SEES_STATE_UPDATE_DFLT = 3U; //min -const unsigned int SM_REL_RETRY_CNT_DFLT = 3U; -const unsigned int SM_REL_RETRY_DELAY_DFLT = 2U; //s - -const unsigned int TARGETS_IN_TJ_FIELD_DFLT = 10U; -const unsigned int TI_TIMER1_DFLT = 2U; //s -const unsigned int TI_TIMER2_DFLT = 12U; //s -const unsigned int TR_TIMER1_DFLT = 5U; //s -const unsigned int TR_TIMER2_DFLT = 60U; //s -const unsigned int TRANS_ORIENT_THRSH_DFLT = 180U; //degrees -const unsigned int TRANS_POS_THRSH_DFLT = 500U; //m -const unsigned int UA_LOCATION_CHANGE_DELTA = 10U; //m -const unsigned int UA_ORIENTATION_CHANGE_DELTA = 2U; //degrees -const unsigned int UA_SRPM_CHANGE_DELTA = 5U; //% of maximum shaft speed in RPM -const unsigned int UA_SRPM_ROC_CHANGE_DELTA = 10U; //% of maximum rate of change -const unsigned int UA_STATE_UPDATE_HRT_BEAT_TIMER = 3U; //min - - -/** If you want to have the EntityID constants below, you - * need to add the constructor EntityID(unsigned short,unsigned short,unsigned short) - * and recompile open-dis - * - */ -/* -const DIS::EntityID D_SPOT_NO_ENTITY(NO_SITE, NO_APPLIC, NO_ENTITY); -const DIS::EntityID ENTITY_ID_UNKNOWN(NO_SITE, NO_APPLIC, NO_ENTITY); -const DIS::EntityID MUNITION_NOT_TRACKED(NO_SITE, NO_APPLIC, NO_ENTITY); -const DIS::EntityID NO_ENTITY_IMPACTED(NO_SITE, NO_APPLIC, NO_ENTITY); -const DIS::EntityID NO_LOCATION(NO_SITE, NO_APPLIC, NO_ENTITY); -const DIS::EntityID NO_SPECIFIC_ENTITY(NO_SITE, NO_APPLIC, NO_ENTITY); -const DIS::EntityID TARGET_ID_UNKNOWN(NO_SITE, NO_APPLIC, NO_ENTITY); -*/ -} - diff --git a/src/dis6/synthetic_environment/ArealObjectStatePdu.cpp b/src/dis6/synthetic_environment/ArealObjectStatePdu.cpp new file mode 100644 index 00000000..1c8befde --- /dev/null +++ b/src/dis6/synthetic_environment/ArealObjectStatePdu.cpp @@ -0,0 +1,253 @@ +#include "dis6/synthetic_environment/ArealObjectStatePdu.h" + +using namespace DIS; + +ArealObjectStatePdu::ArealObjectStatePdu() + : _updateNumber(0), + _forceID(0), + _modifications(0), + + _numberOfPoints(0) { + SetPduType(45); +} + +ArealObjectStatePdu::~ArealObjectStatePdu() { _objectLocation.clear(); } + +dis::EntityID& ArealObjectStatePdu::getObjectID() { return _objectID; } + +const dis::EntityID& ArealObjectStatePdu::getObjectID() const { + return _objectID; +} + +void ArealObjectStatePdu::setObjectID(const dis::EntityID& pX) { + _objectID = pX; +} + +dis::EntityID& ArealObjectStatePdu::getReferencedObjectID() { + return _referencedObjectID; +} + +const dis::EntityID& ArealObjectStatePdu::getReferencedObjectID() const { + return _referencedObjectID; +} + +void ArealObjectStatePdu::setReferencedObjectID(const dis::EntityID& pX) { + _referencedObjectID = pX; +} + +uint16_t ArealObjectStatePdu::getUpdateNumber() const { return _updateNumber; } + +void ArealObjectStatePdu::setUpdateNumber(uint16_t pX) { _updateNumber = pX; } + +uint8_t ArealObjectStatePdu::getForceID() const { return _forceID; } + +void ArealObjectStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t ArealObjectStatePdu::getModifications() const { return _modifications; } + +void ArealObjectStatePdu::setModifications(uint8_t pX) { _modifications = pX; } + +dis::EntityType& ArealObjectStatePdu::getObjectType() { return _objectType; } + +const dis::EntityType& ArealObjectStatePdu::getObjectType() const { + return _objectType; +} + +void ArealObjectStatePdu::setObjectType(const dis::EntityType& pX) { + _objectType = pX; +} + +SixByteChunk& ArealObjectStatePdu::getObjectAppearance() { + return _objectAppearance; +} + +const SixByteChunk& ArealObjectStatePdu::getObjectAppearance() const { + return _objectAppearance; +} + +void ArealObjectStatePdu::setObjectAppearance(const SixByteChunk& pX) { + _objectAppearance = pX; +} + +uint16_t ArealObjectStatePdu::getNumberOfPoints() const { + return _objectLocation.size(); +} + +SimulationAddress& ArealObjectStatePdu::getRequesterID() { + return _requesterID; +} + +const SimulationAddress& ArealObjectStatePdu::getRequesterID() const { + return _requesterID; +} + +void ArealObjectStatePdu::setRequesterID(const SimulationAddress& pX) { + _requesterID = pX; +} + +SimulationAddress& ArealObjectStatePdu::getReceivingID() { + return _receivingID; +} + +const SimulationAddress& ArealObjectStatePdu::getReceivingID() const { + return _receivingID; +} + +void ArealObjectStatePdu::setReceivingID(const SimulationAddress& pX) { + _receivingID = pX; +} + +std::vector& ArealObjectStatePdu::getObjectLocation() { + return _objectLocation; +} + +const std::vector& ArealObjectStatePdu::getObjectLocation() + const { + return _objectLocation; +} + +void ArealObjectStatePdu::setObjectLocation( + const std::vector& pX) { + _objectLocation = pX; +} + +void ArealObjectStatePdu::marshal(DataStream& dataStream) const { + SyntheticEnvironmentFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _objectID.marshal(dataStream); + _referencedObjectID.marshal(dataStream); + dataStream << _updateNumber; + dataStream << _forceID; + dataStream << _modifications; + _objectType.marshal(dataStream); + _objectAppearance.marshal(dataStream); + dataStream << static_cast(_objectLocation.size()); + _requesterID.marshal(dataStream); + _receivingID.marshal(dataStream); + + for (auto x : _objectLocation) { + x.marshal(dataStream); + } +} + +void ArealObjectStatePdu::unmarshal(DataStream& dataStream) { + SyntheticEnvironmentFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _objectID.unmarshal(dataStream); + _referencedObjectID.unmarshal(dataStream); + dataStream >> _updateNumber; + dataStream >> _forceID; + dataStream >> _modifications; + _objectType.unmarshal(dataStream); + _objectAppearance.unmarshal(dataStream); + dataStream >> _numberOfPoints; + _requesterID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + + _objectLocation.clear(); + for (size_t idx = 0; idx < _numberOfPoints; idx++) { + Vector3Double x; + x.unmarshal(dataStream); + _objectLocation.push_back(x); + } +} + +bool ArealObjectStatePdu::operator==(const ArealObjectStatePdu& rhs) const { + bool ivars_equal = true; + + ivars_equal = SyntheticEnvironmentFamilyPdu::operator==(rhs); + + if (!(_objectID == rhs._objectID)) { + ivars_equal = false; + } + if (!(_referencedObjectID == rhs._referencedObjectID)) { + ivars_equal = false; + } + if (!(_updateNumber == rhs._updateNumber)) { + ivars_equal = false; + } + if (!(_forceID == rhs._forceID)) { + ivars_equal = false; + } + if (!(_modifications == rhs._modifications)) { + ivars_equal = false; + } + if (!(_objectType == rhs._objectType)) { + ivars_equal = false; + } + if (!(_objectAppearance == rhs._objectAppearance)) { + ivars_equal = false; + } + if (!(_requesterID == rhs._requesterID)) { + ivars_equal = false; + } + if (!(_receivingID == rhs._receivingID)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < _objectLocation.size(); idx++) { + if (!(_objectLocation[idx] == rhs._objectLocation[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int ArealObjectStatePdu::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); + marshal_size = marshal_size + _objectID.getMarshalledSize(); // _objectID + marshal_size = + marshal_size + + _referencedObjectID.getMarshalledSize(); // _referencedObjectID + marshal_size = marshal_size + 2; // _updateNumber + marshal_size = marshal_size + 1; // _forceID + marshal_size = marshal_size + 1; // _modifications + marshal_size = marshal_size + _objectType.getMarshalledSize(); // _objectType + marshal_size = marshal_size + + _objectAppearance.getMarshalledSize(); // _objectAppearance + marshal_size = marshal_size + 2; // _numberOfPoints + marshal_size = + marshal_size + _requesterID.getMarshalledSize(); // _requesterID + marshal_size = + marshal_size + _receivingID.getMarshalledSize(); // _receivingID + + for (auto listElement : _objectLocation) { + marshal_size = marshal_size + listElement.getMarshalledSize(); + } + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/ArealObjectStatePdu.h b/src/dis6/synthetic_environment/ArealObjectStatePdu.h new file mode 100644 index 00000000..c9e6fe85 --- /dev/null +++ b/src/dis6/synthetic_environment/ArealObjectStatePdu.h @@ -0,0 +1,139 @@ +#pragma once + +#include + +#include "dis6/common/EntityID.h" +#include "dis6/common/EntityType.h" +#include "dis6/common/SimulationAddress.h" +#include "dis6/common/SixByteChunk.h" +#include "dis6/common/Vector3Double.h" +#include "dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.11.5: Information about the addition/modification of an oobject +// that is geometrically achored to the terrain with a set of three or more +// points that come to a closure. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ArealObjectStatePdu : public SyntheticEnvironmentFamilyPdu { + protected: + /** Object in synthetic environment */ + dis::EntityID _objectID; + + /** Object with which this point object is associated */ + dis::EntityID _referencedObjectID; + + /** unique update number of each state transition of an object */ + uint16_t _updateNumber; + + /** force ID */ + uint8_t _forceID; + + /** modifications enumeration */ + uint8_t _modifications; + + /** Object type */ + dis::EntityType _objectType; + + /** Object appearance */ + SixByteChunk _objectAppearance; + + /** Number of points */ + uint16_t _numberOfPoints; + + /** requesterID */ + SimulationAddress _requesterID; + + /** receiver ID */ + SimulationAddress _receivingID; + + /** location of object */ + std::vector _objectLocation; + + public: + ArealObjectStatePdu(); + virtual ~ArealObjectStatePdu(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + dis::EntityID& getObjectID(); + const dis::EntityID& getObjectID() const; + void setObjectID(const dis::EntityID& pX); + + dis::EntityID& getReferencedObjectID(); + const dis::EntityID& getReferencedObjectID() const; + void setReferencedObjectID(const dis::EntityID& pX); + + uint16_t getUpdateNumber() const; + void setUpdateNumber(uint16_t pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getModifications() const; + void setModifications(uint8_t pX); + + dis::EntityType& getObjectType(); + const dis::EntityType& getObjectType() const; + void setObjectType(const dis::EntityType& pX); + + SixByteChunk& getObjectAppearance(); + const SixByteChunk& getObjectAppearance() const; + void setObjectAppearance(const SixByteChunk& pX); + + uint16_t getNumberOfPoints() const; + + SimulationAddress& getRequesterID(); + const SimulationAddress& getRequesterID() const; + void setRequesterID(const SimulationAddress& pX); + + SimulationAddress& getReceivingID(); + const SimulationAddress& getReceivingID() const; + void setReceivingID(const SimulationAddress& pX); + + std::vector& getObjectLocation(); + const std::vector& getObjectLocation() const; + void setObjectLocation(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ArealObjectStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/CMakeLists.txt b/src/dis6/synthetic_environment/CMakeLists.txt new file mode 100644 index 00000000..f08f9d27 --- /dev/null +++ b/src/dis6/synthetic_environment/CMakeLists.txt @@ -0,0 +1,29 @@ +set(synthetic_environment_hdr + ArealObjectStatePdu.h + EnvironmentalProcessPdu.h + GriddedDataPdu.h + LinearObjectStatePdu.h + PointObjectStatePdu.h + SyntheticEnvironmentFamilyPdu.h +) + +set(synthetic_environment_src + ArealObjectStatePdu.cpp + EnvironmentalProcessPdu.cpp + GriddedDataPdu.cpp + LinearObjectStatePdu.cpp + PointObjectStatePdu.cpp + SyntheticEnvironmentFamilyPdu.cpp +) + +list(TRANSFORM synthetic_environment_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND synthetic_environment_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${synthetic_environment_src}) + +install(FILES ${synthetic_environment_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/synthetic_environment +) diff --git a/src/dis6/synthetic_environment/Environment.cpp b/src/dis6/synthetic_environment/Environment.cpp new file mode 100644 index 00000000..a7a8f53d --- /dev/null +++ b/src/dis6/synthetic_environment/Environment.cpp @@ -0,0 +1,123 @@ +#include "dis6/synthetic_environment/Environment.h" + +using namespace DIS; + +Environment::Environment() + : _environmentType(0), + _length(0), + _index(0), + _padding1(0), + _geometry(0), + _padding2(0) {} + +Environment::~Environment() = default; + +uint32_t Environment::getEnvironmentType() const { return _environmentType; } + +void Environment::setEnvironmentType(uint32_t pX) { _environmentType = pX; } + +uint8_t Environment::getLength() const { return _length; } + +void Environment::setLength(uint8_t pX) { _length = pX; } + +uint8_t Environment::getIndex() const { return _index; } + +void Environment::setIndex(uint8_t pX) { _index = pX; } + +uint8_t Environment::getPadding1() const { return _padding1; } + +void Environment::setPadding1(uint8_t pX) { _padding1 = pX; } + +uint8_t Environment::getGeometry() const { return _geometry; } + +void Environment::setGeometry(uint8_t pX) { _geometry = pX; } + +uint8_t Environment::getPadding2() const { return _padding2; } + +void Environment::setPadding2(uint8_t pX) { _padding2 = pX; } + +void Environment::Marshal(DataStream& dataStream) const { + dataStream << _environmentType; + dataStream << _length; + dataStream << _index; + dataStream << _padding1; + dataStream << _geometry; + dataStream << _padding2; +} + +void Environment::Unmarshal(DataStream& dataStream) { + dataStream >> _environmentType; + dataStream >> _length; + dataStream >> _index; + dataStream >> _padding1; + dataStream >> _geometry; + dataStream >> _padding2; +} + +bool Environment::operator==(const Environment& rhs) const { + bool ivars_equal = true; + + if (!(_environmentType == rhs._environmentType)) { + ivars_equal = false; + } + if (!(_length == rhs._length)) { + ivars_equal = false; + } + if (!(_index == rhs._index)) { + ivars_equal = false; + } + if (!(_padding1 == rhs._padding1)) { + ivars_equal = false; + } + if (!(_geometry == rhs._geometry)) { + ivars_equal = false; + } + if (!(_padding2 == rhs._padding2)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int Environment::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 4; // _environmentType + marshal_size = marshal_size + 1; // _length + marshal_size = marshal_size + 1; // _index + marshal_size = marshal_size + 1; // _padding1 + marshal_size = marshal_size + 1; // _geometry + marshal_size = marshal_size + 1; // _padding2 + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/Environment.h b/src/dis6/synthetic_environment/Environment.h new file mode 100644 index 00000000..e803a813 --- /dev/null +++ b/src/dis6/synthetic_environment/Environment.h @@ -0,0 +1,95 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.40. Information about a geometry, a state associated with a +// geometry, a bounding volume, or an associated entity ID. NOTE: this class +// requires hand coding. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class Environment { + protected: + /** Record type */ + uint32_t _environmentType; + + /** length, in bits */ + uint8_t _length; + + /** Identify the sequentially numbered record index */ + uint8_t _index; + + /** padding */ + uint8_t _padding1; + + /** Geometry or state record */ + uint8_t _geometry; + + /** padding to bring the total size up to a 64 bit boundry */ + uint8_t _padding2; + + public: + Environment(); + virtual ~Environment(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint32_t getEnvironmentType() const; + void setEnvironmentType(uint32_t pX); + + uint8_t getLength() const; + void setLength(uint8_t pX); + + uint8_t getIndex() const; + void setIndex(uint8_t pX); + + uint8_t getPadding1() const; + void setPadding1(uint8_t pX); + + uint8_t getGeometry() const; + void setGeometry(uint8_t pX); + + uint8_t getPadding2() const; + void setPadding2(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Environment& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/EnvironmentalProcessPdu.cpp b/src/dis6/synthetic_environment/EnvironmentalProcessPdu.cpp new file mode 100644 index 00000000..6aea47aa --- /dev/null +++ b/src/dis6/synthetic_environment/EnvironmentalProcessPdu.cpp @@ -0,0 +1,195 @@ +#include "dis6/synthetic_environment/EnvironmentalProcessPdu.h" + +using namespace DIS; + +EnvironmentalProcessPdu::EnvironmentalProcessPdu() + : _modelType(0), + _environmentStatus(0), + _numberOfEnvironmentRecords(0), + _sequenceNumber(0) { + SetPduType(41); +} + +EnvironmentalProcessPdu::~EnvironmentalProcessPdu() { + _environmentRecords.clear(); +} + +dis::EntityID& EnvironmentalProcessPdu::getEnvironementalProcessID() { + return _environementalProcessID; +} + +const dis::EntityID& EnvironmentalProcessPdu::getEnvironementalProcessID() + const { + return _environementalProcessID; +} + +void EnvironmentalProcessPdu::setEnvironementalProcessID( + const dis::EntityID& pX) { + _environementalProcessID = pX; +} + +dis::EntityType& EnvironmentalProcessPdu::getEnvironmentType() { + return _environmentType; +} + +const dis::EntityType& EnvironmentalProcessPdu::getEnvironmentType() const { + return _environmentType; +} + +void EnvironmentalProcessPdu::setEnvironmentType(const dis::EntityType& pX) { + _environmentType = pX; +} + +uint8_t EnvironmentalProcessPdu::getModelType() const { return _modelType; } + +void EnvironmentalProcessPdu::setModelType(uint8_t pX) { _modelType = pX; } + +uint8_t EnvironmentalProcessPdu::getEnvironmentStatus() const { + return _environmentStatus; +} + +void EnvironmentalProcessPdu::setEnvironmentStatus(uint8_t pX) { + _environmentStatus = pX; +} + +uint8_t EnvironmentalProcessPdu::getNumberOfEnvironmentRecords() const { + return _environmentRecords.size(); +} + +uint16_t EnvironmentalProcessPdu::getSequenceNumber() const { + return _sequenceNumber; +} + +void EnvironmentalProcessPdu::setSequenceNumber(uint16_t pX) { + _sequenceNumber = pX; +} + +std::vector& EnvironmentalProcessPdu::getEnvironmentRecords() { + return _environmentRecords; +} + +const std::vector& EnvironmentalProcessPdu::getEnvironmentRecords() + const { + return _environmentRecords; +} + +void EnvironmentalProcessPdu::setEnvironmentRecords( + const std::vector& pX) { + _environmentRecords = pX; +} + +void EnvironmentalProcessPdu::marshal(DataStream& dataStream) const { + SyntheticEnvironmentFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _environementalProcessID.Marshal(dataStream); + _environmentType.Marshal(dataStream); + dataStream << _modelType; + dataStream << _environmentStatus; + dataStream << static_cast(_environmentRecords.size()); + dataStream << _sequenceNumber; + + for (const auto& x : _environmentRecords) { + x.marshal(dataStream); + } +} + +void EnvironmentalProcessPdu::unmarshal(DataStream& dataStream) { + SyntheticEnvironmentFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _environementalProcessID.Unmarshal(dataStream); + _environmentType.Unmarshal(dataStream); + dataStream >> _modelType; + dataStream >> _environmentStatus; + dataStream >> _numberOfEnvironmentRecords; + dataStream >> _sequenceNumber; + + _environmentRecords.clear(); + for (size_t idx = 0; idx < _numberOfEnvironmentRecords; idx++) { + Environment x; + x.unmarshal(dataStream); + _environmentRecords.push_back(x); + } +} + +bool EnvironmentalProcessPdu::operator==( + const EnvironmentalProcessPdu& rhs) const { + bool ivars_equal = true; + + ivars_equal = SyntheticEnvironmentFamilyPdu::operator==(rhs); + + if (!(_environementalProcessID == rhs._environementalProcessID)) { + ivars_equal = false; + } + if (!(_environmentType == rhs._environmentType)) { + ivars_equal = false; + } + if (!(_modelType == rhs._modelType)) { + ivars_equal = false; + } + if (!(_environmentStatus == rhs._environmentStatus)) { + ivars_equal = false; + } + if (!(_sequenceNumber == rhs._sequenceNumber)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < _environmentRecords.size(); idx++) { + if (!(_environmentRecords[idx] == rhs._environmentRecords[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int EnvironmentalProcessPdu::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); + marshal_size = + marshal_size + + _environementalProcessID.GetMarshalledSize(); // _environementalProcessID + marshal_size = + marshal_size + _environmentType.GetMarshalledSize(); // _environmentType + marshal_size = marshal_size + 1; // _modelType + marshal_size = marshal_size + 1; // _environmentStatus + marshal_size = marshal_size + 1; // _numberOfEnvironmentRecords + marshal_size = marshal_size + 2; // _sequenceNumber + + for (const auto& list_element : _environmentRecords) { + marshal_size = marshal_size + list_element.getMarshalledSize(); + } + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/EnvironmentalProcessPdu.h b/src/dis6/synthetic_environment/EnvironmentalProcessPdu.h new file mode 100644 index 00000000..c7576e20 --- /dev/null +++ b/src/dis6/synthetic_environment/EnvironmentalProcessPdu.h @@ -0,0 +1,110 @@ +#pragma once + +#include + +#include "dis6/common/EntityID.h" +#include "dis6/common/EntityType.h" +#include "dis6/synthetic_environment/Environment.h" +#include "dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.11.1: Information about environmental effects and processes. This +// requires manual cleanup. the environmental record is variable, as is +// the padding. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class EnvironmentalProcessPdu : public SyntheticEnvironmentFamilyPdu { + protected: + /** Environmental process ID */ + dis::EntityID _environementalProcessID; + + /** Environment type */ + dis::EntityType _environmentType; + + /** model type */ + uint8_t _modelType; + + /** Environment status */ + uint8_t _environmentStatus; + + /** number of environment records */ + uint8_t _numberOfEnvironmentRecords; + + /** PDU sequence number for the environmentla process if pdu sequencing + * required */ + uint16_t _sequenceNumber; + + /** environemt records */ + std::vector _environmentRecords; + + public: + EnvironmentalProcessPdu(); + virtual ~EnvironmentalProcessPdu(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + dis::EntityID& getEnvironementalProcessID(); + const dis::EntityID& getEnvironementalProcessID() const; + void setEnvironementalProcessID(const dis::EntityID& pX); + + dis::EntityType& getEnvironmentType(); + const dis::EntityType& getEnvironmentType() const; + void setEnvironmentType(const dis::EntityType& pX); + + uint8_t getModelType() const; + void setModelType(uint8_t pX); + + uint8_t getEnvironmentStatus() const; + void setEnvironmentStatus(uint8_t pX); + + uint8_t getNumberOfEnvironmentRecords() const; + + uint16_t getSequenceNumber() const; + void setSequenceNumber(uint16_t pX); + + std::vector& getEnvironmentRecords(); + const std::vector& getEnvironmentRecords() const; + void setEnvironmentRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EnvironmentalProcessPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/GridAxisRecord.cpp b/src/dis6/synthetic_environment/GridAxisRecord.cpp new file mode 100644 index 00000000..475ef253 --- /dev/null +++ b/src/dis6/synthetic_environment/GridAxisRecord.cpp @@ -0,0 +1,81 @@ +#include "dis6/synthetic_environment/GridAxisRecord.h" + +using namespace DIS; + +GridAxisRecord::GridAxisRecord() : _sampleType(0), _dataRepresentation(0) {} + +GridAxisRecord::~GridAxisRecord() = default; + +uint16_t GridAxisRecord::getSampleType() const { return _sampleType; } + +void GridAxisRecord::setSampleType(uint16_t pX) { _sampleType = pX; } + +uint16_t GridAxisRecord::getDataRepresentation() const { + return _dataRepresentation; +} + +void GridAxisRecord::setDataRepresentation(uint16_t pX) { + _dataRepresentation = pX; +} + +void GridAxisRecord::Marshal(DataStream& dataStream) const { + dataStream << _sampleType; + dataStream << _dataRepresentation; +} + +void GridAxisRecord::Unmarshal(DataStream& dataStream) { + dataStream >> _sampleType; + dataStream >> _dataRepresentation; +} + +bool GridAxisRecord::operator==(const GridAxisRecord& rhs) const { + bool ivars_equal = true; + + if (!(_sampleType == rhs._sampleType)) { + ivars_equal = false; + } + if (!(_dataRepresentation == rhs._dataRepresentation)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int GridAxisRecord::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 2; // _sampleType + marshal_size = marshal_size + 2; // _dataRepresentation + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/GridAxisRecord.h b/src/dis6/synthetic_environment/GridAxisRecord.h new file mode 100644 index 00000000..2b2513e6 --- /dev/null +++ b/src/dis6/synthetic_environment/GridAxisRecord.h @@ -0,0 +1,69 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.2.44: Grid data record, a common abstract superclass for several subtypes + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class GridAxisRecord { + protected: + /** type of environmental sample */ + uint16_t _sampleType; + + /** value that describes data representation */ + uint16_t _dataRepresentation; + + public: + GridAxisRecord(); + virtual ~GridAxisRecord(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint16_t getSampleType() const; + void setSampleType(uint16_t pX); + + uint16_t getDataRepresentation() const; + void setDataRepresentation(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const GridAxisRecord& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/GridAxisRecordRepresentation0.cpp b/src/dis6/synthetic_environment/GridAxisRecordRepresentation0.cpp new file mode 100644 index 00000000..f6a8e8b1 --- /dev/null +++ b/src/dis6/synthetic_environment/GridAxisRecordRepresentation0.cpp @@ -0,0 +1,102 @@ +#include "dis6/synthetic_environment/GridAxisRecordRepresentation0.h" + +using namespace DIS; + +GridAxisRecordRepresentation0::GridAxisRecordRepresentation0() + : _numberOfBytes(0) {} + +GridAxisRecordRepresentation0::~GridAxisRecordRepresentation0() { + _dataValues.clear(); +} + +uint16_t GridAxisRecordRepresentation0::getNumberOfBytes() const { + return _dataValues.size(); +} + +std::vector& GridAxisRecordRepresentation0::getDataValues() { + return _dataValues; +} + +const std::vector& GridAxisRecordRepresentation0::getDataValues() + const { + return _dataValues; +} + +void GridAxisRecordRepresentation0::setDataValues( + const std::vector& pX) { + _dataValues = pX; +} + +void GridAxisRecordRepresentation0::marshal(DataStream& dataStream) const { + GridAxisRecord::marshal( + dataStream); // Marshal information in superclass first + dataStream << static_cast(_dataValues.size()); + + for (const auto& byte : _dataValues) { + dataStream << byte; + } +} + +void GridAxisRecordRepresentation0::unmarshal(DataStream& dataStream) { + GridAxisRecord::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _numberOfBytes; + + _dataValues.clear(); + for (auto idx = 0; idx < _numberOfBytes; ++idx) { + uint8_t x; + dataStream >> x; + _dataValues.push_back(x); + } +} + +bool GridAxisRecordRepresentation0::operator==( + const GridAxisRecordRepresentation0& rhs) const { + auto ivars_equal = true; + + ivars_equal = + GridAxisRecord::operator==(rhs) && _dataValues == rhs._dataValues; + + return ivars_equal; +} + +int GridAxisRecordRepresentation0::getMarshalledSize() const { + auto marshal_size = 0; + + marshal_size = GridAxisRecord::getMarshalledSize(); + marshal_size += 2; // _numberOfBytes + marshal_size += _dataValues.size(); + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/GridAxisRecordRepresentation0.h b/src/dis6/synthetic_environment/GridAxisRecordRepresentation0.h similarity index 80% rename from src/dis6/GridAxisRecordRepresentation0.h rename to src/dis6/synthetic_environment/GridAxisRecordRepresentation0.h index 4faf2ee5..add54f1b 100644 --- a/src/dis6/GridAxisRecordRepresentation0.h +++ b/src/dis6/synthetic_environment/GridAxisRecordRepresentation0.h @@ -1,11 +1,11 @@ #pragma once -#include "dis6/GridAxisRecord.h" -#include "dis6/opendis6_export.h" -#include "dis6/utils/DataStream.h" #include #include +#include "dis6/synthetic_environment/GridAxisRecord.h" +#include "dis6/utils/DataStream.h" + namespace DIS { // 5.2.44: Grid data record, representation 0 @@ -14,33 +14,33 @@ namespace DIS { // // @author DMcG, jkg -class OPENDIS6_EXPORT GridAxisRecordRepresentation0 : public GridAxisRecord { -protected: +class GridAxisRecordRepresentation0 : public GridAxisRecord { + protected: /** number of bytes of environmental state data */ - unsigned short _numberOfBytes; + uint16_t _numberOfBytes; /** variable length list of data parameters ^^^this is wrong--need padding as * well */ std::vector _dataValues; -public: + public: GridAxisRecordRepresentation0(); virtual ~GridAxisRecordRepresentation0(); - virtual void marshal(DataStream &dataStream) const; - virtual void unmarshal(DataStream &dataStream); + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); - unsigned short getNumberOfBytes() const; + uint16_t getNumberOfBytes() const; - std::vector &getDataValues(); - const std::vector &getDataValues() const; - void setDataValues(const std::vector &pX); + std::vector& getDataValues(); + const std::vector& getDataValues() const; + void setDataValues(const std::vector& pX); virtual int getMarshalledSize() const; - bool operator==(const GridAxisRecordRepresentation0 &rhs) const; + bool operator==(const GridAxisRecordRepresentation0& rhs) const; }; -} // namespace DIS +} // namespace DIS // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without diff --git a/src/dis6/synthetic_environment/GridAxisRecordRepresentation1.cpp b/src/dis6/synthetic_environment/GridAxisRecordRepresentation1.cpp new file mode 100644 index 00000000..2dcdc222 --- /dev/null +++ b/src/dis6/synthetic_environment/GridAxisRecordRepresentation1.cpp @@ -0,0 +1,139 @@ +#include "dis6/synthetic_environment/GridAxisRecordRepresentation1.h" + +using namespace DIS; + +GridAxisRecordRepresentation1::GridAxisRecordRepresentation1() + : _fieldScale(0.0), _fieldOffset(0.0), _numberOfValues(0) {} + +GridAxisRecordRepresentation1::~GridAxisRecordRepresentation1() { + _dataValues.clear(); +} + +float GridAxisRecordRepresentation1::getFieldScale() const { + return _fieldScale; +} + +void GridAxisRecordRepresentation1::setFieldScale(float pX) { + _fieldScale = pX; +} + +float GridAxisRecordRepresentation1::getFieldOffset() const { + return _fieldOffset; +} + +void GridAxisRecordRepresentation1::setFieldOffset(float pX) { + _fieldOffset = pX; +} + +uint16_t GridAxisRecordRepresentation1::getNumberOfValues() const { + return _dataValues.size(); +} + +std::vector& GridAxisRecordRepresentation1::getDataValues() { + return _dataValues; +} + +const std::vector& GridAxisRecordRepresentation1::getDataValues() + const { + return _dataValues; +} + +void GridAxisRecordRepresentation1::setDataValues( + const std::vector& pX) { + _dataValues = pX; +} + +void GridAxisRecordRepresentation1::marshal(DataStream& dataStream) const { + GridAxisRecord::marshal( + dataStream); // Marshal information in superclass first + dataStream << _fieldScale; + dataStream << _fieldOffset; + dataStream << static_cast(_dataValues.size()); + + for (const auto& x : _dataValues) { + x.marshal(dataStream); + } +} + +void GridAxisRecordRepresentation1::unmarshal(DataStream& dataStream) { + GridAxisRecord::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _fieldScale; + dataStream >> _fieldOffset; + dataStream >> _numberOfValues; + + _dataValues.clear(); + for (size_t idx = 0; idx < _numberOfValues; idx++) { + TwoByteChunk x; + x.unmarshal(dataStream); + _dataValues.push_back(x); + } +} + +bool GridAxisRecordRepresentation1::operator==( + const GridAxisRecordRepresentation1& rhs) const { + bool ivars_equal = true; + + ivars_equal = GridAxisRecord::operator==(rhs); + + if (!(_fieldScale == rhs._fieldScale)) { + ivars_equal = false; + } + if (!(_fieldOffset == rhs._fieldOffset)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < _dataValues.size(); idx++) { + if (!(_dataValues[idx] == rhs._dataValues[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int GridAxisRecordRepresentation1::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = GridAxisRecord::getMarshalledSize(); + marshal_size = marshal_size + 4; // _fieldScale + marshal_size = marshal_size + 4; // _fieldOffset + marshal_size = marshal_size + 2; // _numberOfValues + + for (const auto& list_element : _dataValues) { + marshal_size = marshal_size + list_element.getMarshalledSize(); + } + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/GridAxisRecordRepresentation1.h b/src/dis6/synthetic_environment/GridAxisRecordRepresentation1.h new file mode 100644 index 00000000..e99a9c92 --- /dev/null +++ b/src/dis6/synthetic_environment/GridAxisRecordRepresentation1.h @@ -0,0 +1,86 @@ +#pragma once + +#include + +#include "dis6/common/TwoByteChunk.h" +#include "dis6/synthetic_environment/GridAxisRecord.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.2.44: Grid data record, representation 1 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class GridAxisRecordRepresentation1 : public GridAxisRecord { + protected: + /** constant scale factor */ + float _fieldScale; + + /** constant offset used to scale grid data */ + float _fieldOffset; + + /** Number of data values */ + uint16_t _numberOfValues; + + /** variable length list of data parameters ^^^this is wrong--need padding as + * well */ + std::vector _dataValues; + + public: + GridAxisRecordRepresentation1(); + virtual ~GridAxisRecordRepresentation1(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + float getFieldScale() const; + void setFieldScale(float pX); + + float getFieldOffset() const; + void setFieldOffset(float pX); + + uint16_t getNumberOfValues() const; + + std::vector& getDataValues(); + const std::vector& getDataValues() const; + void setDataValues(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const GridAxisRecordRepresentation1& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/GridAxisRecordRepresentation2.cpp b/src/dis6/synthetic_environment/GridAxisRecordRepresentation2.cpp new file mode 100644 index 00000000..aecd2ebf --- /dev/null +++ b/src/dis6/synthetic_environment/GridAxisRecordRepresentation2.cpp @@ -0,0 +1,110 @@ +#include "dis6/synthetic_environment/GridAxisRecordRepresentation2.h" + +using namespace DIS; + +GridAxisRecordRepresentation2::GridAxisRecordRepresentation2() + : _numberOfValues(0) {} + +GridAxisRecordRepresentation2::~GridAxisRecordRepresentation2() { + _dataValues.clear(); +} + +uint16_t GridAxisRecordRepresentation2::getNumberOfValues() const { + return _dataValues.size(); +} + +std::vector& GridAxisRecordRepresentation2::getDataValues() { + return _dataValues; +} + +const std::vector& GridAxisRecordRepresentation2::getDataValues() + const { + return _dataValues; +} + +void GridAxisRecordRepresentation2::setDataValues( + const std::vector& pX) { + _dataValues = pX; +} + +void GridAxisRecordRepresentation2::marshal(DataStream& dataStream) const { + GridAxisRecord::marshal( + dataStream); // Marshal information in superclass first + dataStream << static_cast(_dataValues.size()); + + for (const auto& x : _dataValues) { + x.marshal(dataStream); + } +} + +void GridAxisRecordRepresentation2::unmarshal(DataStream& dataStream) { + GridAxisRecord::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _numberOfValues; + + _dataValues.clear(); + for (size_t idx = 0; idx < _numberOfValues; idx++) { + FourByteChunk x; + x.unmarshal(dataStream); + _dataValues.push_back(x); + } +} + +bool GridAxisRecordRepresentation2::operator==( + const GridAxisRecordRepresentation2& rhs) const { + bool ivars_equal = true; + + ivars_equal = GridAxisRecord::operator==(rhs); + + for (size_t idx = 0; idx < _dataValues.size(); idx++) { + if (!(_dataValues[idx] == rhs._dataValues[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int GridAxisRecordRepresentation2::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = GridAxisRecord::getMarshalledSize(); + marshal_size = marshal_size + 2; // _numberOfValues + + for (const auto& list_element : _dataValues) { + marshal_size = marshal_size + list_element.getMarshalledSize(); + } + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/GridAxisRecordRepresentation2.h b/src/dis6/synthetic_environment/GridAxisRecordRepresentation2.h new file mode 100644 index 00000000..2d1608e8 --- /dev/null +++ b/src/dis6/synthetic_environment/GridAxisRecordRepresentation2.h @@ -0,0 +1,74 @@ +#pragma once + +#include + +#include "dis6/common/FourByteChunk.h" +#include "dis6/synthetic_environment/GridAxisRecord.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.2.44: Grid data record, representation 1 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class GridAxisRecordRepresentation2 : public GridAxisRecord { + protected: + /** number of values */ + uint16_t _numberOfValues; + + /** variable length list of data parameters ^^^this is wrong--need padding as + * well */ + std::vector _dataValues; + + public: + GridAxisRecordRepresentation2(); + virtual ~GridAxisRecordRepresentation2(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint16_t getNumberOfValues() const; + + std::vector& getDataValues(); + const std::vector& getDataValues() const; + void setDataValues(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const GridAxisRecordRepresentation2& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/GriddedDataPdu.cpp b/src/dis6/synthetic_environment/GriddedDataPdu.cpp new file mode 100644 index 00000000..9c131922 --- /dev/null +++ b/src/dis6/synthetic_environment/GriddedDataPdu.cpp @@ -0,0 +1,283 @@ +#include "dis6/synthetic_environment/GriddedDataPdu.h" + +using namespace DIS; + +GriddedDataPdu::GriddedDataPdu() + : _fieldNumber(0), + _pduNumber(0), + _pduTotal(0), + _coordinateSystem(0), + _numberOfGridAxes(0), + _constantGrid(0), + + _sampleTime(0), + _totalValues(0), + _vectorDimension(0), + _padding1(0), + _padding2(0) { + SetPduType(42); +} + +GriddedDataPdu::~GriddedDataPdu() { _gridDataList.clear(); } + +dis::EntityID& GriddedDataPdu::getEnvironmentalSimulationApplicationID() { + return _environmentalSimulationApplicationID; +} + +const dis::EntityID& GriddedDataPdu::getEnvironmentalSimulationApplicationID() + const { + return _environmentalSimulationApplicationID; +} + +void GriddedDataPdu::setEnvironmentalSimulationApplicationID( + const dis::EntityID& pX) { + _environmentalSimulationApplicationID = pX; +} + +uint16_t GriddedDataPdu::getFieldNumber() const { return _fieldNumber; } + +void GriddedDataPdu::setFieldNumber(uint16_t pX) { _fieldNumber = pX; } + +uint16_t GriddedDataPdu::getPduNumber() const { return _pduNumber; } + +void GriddedDataPdu::setPduNumber(uint16_t pX) { _pduNumber = pX; } + +uint16_t GriddedDataPdu::getPduTotal() const { return _pduTotal; } + +void GriddedDataPdu::setPduTotal(uint16_t pX) { _pduTotal = pX; } + +uint16_t GriddedDataPdu::getCoordinateSystem() const { + return _coordinateSystem; +} + +void GriddedDataPdu::setCoordinateSystem(uint16_t pX) { + _coordinateSystem = pX; +} + +uint8_t GriddedDataPdu::getNumberOfGridAxes() const { + return _gridDataList.size(); +} + +uint8_t GriddedDataPdu::getConstantGrid() const { return _constantGrid; } + +void GriddedDataPdu::setConstantGrid(uint8_t pX) { _constantGrid = pX; } + +dis::EntityType& GriddedDataPdu::getEnvironmentType() { + return _environmentType; +} + +const dis::EntityType& GriddedDataPdu::getEnvironmentType() const { + return _environmentType; +} + +void GriddedDataPdu::setEnvironmentType(const dis::EntityType& pX) { + _environmentType = pX; +} + +Orientation& GriddedDataPdu::getOrientation() { return _orientation; } + +const Orientation& GriddedDataPdu::getOrientation() const { + return _orientation; +} + +void GriddedDataPdu::setOrientation(const Orientation& pX) { + _orientation = pX; +} + +uint64_t GriddedDataPdu::getSampleTime() const { return _sampleTime; } + +void GriddedDataPdu::setSampleTime(uint64_t pX) { _sampleTime = pX; } + +uint32_t GriddedDataPdu::getTotalValues() const { return _totalValues; } + +void GriddedDataPdu::setTotalValues(uint32_t pX) { _totalValues = pX; } + +uint8_t GriddedDataPdu::getVectorDimension() const { return _vectorDimension; } + +void GriddedDataPdu::setVectorDimension(uint8_t pX) { _vectorDimension = pX; } + +uint16_t GriddedDataPdu::getPadding1() const { return _padding1; } + +void GriddedDataPdu::setPadding1(uint16_t pX) { _padding1 = pX; } + +uint8_t GriddedDataPdu::getPadding2() const { return _padding2; } + +void GriddedDataPdu::setPadding2(uint8_t pX) { _padding2 = pX; } + +std::vector& GriddedDataPdu::getGridDataList() { + return _gridDataList; +} + +const std::vector& GriddedDataPdu::getGridDataList() const { + return _gridDataList; +} + +void GriddedDataPdu::setGridDataList(const std::vector& pX) { + _gridDataList = pX; +} + +void GriddedDataPdu::marshal(DataStream& dataStream) const { + SyntheticEnvironmentFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _environmentalSimulationApplicationID.Marshal(dataStream); + dataStream << _fieldNumber; + dataStream << _pduNumber; + dataStream << _pduTotal; + dataStream << _coordinateSystem; + dataStream << static_cast(_gridDataList.size()); + dataStream << _constantGrid; + _environmentType.marshal(dataStream); + _orientation.marshal(dataStream); + dataStream << _sampleTime; + dataStream << _totalValues; + dataStream << _vectorDimension; + dataStream << _padding1; + dataStream << _padding2; + + for (auto x : _gridDataList) { + x.marshal(dataStream); + } +} + +void GriddedDataPdu::unmarshal(DataStream& dataStream) { + SyntheticEnvironmentFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _environmentalSimulationApplicationID.unmarshal(dataStream); + dataStream >> _fieldNumber; + dataStream >> _pduNumber; + dataStream >> _pduTotal; + dataStream >> _coordinateSystem; + dataStream >> _numberOfGridAxes; + dataStream >> _constantGrid; + _environmentType.unmarshal(dataStream); + _orientation.unmarshal(dataStream); + dataStream >> _sampleTime; + dataStream >> _totalValues; + dataStream >> _vectorDimension; + dataStream >> _padding1; + dataStream >> _padding2; + + _gridDataList.clear(); + for (size_t idx = 0; idx < _numberOfGridAxes; idx++) { + GridAxisRecord x; + x.unmarshal(dataStream); + _gridDataList.push_back(x); + } +} + +bool GriddedDataPdu::operator==(const GriddedDataPdu& rhs) const { + bool ivars_equal = true; + + ivars_equal = SyntheticEnvironmentFamilyPdu::operator==(rhs); + + if (!(_environmentalSimulationApplicationID == + rhs._environmentalSimulationApplicationID)) { + ivars_equal = false; + } + if (!(_fieldNumber == rhs._fieldNumber)) { + ivars_equal = false; + } + if (!(_pduNumber == rhs._pduNumber)) { + ivars_equal = false; + } + if (!(_pduTotal == rhs._pduTotal)) { + ivars_equal = false; + } + if (!(_coordinateSystem == rhs._coordinateSystem)) { + ivars_equal = false; + } + if (!(_constantGrid == rhs._constantGrid)) { + ivars_equal = false; + } + if (!(_environmentType == rhs._environmentType)) { + ivars_equal = false; + } + if (!(_orientation == rhs._orientation)) { + ivars_equal = false; + } + if (!(_sampleTime == rhs._sampleTime)) { + ivars_equal = false; + } + if (!(_totalValues == rhs._totalValues)) { + ivars_equal = false; + } + if (!(_vectorDimension == rhs._vectorDimension)) { + ivars_equal = false; + } + if (!(_padding1 == rhs._padding1)) { + ivars_equal = false; + } + if (!(_padding2 == rhs._padding2)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < _gridDataList.size(); idx++) { + if (!(_gridDataList[idx] == rhs._gridDataList[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int GriddedDataPdu::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); + marshal_size = + marshal_size + + _environmentalSimulationApplicationID + .getMarshalledSize(); // _environmentalSimulationApplicationID + marshal_size = marshal_size + 2; // _fieldNumber + marshal_size = marshal_size + 2; // _pduNumber + marshal_size = marshal_size + 2; // _pduTotal + marshal_size = marshal_size + 2; // _coordinateSystem + marshal_size = marshal_size + 1; // _numberOfGridAxes + marshal_size = marshal_size + 1; // _constantGrid + marshal_size = + marshal_size + _environmentType.getMarshalledSize(); // _environmentType + marshal_size = + marshal_size + _orientation.getMarshalledSize(); // _orientation + marshal_size = marshal_size + 8; // _sampleTime + marshal_size = marshal_size + 4; // _totalValues + marshal_size = marshal_size + 1; // _vectorDimension + marshal_size = marshal_size + 2; // _padding1 + marshal_size = marshal_size + 1; // _padding2 + + for (auto listElement : _gridDataList) { + marshal_size = marshal_size + listElement.getMarshalledSize(); + } + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/GriddedDataPdu.h b/src/dis6/synthetic_environment/GriddedDataPdu.h new file mode 100644 index 00000000..d7b22f42 --- /dev/null +++ b/src/dis6/synthetic_environment/GriddedDataPdu.h @@ -0,0 +1,160 @@ +#pragma once + +#include + +#include "dis6/common/EntityID.h" +#include "dis6/common/EntityType.h" +#include "dis6/common/Orientation.h" +#include "dis6/synthetic_environment/GridAxisRecord.h" +#include "dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.11.2: Information about globat, spatially varying enviornmental +// effects. This requires manual cleanup; the grid axis records are +// variable sized. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class GriddedDataPdu : public SyntheticEnvironmentFamilyPdu { + protected: + /** environmental simulation application ID */ + dis::EntityID _environmentalSimulationApplicationID; + + /** unique identifier for each piece of enviornmental data */ + uint16_t _fieldNumber; + + /** sequence number for the total set of PDUS used to transmit the data */ + uint16_t _pduNumber; + + /** Total number of PDUS used to transmit the data */ + uint16_t _pduTotal; + + /** coordinate system of the grid */ + uint16_t _coordinateSystem; + + /** number of grid axes for the environmental data */ + uint8_t _numberOfGridAxes; + + /** are domain grid axes identidal to those of the priveious domain update? */ + uint8_t _constantGrid; + + /** type of environment */ + dis::EntityType _environmentType; + + /** orientation of the data grid */ + Orientation _orientation; + + /** valid time of the enviormental data sample, 64 bit uint32_t */ + uint64_t _sampleTime; + + /** total number of all data values for all pdus for an environmental sample + */ + uint32_t _totalValues; + + /** total number of data values at each grid point. */ + uint8_t _vectorDimension; + + /** padding */ + uint16_t _padding1; + + /** padding */ + uint8_t _padding2; + + /** Grid data ^^^This is wrong */ + std::vector _gridDataList; + + public: + GriddedDataPdu(); + virtual ~GriddedDataPdu(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + dis::EntityID& getEnvironmentalSimulationApplicationID(); + const dis::EntityID& getEnvironmentalSimulationApplicationID() const; + void setEnvironmentalSimulationApplicationID(const dis::EntityID& pX); + + uint16_t getFieldNumber() const; + void setFieldNumber(uint16_t pX); + + uint16_t getPduNumber() const; + void setPduNumber(uint16_t pX); + + uint16_t getPduTotal() const; + void setPduTotal(uint16_t pX); + + uint16_t getCoordinateSystem() const; + void setCoordinateSystem(uint16_t pX); + + uint8_t getNumberOfGridAxes() const; + + uint8_t getConstantGrid() const; + void setConstantGrid(uint8_t pX); + + dis::EntityType& getEnvironmentType(); + const dis::EntityType& getEnvironmentType() const; + void setEnvironmentType(const dis::EntityType& pX); + + Orientation& getOrientation(); + const Orientation& getOrientation() const; + void setOrientation(const Orientation& pX); + + uint64_t getSampleTime() const; + void setSampleTime(uint64_t pX); + + uint32_t getTotalValues() const; + void setTotalValues(uint32_t pX); + + uint8_t getVectorDimension() const; + void setVectorDimension(uint8_t pX); + + uint16_t getPadding1() const; + void setPadding1(uint16_t pX); + + uint8_t getPadding2() const; + void setPadding2(uint8_t pX); + + std::vector& getGridDataList(); + const std::vector& getGridDataList() const; + void setGridDataList(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const GriddedDataPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/LinearObjectStatePdu.cpp b/src/dis6/synthetic_environment/LinearObjectStatePdu.cpp new file mode 100644 index 00000000..d2bcefb5 --- /dev/null +++ b/src/dis6/synthetic_environment/LinearObjectStatePdu.cpp @@ -0,0 +1,223 @@ +#include "dis6/synthetic_environment/LinearObjectStatePdu.h" + +using namespace DIS; + +LinearObjectStatePdu::LinearObjectStatePdu() + : _updateNumber(0), _forceID(0), _numberOfSegments(0) { + SetPduType(44); +} + +LinearObjectStatePdu::~LinearObjectStatePdu() { + _linearSegmentParameters.clear(); +} + +dis::EntityID& LinearObjectStatePdu::getObjectID() { return _objectID; } + +const dis::EntityID& LinearObjectStatePdu::getObjectID() const { + return _objectID; +} + +void LinearObjectStatePdu::setObjectID(const dis::EntityID& pX) { + _objectID = pX; +} + +dis::EntityID& LinearObjectStatePdu::getReferencedObjectID() { + return _referencedObjectID; +} + +const EntityID& LinearObjectStatePdu::getReferencedObjectID() const { + return _referencedObjectID; +} + +void LinearObjectStatePdu::SetReferencedObjectId(const EntityID& pX) { + _referencedObjectID = pX; +} + +uint16_t LinearObjectStatePdu::getUpdateNumber() const { return _updateNumber; } + +void LinearObjectStatePdu::setUpdateNumber(uint16_t pX) { _updateNumber = pX; } + +uint8_t LinearObjectStatePdu::getForceID() const { return _forceID; } + +void LinearObjectStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t LinearObjectStatePdu::getNumberOfSegments() const { + return _linearSegmentParameters.size(); +} + +SimulationAddress& LinearObjectStatePdu::getRequesterID() { + return _requesterID; +} + +const SimulationAddress& LinearObjectStatePdu::getRequesterID() const { + return _requesterID; +} + +void LinearObjectStatePdu::setRequesterID(const SimulationAddress& pX) { + _requesterID = pX; +} + +SimulationAddress& LinearObjectStatePdu::getReceivingID() { + return _receivingID; +} + +const SimulationAddress& LinearObjectStatePdu::getReceivingID() const { + return _receivingID; +} + +void LinearObjectStatePdu::setReceivingID(const SimulationAddress& pX) { + _receivingID = pX; +} + +ObjectType& LinearObjectStatePdu::getObjectType() { return _objectType; } + +const ObjectType& LinearObjectStatePdu::getObjectType() const { + return _objectType; +} + +void LinearObjectStatePdu::setObjectType(const ObjectType& pX) { + _objectType = pX; +} + +std::vector& +LinearObjectStatePdu::GetLinearSegmentParameters() { + return _linearSegmentParameters; +} + +const std::vector& +LinearObjectStatePdu::GetLinearSegmentParameters() const { + return _linearSegmentParameters; +} + +void LinearObjectStatePdu::SetLinearSegmentParameters( + const std::vector& pX) { + _linearSegmentParameters = pX; +} + +void LinearObjectStatePdu::marshal(DataStream& dataStream) const { + SyntheticEnvironmentFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _objectID.marshal(dataStream); + _referencedObjectID.marshal(dataStream); + dataStream << _updateNumber; + dataStream << _forceID; + dataStream << static_cast(_linearSegmentParameters.size()); + _requesterID.marshal(dataStream); + _receivingID.marshal(dataStream); + _objectType.marshal(dataStream); + + for (auto x : _linearSegmentParameters) { + x.marshal(dataStream); + } +} + +void LinearObjectStatePdu::unmarshal(DataStream& dataStream) { + SyntheticEnvironmentFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _objectID.unmarshal(dataStream); + _referencedObjectID.unmarshal(dataStream); + dataStream >> _updateNumber; + dataStream >> _forceID; + dataStream >> _numberOfSegments; + _requesterID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + _objectType.unmarshal(dataStream); + + _linearSegmentParameters.clear(); + for (size_t idx = 0; idx < _numberOfSegments; idx++) { + LinearSegmentParameter x; + x.unmarshal(dataStream); + _linearSegmentParameters.push_back(x); + } +} + +bool LinearObjectStatePdu::operator==(const LinearObjectStatePdu& rhs) const { + bool ivars_equal = true; + + ivars_equal = SyntheticEnvironmentFamilyPdu::operator==(rhs); + + if (!(_objectID == rhs._objectID)) { + ivars_equal = false; + } + if (!(_referencedObjectID == rhs._referencedObjectID)) { + ivars_equal = false; + } + if (!(_updateNumber == rhs._updateNumber)) { + ivars_equal = false; + } + if (!(_forceID == rhs._forceID)) { + ivars_equal = false; + } + if (!(_requesterID == rhs._requesterID)) { + ivars_equal = false; + } + if (!(_receivingID == rhs._receivingID)) { + ivars_equal = false; + } + if (!(_objectType == rhs._objectType)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < _linearSegmentParameters.size(); idx++) { + if (!(_linearSegmentParameters[idx] == rhs._linearSegmentParameters[idx])) { + ivars_equal = false; + } + } + + return ivars_equal; +} + +int LinearObjectStatePdu::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); + marshal_size = marshal_size + _objectID.getMarshalledSize(); // _objectID + marshal_size = + marshal_size + + _referencedObjectID.getMarshalledSize(); // _referencedObjectID + marshal_size = marshal_size + 2; // _updateNumber + marshal_size = marshal_size + 1; // _forceID + marshal_size = marshal_size + 1; // _numberOfSegments + marshal_size = + marshal_size + _requesterID.getMarshalledSize(); // _requesterID + marshal_size = + marshal_size + _receivingID.getMarshalledSize(); // _receivingID + marshal_size = marshal_size + _objectType.getMarshalledSize(); // _objectType + + for (auto listElement : _linearSegmentParameters) { + marshal_size = marshal_size + listElement.getMarshalledSize(); + } + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/LinearObjectStatePdu.h b/src/dis6/synthetic_environment/LinearObjectStatePdu.h new file mode 100644 index 00000000..8d16a64c --- /dev/null +++ b/src/dis6/synthetic_environment/LinearObjectStatePdu.h @@ -0,0 +1,126 @@ +#pragma once + +#include + +#include "dis6/common/EntityID.h" +#include "dis6/common/SimulationAddress.h" +#include "dis6/synthetic_environment/LinearSegmentParameter.h" +#include "dis6/synthetic_environment/ObjectType.h" +#include "dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.11.4: Information abut the addition or modification of a +// synthecic enviroment object that is anchored to the terrain with a +// single point and has size or orientation. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class LinearObjectStatePdu : public SyntheticEnvironmentFamilyPdu { + protected: + /** Object in synthetic environment */ + dis::EntityID _objectID; + + /** Object with which this point object is associated */ + dis::EntityID _referencedObjectID; + + /** unique update number of each state transition of an object */ + uint16_t _updateNumber; + + /** force ID */ + uint8_t _forceID; + + /** number of linear segment parameters */ + uint8_t _numberOfSegments; + + /** requesterID */ + SimulationAddress _requesterID; + + /** receiver ID */ + SimulationAddress _receivingID; + + /** Object type */ + ObjectType _objectType; + + /** Linear segment parameters */ + std::vector _linearSegmentParameters; + + public: + LinearObjectStatePdu(); + virtual ~LinearObjectStatePdu(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + dis::EntityID& getObjectID(); + const dis::EntityID& getObjectID() const; + void setObjectID(const dis::EntityID& pX); + + dis::EntityID& getReferencedObjectID(); + const dis::EntityID& getReferencedObjectID() const; + void setReferencedObjectID(const dis::EntityID& pX); + + uint16_t getUpdateNumber() const; + void setUpdateNumber(uint16_t pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getNumberOfSegments() const; + + SimulationAddress& getRequesterID(); + const SimulationAddress& getRequesterID() const; + void setRequesterID(const SimulationAddress& pX); + + SimulationAddress& getReceivingID(); + const SimulationAddress& getReceivingID() const; + void setReceivingID(const SimulationAddress& pX); + + ObjectType& getObjectType(); + const ObjectType& getObjectType() const; + void setObjectType(const ObjectType& pX); + + std::vector& getLinearSegmentParameters(); + const std::vector& getLinearSegmentParameters() const; + void setLinearSegmentParameters( + const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LinearObjectStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/LinearSegmentParameter.cpp b/src/dis6/synthetic_environment/LinearSegmentParameter.cpp new file mode 100644 index 00000000..1840b039 --- /dev/null +++ b/src/dis6/synthetic_environment/LinearSegmentParameter.cpp @@ -0,0 +1,197 @@ +#include "dis6/synthetic_environment/LinearSegmentParameter.h" + +using namespace DIS; + +LinearSegmentParameter::LinearSegmentParameter() + : _segmentNumber(0), + + _segmentLength(0), + _segmentWidth(0), + _segmentHeight(0), + _segmentDepth(0), + _pad1(0) {} + +LinearSegmentParameter::~LinearSegmentParameter() = default; + +uint8_t LinearSegmentParameter::getSegmentNumber() const { + return _segmentNumber; +} + +void LinearSegmentParameter::setSegmentNumber(uint8_t pX) { + _segmentNumber = pX; +} + +SixByteChunk& LinearSegmentParameter::getSegmentAppearance() { + return _segmentAppearance; +} + +const SixByteChunk& LinearSegmentParameter::getSegmentAppearance() const { + return _segmentAppearance; +} + +void LinearSegmentParameter::setSegmentAppearance(const SixByteChunk& pX) { + _segmentAppearance = pX; +} + +Vector3Double& LinearSegmentParameter::getLocation() { return _location; } + +const Vector3Double& LinearSegmentParameter::getLocation() const { + return _location; +} + +void LinearSegmentParameter::setLocation(const Vector3Double& pX) { + _location = pX; +} + +Orientation& LinearSegmentParameter::getOrientation() { return _orientation; } + +const Orientation& LinearSegmentParameter::getOrientation() const { + return _orientation; +} + +void LinearSegmentParameter::setOrientation(const Orientation& pX) { + _orientation = pX; +} + +uint16_t LinearSegmentParameter::getSegmentLength() const { + return _segmentLength; +} + +void LinearSegmentParameter::setSegmentLength(uint16_t pX) { + _segmentLength = pX; +} + +uint16_t LinearSegmentParameter::getSegmentWidth() const { + return _segmentWidth; +} + +void LinearSegmentParameter::setSegmentWidth(uint16_t pX) { + _segmentWidth = pX; +} + +uint16_t LinearSegmentParameter::getSegmentHeight() const { + return _segmentHeight; +} + +void LinearSegmentParameter::setSegmentHeight(uint16_t pX) { + _segmentHeight = pX; +} + +uint16_t LinearSegmentParameter::getSegmentDepth() const { + return _segmentDepth; +} + +void LinearSegmentParameter::setSegmentDepth(uint16_t pX) { + _segmentDepth = pX; +} + +uint32_t LinearSegmentParameter::getPad1() const { return _pad1; } + +void LinearSegmentParameter::setPad1(uint32_t pX) { _pad1 = pX; } + +void LinearSegmentParameter::Marshal(DataStream& dataStream) const { + dataStream << _segmentNumber; + _segmentAppearance.marshal(dataStream); + _location.marshal(dataStream); + _orientation.marshal(dataStream); + dataStream << _segmentLength; + dataStream << _segmentWidth; + dataStream << _segmentHeight; + dataStream << _segmentDepth; + dataStream << _pad1; +} + +void LinearSegmentParameter::Unmarshal(DataStream& dataStream) { + dataStream >> _segmentNumber; + _segmentAppearance.unmarshal(dataStream); + _location.unmarshal(dataStream); + _orientation.unmarshal(dataStream); + dataStream >> _segmentLength; + dataStream >> _segmentWidth; + dataStream >> _segmentHeight; + dataStream >> _segmentDepth; + dataStream >> _pad1; +} + +bool LinearSegmentParameter::operator==( + const LinearSegmentParameter& rhs) const { + bool ivars_equal = true; + + if (!(_segmentNumber == rhs._segmentNumber)) { + ivars_equal = false; + } + if (!(_segmentAppearance == rhs._segmentAppearance)) { + ivars_equal = false; + } + if (!(_location == rhs._location)) { + ivars_equal = false; + } + if (!(_orientation == rhs._orientation)) { + ivars_equal = false; + } + if (!(_segmentLength == rhs._segmentLength)) { + ivars_equal = false; + } + if (!(_segmentWidth == rhs._segmentWidth)) { + ivars_equal = false; + } + if (!(_segmentHeight == rhs._segmentHeight)) { + ivars_equal = false; + } + if (!(_segmentDepth == rhs._segmentDepth)) { + ivars_equal = false; + } + if (!(_pad1 == rhs._pad1)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int LinearSegmentParameter::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 1; // _segmentNumber + marshal_size = marshal_size + + _segmentAppearance.getMarshalledSize(); // _segmentAppearance + marshal_size = marshal_size + _location.getMarshalledSize(); // _location + marshal_size = + marshal_size + _orientation.getMarshalledSize(); // _orientation + marshal_size = marshal_size + 2; // _segmentLength + marshal_size = marshal_size + 2; // _segmentWidth + marshal_size = marshal_size + 2; // _segmentHeight + marshal_size = marshal_size + 2; // _segmentDepth + marshal_size = marshal_size + 4; // _pad1 + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/LinearSegmentParameter.h b/src/dis6/synthetic_environment/LinearSegmentParameter.h new file mode 100644 index 00000000..dccb9490 --- /dev/null +++ b/src/dis6/synthetic_environment/LinearSegmentParameter.h @@ -0,0 +1,117 @@ +#pragma once + +#include "dis6/common/Orientation.h" +#include "dis6/common/SixByteChunk.h" +#include "dis6/common/Vector3Double.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// 5.2.48: Linear segment parameters + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class LinearSegmentParameter { + protected: + /** number of segments */ + uint8_t _segmentNumber; + + /** segment appearance */ + SixByteChunk _segmentAppearance; + + /** location */ + Vector3Double _location; + + /** orientation */ + Orientation _orientation; + + /** segmentLength */ + uint16_t _segmentLength; + + /** segmentWidth */ + uint16_t _segmentWidth; + + /** segmentHeight */ + uint16_t _segmentHeight; + + /** segment Depth */ + uint16_t _segmentDepth; + + /** segment Depth */ + uint32_t _pad1; + + public: + LinearSegmentParameter(); + virtual ~LinearSegmentParameter(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint8_t getSegmentNumber() const; + void setSegmentNumber(uint8_t pX); + + SixByteChunk& getSegmentAppearance(); + const SixByteChunk& getSegmentAppearance() const; + void setSegmentAppearance(const SixByteChunk& pX); + + Vector3Double& getLocation(); + const Vector3Double& getLocation() const; + void setLocation(const Vector3Double& pX); + + Orientation& getOrientation(); + const Orientation& getOrientation() const; + void setOrientation(const Orientation& pX); + + uint16_t getSegmentLength() const; + void setSegmentLength(uint16_t pX); + + uint16_t getSegmentWidth() const; + void setSegmentWidth(uint16_t pX); + + uint16_t getSegmentHeight() const; + void setSegmentHeight(uint16_t pX); + + uint16_t getSegmentDepth() const; + void setSegmentDepth(uint16_t pX); + + uint32_t getPad1() const; + void setPad1(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LinearSegmentParameter& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/ObjectType.cpp b/src/dis6/synthetic_environment/ObjectType.cpp new file mode 100644 index 00000000..59a55645 --- /dev/null +++ b/src/dis6/synthetic_environment/ObjectType.cpp @@ -0,0 +1,108 @@ +#include "dis6/synthetic_environment/ObjectType.h" + +using namespace DIS; + +ObjectType::ObjectType() + : _entityKind(0), _domain(0), _country(0), _category(0), _subcategory(0) {} + +ObjectType::~ObjectType() = default; + +uint8_t ObjectType::getEntityKind() const { return _entityKind; } + +void ObjectType::setEntityKind(uint8_t pX) { _entityKind = pX; } + +uint8_t ObjectType::getDomain() const { return _domain; } + +void ObjectType::setDomain(uint8_t pX) { _domain = pX; } + +uint16_t ObjectType::getCountry() const { return _country; } + +void ObjectType::setCountry(uint16_t pX) { _country = pX; } + +uint8_t ObjectType::getCategory() const { return _category; } + +void ObjectType::setCategory(uint8_t pX) { _category = pX; } + +uint8_t ObjectType::getSubcategory() const { return _subcategory; } + +void ObjectType::setSubcategory(uint8_t pX) { _subcategory = pX; } + +void ObjectType::Marshal(DataStream& dataStream) const { + dataStream << _entityKind; + dataStream << _domain; + dataStream << _country; + dataStream << _category; + dataStream << _subcategory; +} + +void ObjectType::Unmarshal(DataStream& dataStream) { + dataStream >> _entityKind; + dataStream >> _domain; + dataStream >> _country; + dataStream >> _category; + dataStream >> _subcategory; +} + +bool ObjectType::operator==(const ObjectType& rhs) const { + bool ivars_equal = true; + + if (!(_entityKind == rhs._entityKind)) { + ivars_equal = false; + } + if (!(_domain == rhs._domain)) { + ivars_equal = false; + } + if (!(_country == rhs._country)) { + ivars_equal = false; + } + if (!(_category == rhs._category)) { + ivars_equal = false; + } + if (!(_subcategory == rhs._subcategory)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int ObjectType::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + 1; // _entityKind + marshal_size = marshal_size + 1; // _domain + marshal_size = marshal_size + 2; // _country + marshal_size = marshal_size + 1; // _category + marshal_size = marshal_size + 1; // _subcategory + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/ObjectType.h b/src/dis6/synthetic_environment/ObjectType.h new file mode 100644 index 00000000..980e253f --- /dev/null +++ b/src/dis6/synthetic_environment/ObjectType.h @@ -0,0 +1,88 @@ +#pragma once + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Identifies type of object. This is a int16_ter version of EntityType that +// omits the specific and extra fields. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class ObjectType { + protected: + /** Kind of entity */ + uint8_t _entityKind; + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _domain; + + /** country to which the design of the entity is attributed */ + uint16_t _country; + + /** category of entity */ + uint8_t _category; + + /** subcategory of entity */ + uint8_t _subcategory; + + public: + ObjectType(); + virtual ~ObjectType(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + uint8_t getEntityKind() const; + void setEntityKind(uint8_t pX); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint16_t getCountry() const; + void setCountry(uint16_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ObjectType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/PointObjectStatePdu.cpp b/src/dis6/synthetic_environment/PointObjectStatePdu.cpp new file mode 100644 index 00000000..61b7ab44 --- /dev/null +++ b/src/dis6/synthetic_environment/PointObjectStatePdu.cpp @@ -0,0 +1,255 @@ +#include "dis6/synthetic_environment/PointObjectStatePdu.h" + +using namespace DIS; + +PointObjectStatePdu::PointObjectStatePdu() + : _updateNumber(0), + _forceID(0), + _modifications(0), + + _objectAppearance(0.0), + + _pad2(0) { + SetPduType(43); +} + +PointObjectStatePdu::~PointObjectStatePdu() = default; + +dis::EntityID& PointObjectStatePdu::getObjectID() { return _objectID; } + +const dis::EntityID& PointObjectStatePdu::getObjectID() const { + return _objectID; +} + +void PointObjectStatePdu::setObjectID(const dis::EntityID& pX) { + _objectID = pX; +} + +dis::EntityID& PointObjectStatePdu::getReferencedObjectID() { + return _referencedObjectID; +} + +const dis::EntityID& PointObjectStatePdu::getReferencedObjectID() const { + return _referencedObjectID; +} + +void PointObjectStatePdu::setReferencedObjectID(const dis::EntityID& pX) { + _referencedObjectID = pX; +} + +uint16_t PointObjectStatePdu::getUpdateNumber() const { return _updateNumber; } + +void PointObjectStatePdu::setUpdateNumber(uint16_t pX) { _updateNumber = pX; } + +uint8_t PointObjectStatePdu::getForceID() const { return _forceID; } + +void PointObjectStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t PointObjectStatePdu::getModifications() const { return _modifications; } + +void PointObjectStatePdu::setModifications(uint8_t pX) { _modifications = pX; } + +ObjectType& PointObjectStatePdu::getObjectType() { return _objectType; } + +const ObjectType& PointObjectStatePdu::getObjectType() const { + return _objectType; +} + +void PointObjectStatePdu::setObjectType(const ObjectType& pX) { + _objectType = pX; +} + +Vector3Double& PointObjectStatePdu::getObjectLocation() { + return _objectLocation; +} + +const Vector3Double& PointObjectStatePdu::getObjectLocation() const { + return _objectLocation; +} + +void PointObjectStatePdu::setObjectLocation(const Vector3Double& pX) { + _objectLocation = pX; +} + +Orientation& PointObjectStatePdu::getObjectOrientation() { + return _objectOrientation; +} + +const Orientation& PointObjectStatePdu::getObjectOrientation() const { + return _objectOrientation; +} + +void PointObjectStatePdu::setObjectOrientation(const Orientation& pX) { + _objectOrientation = pX; +} + +double PointObjectStatePdu::getObjectAppearance() const { + return _objectAppearance; +} + +void PointObjectStatePdu::setObjectAppearance(double pX) { + _objectAppearance = pX; +} + +SimulationAddress& PointObjectStatePdu::getRequesterID() { + return _requesterID; +} + +const SimulationAddress& PointObjectStatePdu::getRequesterID() const { + return _requesterID; +} + +void PointObjectStatePdu::setRequesterID(const SimulationAddress& pX) { + _requesterID = pX; +} + +SimulationAddress& PointObjectStatePdu::getReceivingID() { + return _receivingID; +} + +const SimulationAddress& PointObjectStatePdu::getReceivingID() const { + return _receivingID; +} + +void PointObjectStatePdu::setReceivingID(const SimulationAddress& pX) { + _receivingID = pX; +} + +uint32_t PointObjectStatePdu::getPad2() const { return _pad2; } + +void PointObjectStatePdu::setPad2(uint32_t pX) { _pad2 = pX; } + +void PointObjectStatePdu::marshal(DataStream& dataStream) const { + SyntheticEnvironmentFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _objectID.Marshal(dataStream); + _referencedObjectID.marshal(dataStream); + dataStream << _updateNumber; + dataStream << _forceID; + dataStream << _modifications; + _objectType.marshal(dataStream); + _objectLocation.marshal(dataStream); + _objectOrientation.marshal(dataStream); + dataStream << _objectAppearance; + _requesterID.marshal(dataStream); + _receivingID.marshal(dataStream); + dataStream << _pad2; +} + +void PointObjectStatePdu::unmarshal(DataStream& dataStream) { + SyntheticEnvironmentFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _objectID.unmarshal(dataStream); + _referencedObjectID.unmarshal(dataStream); + dataStream >> _updateNumber; + dataStream >> _forceID; + dataStream >> _modifications; + _objectType.unmarshal(dataStream); + _objectLocation.unmarshal(dataStream); + _objectOrientation.unmarshal(dataStream); + dataStream >> _objectAppearance; + _requesterID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + dataStream >> _pad2; +} + +bool PointObjectStatePdu::operator==(const PointObjectStatePdu& rhs) const { + bool ivars_equal = true; + + ivars_equal = SyntheticEnvironmentFamilyPdu::operator==(rhs); + + if (!(_objectID == rhs._objectID)) { + ivars_equal = false; + } + if (!(_referencedObjectID == rhs._referencedObjectID)) { + ivars_equal = false; + } + if (!(_updateNumber == rhs._updateNumber)) { + ivars_equal = false; + } + if (!(_forceID == rhs._forceID)) { + ivars_equal = false; + } + if (!(_modifications == rhs._modifications)) { + ivars_equal = false; + } + if (!(_objectType == rhs._objectType)) { + ivars_equal = false; + } + if (!(_objectLocation == rhs._objectLocation)) { + ivars_equal = false; + } + if (!(_objectOrientation == rhs._objectOrientation)) { + ivars_equal = false; + } + if (!(_objectAppearance == rhs._objectAppearance)) { + ivars_equal = false; + } + if (!(_requesterID == rhs._requesterID)) { + ivars_equal = false; + } + if (!(_receivingID == rhs._receivingID)) { + ivars_equal = false; + } + if (!(_pad2 == rhs._pad2)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int PointObjectStatePdu::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); + marshal_size = marshal_size + _objectID.getMarshalledSize(); // _objectID + marshal_size = + marshal_size + + _referencedObjectID.getMarshalledSize(); // _referencedObjectID + marshal_size = marshal_size + 2; // _updateNumber + marshal_size = marshal_size + 1; // _forceID + marshal_size = marshal_size + 1; // _modifications + marshal_size = marshal_size + _objectType.getMarshalledSize(); // _objectType + marshal_size = + marshal_size + _objectLocation.getMarshalledSize(); // _objectLocation + marshal_size = marshal_size + + _objectOrientation.getMarshalledSize(); // _objectOrientation + marshal_size = marshal_size + 8; // _objectAppearance + marshal_size = + marshal_size + _requesterID.getMarshalledSize(); // _requesterID + marshal_size = + marshal_size + _receivingID.getMarshalledSize(); // _receivingID + marshal_size = marshal_size + 4; // _pad2 + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/PointObjectStatePdu.h b/src/dis6/synthetic_environment/PointObjectStatePdu.h new file mode 100644 index 00000000..4b78704c --- /dev/null +++ b/src/dis6/synthetic_environment/PointObjectStatePdu.h @@ -0,0 +1,144 @@ +#pragma once + +#include "dis6/common/EntityID.h" +#include "dis6/common/Orientation.h" +#include "dis6/common/SimulationAddress.h" +#include "dis6/common/Vector3Double.h" +#include "dis6/synthetic_environment/ObjectType.h" +#include "dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.11.3: Inormation abut the addition or modification of a synthecic +// enviroment object that is anchored to the terrain with a single point. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class PointObjectStatePdu : public SyntheticEnvironmentFamilyPdu { + protected: + /** Object in synthetic environment */ + dis::EntityID _objectID; + + /** Object with which this point object is associated */ + dis::EntityID _referencedObjectID; + + /** unique update number of each state transition of an object */ + uint16_t _updateNumber; + + /** force ID */ + uint8_t _forceID; + + /** modifications */ + uint8_t _modifications; + + /** Object type */ + ObjectType _objectType; + + /** Object location */ + Vector3Double _objectLocation; + + /** Object orientation */ + Orientation _objectOrientation; + + /** Object apperance */ + double _objectAppearance; + + /** requesterID */ + SimulationAddress _requesterID; + + /** receiver ID */ + SimulationAddress _receivingID; + + /** padding */ + uint32_t _pad2; + + public: + PointObjectStatePdu(); + virtual ~PointObjectStatePdu(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + dis::EntityID& getObjectID(); + const dis::EntityID& getObjectID() const; + void setObjectID(const dis::EntityID& pX); + + dis::EntityID& getReferencedObjectID(); + const dis::EntityID& getReferencedObjectID() const; + void setReferencedObjectID(const dis::EntityID& pX); + + uint16_t getUpdateNumber() const; + void setUpdateNumber(uint16_t pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getModifications() const; + void setModifications(uint8_t pX); + + ObjectType& getObjectType(); + const ObjectType& getObjectType() const; + void setObjectType(const ObjectType& pX); + + Vector3Double& getObjectLocation(); + const Vector3Double& getObjectLocation() const; + void setObjectLocation(const Vector3Double& pX); + + Orientation& getObjectOrientation(); + const Orientation& getObjectOrientation() const; + void setObjectOrientation(const Orientation& pX); + + double getObjectAppearance() const; + void setObjectAppearance(double pX); + + SimulationAddress& getRequesterID(); + const SimulationAddress& getRequesterID() const; + void setRequesterID(const SimulationAddress& pX); + + SimulationAddress& getReceivingID(); + const SimulationAddress& getReceivingID() const; + void setReceivingID(const SimulationAddress& pX); + + uint32_t getPad2() const; + void setPad2(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const PointObjectStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.cpp b/src/dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.cpp new file mode 100644 index 00000000..64df9165 --- /dev/null +++ b/src/dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.cpp @@ -0,0 +1,66 @@ +#include "dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h" + +using namespace DIS; + +SyntheticEnvironmentFamilyPdu::SyntheticEnvironmentFamilyPdu() + +{ + SetProtocolFamily(9); +} + +SyntheticEnvironmentFamilyPdu::~SyntheticEnvironmentFamilyPdu() = default; + +static void SyntheticEnvironmentFamilyPdu::Marshal(DataStream& dataStream) { + Pdu::marshal(data_stream); // Marshal information in superclass first +} + +static void SyntheticEnvironmentFamilyPdu::Unmarshal(DataStream& dataStream) { + Pdu::unmarshal(data_stream); // unmarshal information in superclass first +} + +bool SyntheticEnvironmentFamilyPdu::operator==( + const SyntheticEnvironmentFamilyPdu& rhs) const { + bool ivars_equal = true; + + ivars_equal = Pdu::operator==(rhs); + + return ivars_equal; +} + +int SyntheticEnvironmentFamilyPdu::GetMarshalledSize() const { + int marshal_size = 0; + + marshal_size = getMarshalledSize(); + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h b/src/dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h new file mode 100644 index 00000000..ea1ab01f --- /dev/null +++ b/src/dis6/synthetic_environment/SyntheticEnvironmentFamilyPdu.h @@ -0,0 +1,58 @@ +#pragma once + +#include "dis6/common/Pdu.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.11: Abstract superclass for synthetic environment PDUs + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class SyntheticEnvironmentFamilyPdu : public dis::Pdu { + protected: + public: + SyntheticEnvironmentFamilyPdu(); + virtual ~SyntheticEnvironmentFamilyPdu(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const SyntheticEnvironmentFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/utils/CMakeLists.txt b/src/dis6/utils/CMakeLists.txt index a5f29523..8fb34107 100644 --- a/src/dis6/utils/CMakeLists.txt +++ b/src/dis6/utils/CMakeLists.txt @@ -26,13 +26,5 @@ set(utils_src StreamUtils.cpp ) -# CMake < 3.16 requires target_sources to be specified as -# absolute paths if not in the same directory as the target -# definition. If cmake_minimum_required is ever changed to -# be >= 16, these 2 lines can be removed. -list(TRANSFORM utils_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") - -target_sources(OpenDIS6 PRIVATE ${utils_src}) - install(FILES ${utils_hdr} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/utils) diff --git a/src/dis6/utils/Conversion.cpp b/src/dis6/utils/Conversion.cpp index ea066aef..7ca83068 100644 --- a/src/dis6/utils/Conversion.cpp +++ b/src/dis6/utils/Conversion.cpp @@ -1,30 +1,27 @@ -#include -#include +#include "dis6/utils/Conversion.h" -using namespace DIS; +#include "dis6/utils/Masks.h" -//const unsigned char Convert::ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS = 5; +namespace dis { +int Convert::MakeArticulationParameterType(int typeclass, int typemetric) { + // enforce a ceiling on typemetric + typemetric = typemetric & kArticulationParameterTypeMetricMask; -int Convert::MakeArticulationParameterType(int typeclass, int typemetric) -{ - // enforce a ceiling on typemetric - typemetric = typemetric & ARTICULATION_PARAMETER_TYPE_METRIC_MASK; - - // shift the typeclass bits to the left by the precision amount of typemetric - // and then add the typemetric bits - return( (typeclass << ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS) - + typemetric ); + // shift the typeclass bits to the left by the precision amount of typemetric + // and then add the typemetric bits + return ((typeclass << kArticulationParameterTypeMetricNumberOfBits) + + typemetric); } -int Convert::GetArticulationTypeMetric(int parametertype) -{ - // wipe off the typeclass bits and return the typemetric bits - return( parametertype & ARTICULATION_PARAMETER_TYPE_METRIC_MASK); +int Convert::GetArticulationTypeMetric(int parametertype) { + // wipe off the typeclass bits and return the typemetric bits + return (parametertype & kArticulationParameterTypeMetricMask); } -int Convert::GetArticulationTypeClass(int parametertype) -{ - // wipe off the typemetric bits and return the typeclass bits - return( parametertype >> ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS ); +int Convert::GetArticulationTypeClass(int parametertype) { + // wipe off the typemetric bits and return the typeclass bits + return (parametertype >> kArticulationParameterTypeMetricNumberOfBits); } + +} // namespace dis diff --git a/src/dis6/utils/Conversion.h b/src/dis6/utils/Conversion.h index 0486334b..c4487e78 100644 --- a/src/dis6/utils/Conversion.h +++ b/src/dis6/utils/Conversion.h @@ -6,38 +6,44 @@ #ifndef _dcl_dis_conversion_h_ #define _dcl_dis_conversion_h_ -#include // for library symbols +#include -namespace DIS -{ - /// a name-scope for conversion functions. - struct OPENDIS6_EXPORT Convert - { - /// the number of bits used to store the type metric value - /// within the Articulation Parameter's parameter type value. - /// this mask is based on the IEEE Std 1278.1-1995 - static const unsigned char ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS = 5; +namespace dis { +/// a name-scope for conversion functions. +struct Convert { + /// the number of bits used to store the type metric value + /// within the Articulation Parameter's parameter type value. + /// this mask is based on the IEEE Std 1278.1-1995 + static const uint8_t kArticulationParameterTypeMetricNumberOfBits = 5; - /// make the value needed for the ArticulationParameter's Parameter Type. - /// @param typeclass the enumeration for the articulated part. - /// This must have less precision than ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS. - /// @param typemetric the enumeration for the motion description. - /// this must have less precision than 32 - ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS. - /// @return the value to be used as the Parameter Type, with 32 bits precision. - static int MakeArticulationParameterType(int typeclass, int typemetric); + /// make the value needed for the ArticulationParameter's Parameter Type. + /// @param typeclass the enumeration for the articulated part. + /// This must have less precision than + /// ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS. + /// @param typemetric the enumeration for the motion description. + /// this must have less precision than 32 - + /// ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS. + /// @return the value to be used as the Parameter Type, with 32 bits + /// precision. + static int MakeArticulationParameterType(int typeclass, int typemetric); - /// extract the data for the type metric value stored within the parameter type value. - /// this an inverse to the function, MakeArticulationParameterType. - /// @param parametertype the value storing the type metric and type class values. - /// @return the type metric value, with ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS bits precision. - static int GetArticulationTypeMetric(int parametertype); + /// extract the data for the type metric value stored within the parameter + /// type value. this an inverse to the function, + /// MakeArticulationParameterType. + /// @param parametertype the value storing the type metric and type class + /// values. + /// @return the type metric value, with + /// ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS bits precision. + static int GetArticulationTypeMetric(int parametertype); - /// extract the data for the type class value stored within the parameter type value. - /// this an inverse to the function, MakeArticulationParameterType. - /// @param parametertype the value storing the type metric and type class values. - /// @return the type class value, with ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS bits precision - static int GetArticulationTypeClass(int parametertype); - }; -} + /// extract the data for the type class value stored within the parameter type + /// value. this an inverse to the function, MakeArticulationParameterType. + /// @param parametertype the value storing the type metric and type class + /// values. + /// @return the type class value, with + /// ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS bits precision + static int GetArticulationTypeClass(int parametertype); +}; +} // namespace dis -#endif // _dcl_dis_conversion_h_ +#endif // _dcl_dis_conversion_h_ diff --git a/src/dis6/utils/DataStream.cpp b/src/dis6/utils/DataStream.cpp index b9f5600e..38f7074d 100644 --- a/src/dis6/utils/DataStream.cpp +++ b/src/dis6/utils/DataStream.cpp @@ -1,284 +1,225 @@ -#include +#include "dis6/util/DataStream.h" -#include // for debug output - -using namespace DIS; +namespace dis { DataStream::DataStream(Endian stream) - : _buffer() - , _read_pos(0) - , _write_pos(0) - , _stream_endian(stream) - , _machine_endian(LITTLE) -{ - long one(1); - char e = (reinterpret_cast( &one ))[0]; - - if( e == (char)1 ) - { - _machine_endian = LITTLE; - } - else - { - _machine_endian = BIG; - } + : _buffer(), + _read_pos(0), + _write_pos(0), + _stream_endian(stream), + _machine_endian(LITTLE) { + int32_t one(1); + char e = (reinterpret_cast(&one))[0]; + + if (e == (char)1) { + _machine_endian = LITTLE; + } else { + _machine_endian = BIG; + } } DataStream::DataStream(const char* buffer, size_t length, Endian stream) - : _buffer() - , _read_pos(0) - , _write_pos(0) - , _stream_endian(stream) - , _machine_endian(LITTLE) -{ - long one(1); - char e = (reinterpret_cast( &one ))[0]; - - if( e == (char)1 ) - { - _machine_endian = LITTLE; - } - else - { - _machine_endian = BIG; - } - - SetStream( buffer, length, stream ); -} -DataStream::~DataStream() -{ + : _buffer(), + _read_pos(0), + _write_pos(0), + _stream_endian(stream), + _machine_endian(LITTLE) { + int32_t one(1); + char e = (reinterpret_cast(&one))[0]; + + if (e == (char)1) { + _machine_endian = LITTLE; + } else { + _machine_endian = BIG; + } + + SetStream(buffer, length, stream); } +DataStream::~DataStream() {} -//const DataStream::BufferType& DataStream::GetBuffer() const +// const DataStream::BufferType& DataStream::GetBuffer() const //{ -// return _buffer; -//} +// return _buffer; +// } -Endian DataStream::GetStreamEndian() const -{ - return _stream_endian; -} +Endian DataStream::GetStreamEndian() const { return _stream_endian; } -Endian DataStream::GetMachineEndian() const -{ - return _machine_endian; -} +Endian DataStream::GetMachineEndian() const { return _machine_endian; } -size_t DataStream::GetWritePos() const -{ - return _write_pos; -} +size_t DataStream::GetWritePos() const { return _write_pos; } -size_t DataStream::GetReadPos() const -{ - return _read_pos; -} +size_t DataStream::GetReadPos() const { return _read_pos; } -size_t DataStream::size() const -{ - return _buffer.size(); -} +size_t DataStream::size() const { return _buffer.size(); } -void DataStream::clear() -{ - _write_pos = 0; - _read_pos = 0; - _buffer.clear(); +void DataStream::clear() { + _write_pos = 0; + _read_pos = 0; + _buffer.clear(); } -bool DataStream::empty() const -{ - return _buffer.empty(); -} +bool DataStream::empty() const { return _buffer.empty(); } -const char& DataStream::operator [](unsigned int offset) const -{ - return _buffer[_read_pos+offset]; +const char& DataStream::operator[](uint32_t offset) const { + return _buffer[_read_pos + offset]; } // currently copies the source data. -void DataStream::SetStream(const char* buffer, size_t length, Endian stream) -{ - // reassign the endian - _stream_endian = stream; - - _write_pos = length; - _read_pos = 0; - - // resize the array - if( _buffer.size() < length ) - { - _buffer.resize( length ); - } - - // take ownership of the data - // copy the data, expensive! - for(unsigned int i=0; i>(char& c) -{ - ReadAlgorithm( c ); - return *this; +DataStream& DataStream::operator>>(char& c) { + ReadAlgorithm(c); + return *this; } -DataStream& DataStream::operator >>(unsigned char& c) -{ - ReadAlgorithm( c ); - return *this; +DataStream& DataStream::operator>>(uint8_t& c) { + ReadAlgorithm(c); + return *this; } -DataStream& DataStream::operator >>(float& f) -{ - ReadAlgorithm( f ); - return *this; +DataStream& DataStream::operator>>(float& f) { + ReadAlgorithm(f); + return *this; } -DataStream& DataStream::operator >>(double& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(double& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(int& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(int& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(unsigned int& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(uint32_t& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(long long& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(int64_t& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(unsigned long long& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(uint64_t& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(unsigned short& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(uint16_t& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(short& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(int16_t& d) { + ReadAlgorithm(d); + return *this; } + +} // namespace dis diff --git a/src/dis6/utils/DataStream.h b/src/dis6/utils/DataStream.h index 60d2c7ea..0f2c7a7a 100644 --- a/src/dis6/utils/DataStream.h +++ b/src/dis6/utils/DataStream.h @@ -6,148 +6,142 @@ #define _dcl_dis_data_stream_h_ // the class member, DataStream::BufferType is causing warnign 4251. -// disable it until a proper fix is found, as instructed from the enlightening article: -// http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html +// disable it until a proper fix is found, as instructed from the enlightening +// article: http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html #if _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4251 ) +#pragma warning(push) +#pragma warning(disable : 4251) #endif -#include // for typedef, member -#include // for typedef, member -#include // for enum -#include // for library symbols -#include // for size_t and NULL definition -#include // for memcpy - -namespace DIS -{ - /// a class to support managing a network buffer. - /// the clients are responsible for managing the char buffer memory. - /// this class explicitly defines operators for expected types. - class OPENDIS6_EXPORT DataStream - { - public: - /// Setup the internal buffer's Endian type. - /// @param stream the Endian type to use for the internal buffer, - /// which will be used for network socket writes. - DataStream(Endian stream); - - /// Setup the internal buffer. - /// @param buffer the data to copy and manage. - /// @param length the number of bytes in the buffer. - /// @param stream the Endian type to use for the internal buffer, - DataStream(const char* buffer, size_t length, Endian stream); - ~DataStream(); - - /// a method for reading the stored buffer data. - /// @param offset the index distance with respect to the current read point. - const char& operator [](unsigned int offset) const; - - /// take ownership of the data buffer. - void SetStream(const char* buffer, size_t length, Endian order); - - // write operations - DataStream& operator <<(bool c); - DataStream& operator <<(char c); - DataStream& operator <<(unsigned char c); - DataStream& operator <<(float c); - DataStream& operator <<(double c); - DataStream& operator <<(int c); - DataStream& operator <<(unsigned int c); - DataStream& operator <<(long long c); - DataStream& operator <<(unsigned long long c); - DataStream& operator <<(unsigned short c); - DataStream& operator <<(short c); - - // read operations - DataStream& operator >>(bool& c); - DataStream& operator >>(char& c); - DataStream& operator >>(unsigned char& c); - DataStream& operator >>(float& c); - DataStream& operator >>(double& c); - DataStream& operator >>(int& c); - DataStream& operator >>(unsigned int& c); - DataStream& operator >>(long long& c); - DataStream& operator >>(unsigned long long& c); - DataStream& operator >>(unsigned short& c); - DataStream& operator >>(short& c); - - Endian GetStreamEndian() const; - Endian GetMachineEndian() const; - - size_t GetWritePos() const; - size_t GetReadPos() const; - - size_t size() const; - - void clear(); - - bool empty() const; - - private: - template - void IncrementPointer(IterT& iter) - { - iter += sizeof(T); - } - - template - void DecrementPointer(IterT& iter) - { - iter -= sizeof(T); - } - - /// this algorithm should only be used for primitive types, - /// because the class size takes into account the virtual function table. - template - void WriteAlgorithm(T t) - { - char* ch = reinterpret_cast( &t ); - DoFlip( ch , sizeof(T) ); - DoWrite( ch , sizeof(T) ); - IncrementPointer( _write_pos ); - } - - /// this algorithm should only be used for primitive types, - /// because the class size takes into account the virtual function table. - template - void ReadAlgorithm(T& t) - { - char ch[sizeof(T)]; - DoRead( ch , sizeof(T) ); - DoFlip( ch , sizeof(T) ); - memcpy(&t, ch, sizeof(t)); - IncrementPointer( _read_pos ); - } - - /// will flip the buffer if the buffer endian is different than the machine's. - void DoFlip(char* buf, size_t bufsize); - - void DoWrite(const char* buf, size_t bufsize); - - void DoRead(char* ch, size_t bufsize); - - - typedef std::vector BufferType; - //const BufferType& GetBuffer() const; - - BufferType _buffer; - - /// the location of the read/write. - size_t _read_pos; - size_t _write_pos; - - /// the requirement for the managed buffer - Endian _stream_endian; - - /// the native endian type - Endian _machine_endian; - }; -} +#include +#include // for size_t and NULL definition +#include // for memcpy +#include // for typedef, member +#include // for typedef, member + +#include "dis6/utils/Endian.h" // for enum + +namespace dis { +/// a class to support managing a network buffer. +/// the clients are responsible for managing the char buffer memory. +/// this class explicitly defines operators for expected types. +class DataStream { + public: + /// Setup the internal buffer's Endian type. + /// @param stream the Endian type to use for the internal buffer, + /// which will be used for network socket writes. + DataStream(Endian stream); + + /// Setup the internal buffer. + /// @param buffer the data to copy and manage. + /// @param length the number of bytes in the buffer. + /// @param stream the Endian type to use for the internal buffer, + DataStream(const char* buffer, size_t length, Endian stream); + ~DataStream(); + + /// a method for reading the stored buffer data. + /// @param offset the index distance with respect to the current read point. + const char& operator[](uint32_t offset) const; + + /// take ownership of the data buffer. + void SetStream(const char* buffer, size_t length, Endian order); + + // write operations + DataStream& operator<<(bool c); + DataStream& operator<<(char c); + DataStream& operator<<(uint8_t c); + DataStream& operator<<(float c); + DataStream& operator<<(double c); + DataStream& operator<<(int c); + DataStream& operator<<(uint32_t c); + DataStream& operator<<(int64_t c); + DataStream& operator<<(uint64_t c); + DataStream& operator<<(uint16_t c); + DataStream& operator<<(int16_t c); + + // read operations + DataStream& operator>>(bool& c); + DataStream& operator>>(char& c); + DataStream& operator>>(uint8_t& c); + DataStream& operator>>(float& c); + DataStream& operator>>(double& c); + DataStream& operator>>(int& c); + DataStream& operator>>(uint32_t& c); + DataStream& operator>>(int64_t& c); + DataStream& operator>>(uint64_t& c); + DataStream& operator>>(uint16_t& c); + DataStream& operator>>(int16_t& c); + + [[nodiscard]] Endian GetStreamEndian() const; + [[nodiscard]] Endian GetMachineEndian() const; + + [[nodiscard]] size_t GetWritePos() const; + [[nodiscard]] size_t GetReadPos() const; + + [[nodiscard]] size_t size() const; + + void clear(); + + [[nodiscard]] bool empty() const; + + private: + template + void IncrementPointer(IterT& iter) { + iter += sizeof(T); + } + + template + void DecrementPointer(IterT& iter) { + iter -= sizeof(T); + } + + /// this algorithm should only be used for primitive types, + /// because the class size takes into account the virtual function table. + template + void WriteAlgorithm(T t) { + char* ch = reinterpret_cast(&t); + DoFlip(ch, sizeof(T)); + DoWrite(ch, sizeof(T)); + IncrementPointer(write_pos_); + } + + /// this algorithm should only be used for primitive types, + /// because the class size takes into account the virtual function table. + template + void ReadAlgorithm(T& t) { + char ch[sizeof(T)]; + DoRead(ch, sizeof(T)); + DoFlip(ch, sizeof(T)); + memcpy(&t, ch, sizeof(t)); + IncrementPointer(read_pos_); + } + + /// will flip the buffer if the buffer endian is different than the machine's. + void DoFlip(char* buf, size_t bufsize); + + void DoWrite(const char* buf, size_t bufsize); + + void DoRead(char* ch, size_t bufsize); + + using BufferType = std::vector; + // const BufferType& GetBuffer() const; + + BufferType buffer_; + + /// the location of the read/write. + size_t read_pos_; + size_t write_pos_; + + /// the requirement for the managed buffer + Endian stream_endian_; + + /// the native endian type + Endian machine_endian_; +}; +} // namespace dis #if _MSC_VER -#pragma warning( pop ) +#pragma warning(pop) #endif #endif // _dcl_dis_data_stream_h_ diff --git a/src/dis6/utils/Endian.h b/src/dis6/utils/Endian.h index c0bd5e5f..83bf82f6 100644 --- a/src/dis6/utils/Endian.h +++ b/src/dis6/utils/Endian.h @@ -1,16 +1,13 @@ -#ifndef _dcl_dis_endian_h_ -#define _dcl_dis_endian_h_ +#ifndef DIS6_UTILS_ENDIAN_H_ +#define DIS6_UTILS_ENDIAN_H_ -#include // for library symbols +namespace dis { +/// the order of bytes that are on the left +enum Endian { + kLittle = 1, + kBig = 0, +}; -namespace DIS -{ - /// the order of bytes that are on the left - enum OPENDIS6_EXPORT Endian - { - LITTLE=1, - BIG=0, - }; -} +} // namespace dis -#endif // _dcl_dis_endian_h_ +#endif // DIS6_UTILS_ENDIAN_H_ diff --git a/src/dis6/utils/IBufferProcessor.h b/src/dis6/utils/IBufferProcessor.h index 6b098a84..9c13c38b 100644 --- a/src/dis6/utils/IBufferProcessor.h +++ b/src/dis6/utils/IBufferProcessor.h @@ -5,17 +5,15 @@ #ifndef _dcl_dis_i_buffer_processor_h_ #define _dcl_dis_i_buffer_processor_h_ -#include +#include "dis6/utils/Endian.h" -namespace DIS -{ - /// the interface class for handling read operations. - class IBufferProcessor - { - public: - virtual ~IBufferProcessor() {} - virtual void Process(const char* buf, unsigned int size, Endian e)=0; - }; -} +namespace dis { +/// the interface class for handling read operations. +class IBufferProcessor { + public: + virtual ~IBufferProcessor() = default; + virtual void Process(const char* buf, uint32_t size, Endian e) = 0; +}; +} // namespace dis #endif // _dcl_dis_i_buffer_processor_h_ diff --git a/src/dis6/utils/IPacketProcessor.h b/src/dis6/utils/IPacketProcessor.h index 347bc89b..9f84a31c 100644 --- a/src/dis6/utils/IPacketProcessor.h +++ b/src/dis6/utils/IPacketProcessor.h @@ -5,19 +5,17 @@ #ifndef _dcl_dis_i_packet_processor_h_ #define _dcl_dis_i_packet_processor_h_ -namespace DIS -{ - class Pdu; +namespace DIS { +class Pdu; - /// it is the responsibility of the processor to use the packet - /// because it will be deleted after this call. - class IPacketProcessor - { - public: - virtual ~IPacketProcessor() {} - virtual void Process(const Pdu& p)=0; - }; +/// it is the responsibility of the processor to use the packet +/// because it will be deleted after this call. +class IPacketProcessor { + public: + virtual ~IPacketProcessor() {} + virtual void Process(const Pdu& p) = 0; +}; -} +} // namespace DIS -#endif // _dcl_dis_i_packet_processor_h_ +#endif // _dcl_dis_i_packet_processor_h_ diff --git a/src/dis6/utils/IPduBank.h b/src/dis6/utils/IPduBank.h index c8b9fa7c..e85829f6 100644 --- a/src/dis6/utils/IPduBank.h +++ b/src/dis6/utils/IPduBank.h @@ -3,20 +3,16 @@ #include #include -namespace DIS -{ - /// houses instances for the set of known PDU classes to be returned - /// when provided with the PDU type's identifier value. - class IPduBank - { - public: - ~IPduBank(){} - - /// finds the PDU instance corresponding to the identifier - /// @param pdu_type the 8-bit PDU type identifier - /// @return NULL when the pdu_type is unknown. - virtual Pdu* GetStaticPDU( unsigned char pdu_type, DataStream& ds ) = 0; - }; -} - +namespace DIS { +/// houses instances for the set of known PDU classes to be returned +/// when provided with the PDU type's identifier value. +class IPduBank { + public: + ~IPduBank() {} + /// finds the PDU instance corresponding to the identifier + /// @param pdu_type the 8-bit PDU type identifier + /// @return NULL when the pdu_type is unknown. + virtual Pdu* GetStaticPDU(uint8_t pdu_type, DataStream& ds) = 0; +}; +} // namespace DIS diff --git a/src/dis6/utils/IncomingMessage.cpp b/src/dis6/utils/IncomingMessage.cpp index b824639d..ea23a6bb 100644 --- a/src/dis6/utils/IncomingMessage.cpp +++ b/src/dis6/utils/IncomingMessage.cpp @@ -1,207 +1,180 @@ -#include -#include -#include -#include -#include #include #include - -#include +#include +#include +#include +#include +#include using namespace DIS; -// the DIS specification says the type is known for all PDUs at the 3rd byte of the PDU buffer. -const unsigned int PDU_TYPE_POSITION = 2; +// the DIS specification says the type is known for all PDUs at the 3rd byte of +// the PDU buffer. +const uint32_t kPduTypePosition = 2; -IncomingMessage::IncomingMessage() -: _processors(), _pduBanks() -{ -} +IncomingMessage::IncomingMessage() : _processors(), _pduBanks() {} -IncomingMessage::~IncomingMessage() -{ -} +IncomingMessage::~IncomingMessage() {} -void IncomingMessage::Process(const char* buf, unsigned int size, Endian e) -{ - if( size < 1 ) - { - return; - } +void IncomingMessage::Process(const char* buf, uint32_t size, Endian e) { + if (size < 1) { + return; + } - DataStream ds( buf , size , e ); + DataStream ds(buf, size, e); - while( ds.GetReadPos() < ds.size() ) - { - unsigned char pdu_type = ds[PDU_TYPE_POSITION]; - SwitchOnType( static_cast(pdu_type), ds ); - } + while (ds.GetReadPos() < ds.size()) { + uint8_t pdu_type = ds[PDU_TYPE_POSITION]; + SwitchOnType(static_cast(pdu_type), ds); + } } -void IncomingMessage::SwitchOnType(DIS::PDUType pdu_type, DataStream& ds) -{ - Pdu *pdu = NULL; - - PduBankContainer::iterator containerIter; - - // first, check if any custom PDU bank registered - PduBankContainer::iterator pduBankIt = _pduBanks.find(pdu_type); - if (pduBankIt != _pduBanks.end()) - { - pdu = pduBankIt->second->GetStaticPDU(pdu_type, ds); - } else - { - pdu = PduBank::GetStaticPDU(pdu_type); - } - - // if valid pdu point, and at least 1 processor - if (pdu && (_processors.count(pdu_type) > 0)) - { - pdu->unmarshal( ds ); - - // assumes the location in the buffer is the packet id. - typedef std::pair RangePair; - RangePair rangepair = _processors.equal_range( pdu_type ); - PacketProcessorContainer::iterator processor_iter = rangepair.first; - PacketProcessorContainer::iterator processor_end = rangepair.second; - while( processor_iter != processor_end ) - { - (processor_iter->second)->Process( *pdu ); - ++processor_iter; - } - } - else - { - ds.clear(); - } +void IncomingMessage::SwitchOnType(DIS::PDUType pdu_type, DataStream& ds) { + Pdu* pdu = NULL; + + PduBankContainer::iterator containerIter; + + // first, check if any custom PDU bank registered + PduBankContainer::iterator pduBankIt = _pduBanks.find(pdu_type); + if (pduBankIt != _pduBanks.end()) { + pdu = pduBankIt->second->GetStaticPDU(pdu_type, ds); + } else { + pdu = PduBank::GetStaticPDU(pdu_type); + } + + // if valid pdu point, and at least 1 processor + if (pdu && (_processors.count(pdu_type) > 0)) { + pdu->unmarshal(ds); + + // assumes the location in the buffer is the packet id. + typedef std::pair + RangePair; + RangePair rangepair = _processors.equal_range(pdu_type); + PacketProcessorContainer::iterator processor_iter = rangepair.first; + PacketProcessorContainer::iterator processor_end = rangepair.second; + while (processor_iter != processor_end) { + (processor_iter->second)->Process(*pdu); + ++processor_iter; + } + } else { + ds.clear(); + } } +bool IncomingMessage::AddProcessor(uint8_t id, IPacketProcessor* pp) { + PacketProcessorContainer::value_type candidate(id, pp); + PacketProcessorContainer::iterator containerIter; -bool IncomingMessage::AddProcessor(unsigned char id, IPacketProcessor* pp) -{ - PacketProcessorContainer::value_type candidate(id,pp); - PacketProcessorContainer::iterator containerIter; - - // If this id doesn't already have this processor (it shouldn't) - if (!FindProccessorContainer(id, pp, containerIter)) - { - _processors.insert( candidate ); - return true; - } + // If this id doesn't already have this processor (it shouldn't) + if (!FindProccessorContainer(id, pp, containerIter)) { + _processors.insert(candidate); + return true; + } - return false; + return false; } ///\todo add proper support for erasing from a multimap. ///\warning erases any processor registered for the id -bool IncomingMessage::RemoveProcessor(unsigned char id, const IPacketProcessor* pp) -{ - PacketProcessorContainer::iterator containerIter; - - if (FindProccessorContainer(id, pp, containerIter)) - { - // Erases only the single pair found in the interator - _processors.erase( containerIter ); - return true; - } - - // The pair doesn't exist - return false; +bool IncomingMessage::RemoveProcessor(uint8_t id, + const IPacketProcessor* pp) { + PacketProcessorContainer::iterator containerIter; + + if (FindProccessorContainer(id, pp, containerIter)) { + // Erases only the single pair found in the interator + _processors.erase(containerIter); + return true; + } + + // The pair doesn't exist + return false; } -bool IncomingMessage::AddPduBank(unsigned char id, IPduBank* pduBank) -{ - PduBankContainer::value_type candidate(id,pduBank); - PduBankContainer::iterator containerIter; +bool IncomingMessage::AddPduBank(uint8_t id, IPduBank* pduBank) { + PduBankContainer::value_type candidate(id, pduBank); + PduBankContainer::iterator containerIter; - // If this id doesn't already have this PDU bank (it shouldn't) - if (!FindPduBankContainer(id, pduBank, containerIter)) - { - _pduBanks.insert( candidate ); - return true; - } + // If this id doesn't already have this PDU bank (it shouldn't) + if (!FindPduBankContainer(id, pduBank, containerIter)) { + _pduBanks.insert(candidate); + return true; + } - return false; + return false; } ///\todo add proper support for erasing from a multimap. ///\warning erases any PDU bank registered PDU type -bool IncomingMessage::RemovePduBank(unsigned char id, const IPduBank* pduBank) -{ - PduBankContainer::iterator containerIter; - - if (FindPduBankContainer(id, pduBank, containerIter)) - { - // Erases only the single pair found in the interator - _pduBanks.erase( containerIter ); - return true; - } +bool IncomingMessage::RemovePduBank(uint8_t id, const IPduBank* pduBank) { + PduBankContainer::iterator containerIter; - // The pair doesn't exist - return false; -} + if (FindPduBankContainer(id, pduBank, containerIter)) { + // Erases only the single pair found in the interator + _pduBanks.erase(containerIter); + return true; + } -IncomingMessage::PacketProcessorContainer& IncomingMessage::GetProcessors() -{ - return _processors; + // The pair doesn't exist + return false; } -const IncomingMessage::PacketProcessorContainer& IncomingMessage::GetProcessors() const -{ - return _processors; +IncomingMessage::PacketProcessorContainer& IncomingMessage::GetProcessors() { + return _processors; } -IncomingMessage::PduBankContainer& IncomingMessage::GetPduBanks() -{ - return _pduBanks; +const IncomingMessage::PacketProcessorContainer& +IncomingMessage::GetProcessors() const { + return _processors; } -const IncomingMessage::PduBankContainer& IncomingMessage::GetPduBanks() const -{ - return _pduBanks; +IncomingMessage::PduBankContainer& IncomingMessage::GetPduBanks() { + return _pduBanks; } +const IncomingMessage::PduBankContainer& IncomingMessage::GetPduBanks() const { + return _pduBanks; +} -bool IncomingMessage::FindProccessorContainer(unsigned char id, const IPacketProcessor* pp, PacketProcessorContainer::iterator &containerIter) -{ - PacketProcessIteratorPair iterPair = _processors.equal_range(id); - - // Check to make sure that the processor we're trying to add is not already there - while (iterPair.first != iterPair.second) - { - // If this processor with a matching id has a the exact same processor, bail - if ((iterPair.first)->second == pp) - { - containerIter = iterPair.first; - return true; - } +bool IncomingMessage::FindProccessorContainer( + uint8_t id, const IPacketProcessor* pp, + PacketProcessorContainer::iterator& containerIter) { + PacketProcessIteratorPair iterPair = _processors.equal_range(id); + + // Check to make sure that the processor we're trying to add is not already + // there + while (iterPair.first != iterPair.second) { + // If this processor with a matching id has a the exact same processor, bail + if ((iterPair.first)->second == pp) { + containerIter = iterPair.first; + return true; + } - iterPair.first++; - } + iterPair.first++; + } - // No matches were found in the loop - return false; + // No matches were found in the loop + return false; } +bool IncomingMessage::FindPduBankContainer( + uint8_t pdu_type, const IPduBank* pduBank, + PduBankContainer::iterator& containerIter) { + PduBankIteratorPair iterPair = _pduBanks.equal_range(pdu_type); + + // Check to make sure that the PDU bank we're trying to add is not already + // there + while (iterPair.first != iterPair.second) { + // If this PDU bank with a matching id has a the exact same PDU bank, bail + if ((iterPair.first)->second == pduBank) { + containerIter = iterPair.first; + return true; + } -bool IncomingMessage::FindPduBankContainer(unsigned char pdu_type, const IPduBank* pduBank, PduBankContainer::iterator &containerIter) -{ - PduBankIteratorPair iterPair = _pduBanks.equal_range(pdu_type); - - // Check to make sure that the PDU bank we're trying to add is not already there - while (iterPair.first != iterPair.second) - { - // If this PDU bank with a matching id has a the exact same PDU bank, bail - if ((iterPair.first)->second == pduBank) - { - containerIter = iterPair.first; - return true; - } - - iterPair.first++; - } + iterPair.first++; + } - // No matches were found in the loop - return false; + // No matches were found in the loop + return false; } diff --git a/src/dis6/utils/IncomingMessage.h b/src/dis6/utils/IncomingMessage.h index 190a1194..d10fe8fb 100644 --- a/src/dis6/utils/IncomingMessage.h +++ b/src/dis6/utils/IncomingMessage.h @@ -5,73 +5,83 @@ #ifndef _dcl_dis_incoming_message_ #define _dcl_dis_incoming_message_ -#include // for base class -#include -#include // for member -#include // for internal type -#include // for library symbols -#include - -namespace DIS -{ - class Pdu; - class IPacketProcessor; - class DataStream; - - /// A framework for routing the packet to the correct processor. - class OPENDIS6_EXPORT IncomingMessage : public IBufferProcessor - { - public: - /// the container type for supporting processors. - typedef std::multimap PacketProcessorContainer; - - /// the container type for supporting PDU banks. - typedef std::multimap PduBankContainer; - - IncomingMessage(); - ~IncomingMessage(); - - void Process(const char* buf, unsigned int size, Endian e); - - /// registers the ipp instance to process packets with the id - /// @return 'true' if the pair of parameters were not found in the container and were addded. 'false' if the pair was found. - bool AddProcessor(unsigned char id, IPacketProcessor* pp); - - /// unregisters the ipp instance for packets with the id. it does not clean up the delete the ipp. - /// @return 'true' if the pair of parameters were found in the container and removed. 'false' if the pair was not found. - bool RemoveProcessor(unsigned char id, const IPacketProcessor* pp); - - /// registers the PDU bank instance to provide the PDU object - /// @return 'true' if the pair of parameters were not found in the container and were addded. 'false' if the pair was found. - bool AddPduBank(unsigned char pdu_type, IPduBank* pduBank); - - /// unregisters the PDU bank instance - /// @return 'true' if the pair of parameters were found in the container and removed. 'false' if the pair was not found. - bool RemovePduBank(unsigned char pdu_type, const IPduBank* pduBank); - - PacketProcessorContainer& GetProcessors(); - const PacketProcessorContainer& GetProcessors() const; - - PduBankContainer& GetPduBanks(); - const PduBankContainer& GetPduBanks() const; - - private: - typedef std::pair PacketProcessIteratorPair; - PacketProcessorContainer _processors; - - typedef std::pair PduBankIteratorPair; - PduBankContainer _pduBanks; - - void SwitchOnType(DIS::PDUType pdu_type, DataStream& ds); - - /// Searches the proccesor container multimap for a matching container and returns the iterator - bool FindProccessorContainer(unsigned char id, const IPacketProcessor* pp, PacketProcessorContainer::iterator &containerIter); - - /// Searches the PDU bank container multimap for a matching container and returns the iterator - bool FindPduBankContainer(unsigned char pdu_type, const IPduBank* pduBank, PduBankContainer::iterator &containerIter); - }; - -} +#include // for member -#endif // _dcl_dis_incoming_message_ +#include "dis6/utils/Endian.h" // for internal type +#include "dis6/utils/IBufferProcessor.h" // for base class +#include "dis6/utils/IPduBank.h" +#include "dis6/utils/PDUType.h" + +namespace dis { +class Pdu; +class IPacketProcessor; +class DataStream; + +/// A framework for routing the packet to the correct processor. +class IncomingMessage : public IBufferProcessor { + public: + /// the container type for supporting processors. + typedef std::multimap PacketProcessorContainer; + + /// the container type for supporting PDU banks. + typedef std::multimap PduBankContainer; + + IncomingMessage(); + ~IncomingMessage(); + + void Process(const char* buf, uint32_t size, Endian e); + + /// registers the ipp instance to process packets with the id + /// @return 'true' if the pair of parameters were not found in the container + /// and were addded. 'false' if the pair was found. + bool AddProcessor(uint8_t id, IPacketProcessor* pp); + + /// unregisters the ipp instance for packets with the id. it does not clean + /// up the delete the ipp. + /// @return 'true' if the pair of parameters were found in the container and + /// removed. 'false' if the pair was not found. + bool RemoveProcessor(uint8_t id, const IPacketProcessor* pp); + + /// registers the PDU bank instance to provide the PDU object + /// @return 'true' if the pair of parameters were not found in the container + /// and were addded. 'false' if the pair was found. + bool AddPduBank(uint8_t pdu_type, IPduBank* pduBank); + + /// unregisters the PDU bank instance + /// @return 'true' if the pair of parameters were found in the container and + /// removed. 'false' if the pair was not found. + bool RemovePduBank(uint8_t pdu_type, const IPduBank* pduBank); + PacketProcessorContainer& GetProcessors(); + const PacketProcessorContainer& GetProcessors() const; + + PduBankContainer& GetPduBanks(); + const PduBankContainer& GetPduBanks() const; + + private: + typedef std::pair + PacketProcessIteratorPair; + PacketProcessorContainer _processors; + + typedef std::pair + PduBankIteratorPair; + PduBankContainer _pduBanks; + + void SwitchOnType(DIS::PDUType pdu_type, DataStream& ds); + + /// Searches the proccesor container multimap for a matching container and + /// returns the iterator + bool FindProccessorContainer( + uint8_t id, const IPacketProcessor* pp, + PacketProcessorContainer::iterator& containerIter); + + /// Searches the PDU bank container multimap for a matching container and + /// returns the iterator + bool FindPduBankContainer(uint8_t pdu_type, const IPduBank* pduBank, + PduBankContainer::iterator& containerIter); +}; + +} // namespace dis + +#endif // _dcl_dis_incoming_message_ diff --git a/src/dis6/utils/Masks.h b/src/dis6/utils/Masks.h index 7e6a1b65..51a06d99 100644 --- a/src/dis6/utils/Masks.h +++ b/src/dis6/utils/Masks.h @@ -5,14 +5,13 @@ #ifndef _dcl_dis_masks_h_ #define _dcl_dis_masks_h_ -#include // for library symbols +#include -namespace DIS -{ - /// the mask that will leave only the typemetric - /// from an integer representing the Articulation Parameter's parameter type. - /// this mask is based on the IEEE Std 1278.1-1995 - const unsigned int ARTICULATION_PARAMETER_TYPE_METRIC_MASK = 0x001F; -} +namespace dis { +/// the mask that will leave only the typemetric +/// from an integer representing the Articulation Parameter's parameter type. +/// this mask is based on the IEEE Std 1278.1-1995 +const uint32_t kArticulationParameterTypeMetricMask = 0x001F; +} // namespace dis -#endif // _dcl_dis_masks_h_ +#endif // _dcl_dis_masks_h_ diff --git a/src/dis6/utils/PDUBank.cpp b/src/dis6/utils/PDUBank.cpp index f1a13094..7b90b0c6 100644 --- a/src/dis6/utils/PDUBank.cpp +++ b/src/dis6/utils/PDUBank.cpp @@ -1,107 +1,169 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "dis6/utils/PDUBank.h" -using namespace DIS; +#include "dis6/DataQueryPdu.h" +#include "dis6/DesignatorPdu.h" +#include "dis6/DetonationPdu.h" +#include "dis6/ElectromagneticEmissionsPdu.h" +#include "dis6/EntityStatePdu.h" +#include "dis6/EventReportPdu.h" +#include "dis6/FirePdu.h" +#include "dis6/IntercomControlPdu.h" +#include "dis6/IntercomSignalPdu.h" +#include "dis6/IsGroupOfPdu.h" +#include "dis6/ReceiverPdu.h" +#include "dis6/RemoveEntityPdu.h" +#include "dis6/RepairCompletePdu.h" +#include "dis6/RepairResponsePdu.h" +#include "dis6/ResupplyCancelPdu.h" +#include "dis6/ResupplyOfferPdu.h" +#include "dis6/ResupplyReceivedPdu.h" +#include "dis6/ServiceRequestPdu.h" +#include "dis6/SetDataPdu.h" +#include "dis6/TransferControlRequestPdu.h" +#include "dis6/TransmitterPdu.h" +#include "dis6/entity_information/CollisionPdu.h" +#include "dis6/entity_management/AggregateStatePdu.h" +#include "dis6/entity_management/CreateEntityPdu.h" +#include "dis6/radio_communications/SignalPdu.h" +#include "dis6/simulation_management/AcknowledgePdu.h" +#include "dis6/simulation_management/ActionRequestPdu.h" +#include "dis6/simulation_management/ActionResponsePdu.h" +#include "dis6/simulation_management/CommentPdu.h" +#include "dis6/simulation_management/StartResumePdu.h" +#include "dis6/simulation_management/StopFreezePdu.h" -Pdu* PduBank::GetStaticPDU( DIS::PDUType pdu_type ) -{ - static EntityStatePdu entityStatePdu; - static FirePdu firePdu; - static DetonationPdu detonationPdu; - static CollisionPdu collisionPdu; - static ServiceRequestPdu ServiceRequestPdu; - static ResupplyOfferPdu resupplyOfferPdu; - static ResupplyReceivedPdu resupplyReceivedPdu; - static ResupplyCancelPdu resupplyCancelPdu; - static RepairCompletePdu repairCompletePdu; - static RepairResponsePdu repairResponsePdu; - static CreateEntityPdu createEntityPdu; - static RemoveEntityPdu removeEntityPdu; - static StartResumePdu startResumePdu; - static AcknowledgePdu acknowledgePdu; - static ActionRequestPdu actionRequestPdu; - static ActionResponsePdu actionResponsePdu; - static DataQueryPdu dataQueryPdu; - static SetDataPdu setDataPdu; - static EventReportPdu eventReportPdu; - static CommentPdu commentPdu; - static StopFreezePdu stopFreezePdu; - static ElectromagneticEmissionsPdu electromagneticEmissionsPdu; - static DesignatorPdu designatorPdu; - static TransmitterPdu transmitterPdu; - static SignalPdu signalPdu; - static ReceiverPdu receiverPdu; - static IntercomSignalPdu intercomSignalPdu; - static IntercomControlPdu intercomControlPdu; - static AggregateStatePdu aggregateStatePdu; - static IsGroupOfPdu isGroupOfPdu; - static TransferControlRequestPdu transferOwnershipPdu; +namespace dis { +Pdu* PduBank::GetStaticPDU(PDUType pdu_type) { + static EntityStatePdu entityStatePdu; + static FirePdu firePdu; + static DetonationPdu detonationPdu; + static CollisionPdu collisionPdu; + static ServiceRequestPdu ServiceRequestPdu; + static ResupplyOfferPdu resupplyOfferPdu; + static ResupplyReceivedPdu resupplyReceivedPdu; + static ResupplyCancelPdu resupplyCancelPdu; + static RepairCompletePdu repairCompletePdu; + static RepairResponsePdu repairResponsePdu; + static CreateEntityPdu createEntityPdu; + static RemoveEntityPdu removeEntityPdu; + static StartResumePdu startResumePdu; + static AcknowledgePdu acknowledgePdu; + static ActionRequestPdu actionRequestPdu; + static ActionResponsePdu actionResponsePdu; + static DataQueryPdu dataQueryPdu; + static SetDataPdu setDataPdu; + static EventReportPdu eventReportPdu; + static CommentPdu commentPdu; + static StopFreezePdu stopFreezePdu; + static ElectromagneticEmissionsPdu electromagneticEmissionsPdu; + static DesignatorPdu designatorPdu; + static TransmitterPdu transmitterPdu; + static SignalPdu signalPdu; + static ReceiverPdu receiverPdu; + static IntercomSignalPdu intercomSignalPdu; + static IntercomControlPdu intercomControlPdu; + static AggregateStatePdu aggregateStatePdu; + static IsGroupOfPdu isGroupOfPdu; + static TransferControlRequestPdu transferOwnershipPdu; - switch(pdu_type) - { - case PDU_ENTITY_STATE: return &entityStatePdu; break; - case PDU_FIRE: return &firePdu; break; - case PDU_DETONATION: return &detonationPdu; break; - case PDU_COLLISION: return &collisionPdu; break; - case PDU_SERVICE_REQUEST: return &ServiceRequestPdu; break; - case PDU_RESUPPLY_OFFER: return &resupplyOfferPdu; break; - case PDU_RESUPPLY_RECEIVED: return &resupplyReceivedPdu; break; - case PDU_RESUPPLY_CANCEL: return &resupplyCancelPdu; break; - case PDU_REPAIR_COMPLETE: return &repairCompletePdu; break; - case PDU_REPAIR_RESPONSE: return &repairResponsePdu; break; - case PDU_CREATE_ENTITY: return &createEntityPdu; break; - case PDU_REMOVE_ENTITY: return &removeEntityPdu; break; - case PDU_START_RESUME: return &startResumePdu; break; - case PDU_ACKNOWLEDGE: return &acknowledgePdu; break; - case PDU_ACTION_REQUEST: return &actionRequestPdu; break; - case PDU_ACTION_RESPONSE: return &actionResponsePdu; break; - case PDU_DATA_QUERY: return &dataQueryPdu; break; - case PDU_SET_DATA: return &setDataPdu; break; - case PDU_EVENT_REPORT: return &eventReportPdu; break; - case PDU_COMMENT: return &commentPdu; break; - case PDU_STOP_FREEZE: return &stopFreezePdu; break; - case PDU_ELECTRONIC_EMMISIONS: return &electromagneticEmissionsPdu; break; - case PDU_DESIGNATOR: return &designatorPdu; break; - case PDU_TRANSMITTER: return &transmitterPdu; break; - case PDU_SIGNAL: return &signalPdu; break; - case PDU_RECEIVER: return &receiverPdu; break; - case PDU_INTERCOM_SIGNAL: return &intercomSignalPdu; break; - case PDU_INTERCOM_CONTROL: return &intercomControlPdu; break; - case PDU_AGGREGATE_STATE: return &aggregateStatePdu; break; - case PDU_ISGROUPOF: return &isGroupOfPdu; break; - case PDU_TRANSFER_OWNERSHIP: return &transferOwnershipPdu; break; - default: break; - } - return NULL; + switch (pdu_type) { + case PDU_ENTITY_STATE: + return &entityStatePdu; + break; + case PDU_FIRE: + return &firePdu; + break; + case PDU_DETONATION: + return &detonationPdu; + break; + case PDU_COLLISION: + return &collisionPdu; + break; + case PDU_SERVICE_REQUEST: + return &ServiceRequestPdu; + break; + case PDU_RESUPPLY_OFFER: + return &resupplyOfferPdu; + break; + case PDU_RESUPPLY_RECEIVED: + return &resupplyReceivedPdu; + break; + case PDU_RESUPPLY_CANCEL: + return &resupplyCancelPdu; + break; + case PDU_REPAIR_COMPLETE: + return &repairCompletePdu; + break; + case PDU_REPAIR_RESPONSE: + return &repairResponsePdu; + break; + case PDU_CREATE_ENTITY: + return &createEntityPdu; + break; + case PDU_REMOVE_ENTITY: + return &removeEntityPdu; + break; + case PDU_START_RESUME: + return &startResumePdu; + break; + case PDU_ACKNOWLEDGE: + return &acknowledgePdu; + break; + case PDU_ACTION_REQUEST: + return &actionRequestPdu; + break; + case PDU_ACTION_RESPONSE: + return &actionResponsePdu; + break; + case PDU_DATA_QUERY: + return &dataQueryPdu; + break; + case PDU_SET_DATA: + return &setDataPdu; + break; + case PDU_EVENT_REPORT: + return &eventReportPdu; + break; + case PDU_COMMENT: + return &commentPdu; + break; + case PDU_STOP_FREEZE: + return &stopFreezePdu; + break; + case PDU_ELECTRONIC_EMMISIONS: + return &electromagneticEmissionsPdu; + break; + case PDU_DESIGNATOR: + return &designatorPdu; + break; + case PDU_TRANSMITTER: + return &transmitterPdu; + break; + case PDU_SIGNAL: + return &signalPdu; + break; + case PDU_RECEIVER: + return &receiverPdu; + break; + case PDU_INTERCOM_SIGNAL: + return &intercomSignalPdu; + break; + case PDU_INTERCOM_CONTROL: + return &intercomControlPdu; + break; + case PDU_AGGREGATE_STATE: + return &aggregateStatePdu; + break; + case PDU_ISGROUPOF: + return &isGroupOfPdu; + break; + case PDU_TRANSFER_OWNERSHIP: + return &transferOwnershipPdu; + break; + default: + break; + } + return NULL; } +} // namespace dis diff --git a/src/dis6/utils/PDUBank.h b/src/dis6/utils/PDUBank.h index fd207dcd..9cb73e2a 100644 --- a/src/dis6/utils/PDUBank.h +++ b/src/dis6/utils/PDUBank.h @@ -1,21 +1,18 @@ #pragma once -#include -#include - -namespace DIS -{ - /// houses instances for the set of known PDU classes to be returned - /// when provided with the PDU type's identifier value. - class OPENDIS6_EXPORT PduBank - { - public: - /// finds the PDU instance corresponding to the identifier - /// @param pdu_type the 8-bit PDU type identifier - /// @return NULL when the pdu_type is unknown. - ///\todo make this parameter just 'unsigned char' since that will be easier to generate. - static Pdu* GetStaticPDU( DIS::PDUType pdu_type ); - }; -} - +#include "dis6/common/Pdu.h" +#include "dis6/utils/PDUType.h" +namespace dis { +/// houses instances for the set of known PDU classes to be returned +/// when provided with the PDU type's identifier value. +class PduBank { + public: + /// finds the PDU instance corresponding to the identifier + /// @param pdu_type the 8-bit PDU type identifier + /// @return NULL when the pdu_type is unknown. + ///\todo make this parameter just 'uint8_t' since that will be easier to + /// generate. + static Pdu* GetStaticPDU(dis::PDUType pdu_type); +}; +} // namespace dis diff --git a/src/dis6/utils/PDUType.h b/src/dis6/utils/PDUType.h index 62ae440f..718b152e 100644 --- a/src/dis6/utils/PDUType.h +++ b/src/dis6/utils/PDUType.h @@ -1,60 +1,58 @@ #ifndef _dtdis_pdu_type_h_ #define _dtdis_pdu_type_h_ -namespace DIS -{ - enum PDUType - { - PDU_OTHER = 0, - PDU_ENTITY_STATE = 1, - PDU_FIRE = 2, - PDU_DETONATION = 3, - PDU_COLLISION = 4, - PDU_SERVICE_REQUEST = 5, - PDU_RESUPPLY_OFFER = 6, - PDU_RESUPPLY_RECEIVED = 7, - PDU_RESUPPLY_CANCEL = 8, - PDU_REPAIR_COMPLETE = 9, - PDU_REPAIR_RESPONSE = 10, - PDU_CREATE_ENTITY = 11, - PDU_REMOVE_ENTITY = 12, - PDU_START_RESUME = 13, - PDU_STOP_FREEZE = 14, - PDU_ACKNOWLEDGE = 15, - PDU_ACTION_REQUEST = 16, - PDU_ACTION_RESPONSE = 17, - PDU_DATA_QUERY = 18, - PDU_SET_DATA = 19, - PDU_DATA = 20, - PDU_EVENT_REPORT = 21, - PDU_COMMENT = 22, - PDU_ELECTRONIC_EMMISIONS = 23, - PDU_DESIGNATOR = 24, - PDU_TRANSMITTER = 25, - PDU_SIGNAL = 26, - PDU_RECEIVER = 27, - PDU_IFF = 28, - PDU_UNDERWATER_ACOUSTIC = 29, - PDU_SUPPLEMENTAL_EMISSION_ENTITY = 30, - PDU_INTERCOM_SIGNAL = 31, - PDU_INTERCOM_CONTROL = 32, - PDU_AGGREGATE_STATE = 33, - PDU_ISGROUPOF = 34, - PDU_TRANSFER_OWNERSHIP = 35, - PDU_ISPARTOF = 36, - PDU_MINEFIELD_STATE = 37, - PDU_MINEFIELD_QUERY = 38, - PDU_MINEFIELD_DATA = 39, - PDU_MINEFIELD_RESPONSE_NACK = 40, - PDU_ENVIRONMENTAL_PROCESS = 41, - PDU_GRIDDED_DATA = 42, - PDU_POINT_OBJECT_STATE = 43, - PDU_LINEAR_OBJECT_STATE = 44, - PDU_AREAL_OBJECT_STATE = 45, - PDU_TSPI = 46, - PDU_APPEARANCE = 47, - PDU_ARTICULATED_PARTS = 48 - }; +namespace dis { +enum PDUType { + kPduOther = 0, + kPduEntityState = 1, + kPduFire = 2, + kPduDetonation = 3, + kPduCollision = 4, + kPduServiceRequest = 5, + kPduResupplyOffer = 6, + kPduResupplyReceived = 7, + kPduResupplyCancel = 8, + kPduRepairComplete = 9, + kPduRepairResponse = 10, + kPduCreateEntity = 11, + kPduRemoveEntity = 12, + kPduStartResume = 13, + kPduStopFreeze = 14, + kPduAcknowledge = 15, + kPduActionRequest = 16, + kPduActionResponse = 17, + kPduDataQuery = 18, + kPduSetData = 19, + kPduData = 20, + kPduEventReport = 21, + kPduComment = 22, + kPduElectronicEmmisions = 23, + kPduDesignator = 24, + kPduTransmitter = 25, + kPduSignal = 26, + kPduReceiver = 27, + kPduIff = 28, + kPduUnderwaterAcoustic = 29, + kPduSupplementalEmissionEntity = 30, + kPduIntercomSignal = 31, + kPduIntercomControl = 32, + kPduAggregateState = 33, + kPduIsGroupOf = 34, + kPduTransferOwnership = 35, + kPduIsPartOf = 36, + kPduMinefieldState = 37, + kPduMinefieldQuery = 38, + kPduMinefieldData = 39, + kPduMinefieldResponseNack = 40, + kPduEnvironmentalProcess = 41, + kPduGriddedData = 42, + kPduPointObjectState = 43, + kPduLinearObjectState = 44, + kPduArealObjectState = 45, + kPduTspi = 46, + kPduAppearance = 47, + kPduArticulatedParts = 48 +}; } -#endif // _dtdis_pdu_type_h_ +#endif // _dtdis_pdu_type_h_ diff --git a/src/dis6/utils/PacketFactory.cpp b/src/dis6/utils/PacketFactory.cpp index 17637058..90f437b6 100644 --- a/src/dis6/utils/PacketFactory.cpp +++ b/src/dis6/utils/PacketFactory.cpp @@ -1,27 +1,22 @@ -#include -#include #include +#include +#include + using namespace DIS; -Pdu* PacketFactory::CreatePacket(unsigned char id) -{ - FunctionMap::iterator iter =_fMap.find( id ); - if( iter != _fMap.end() ) - { - return (iter->second)(); - } +Pdu* PacketFactory::CreatePacket(uint8_t id) { + FunctionMap::iterator iter = _fMap.find(id); + if (iter != _fMap.end()) { + return (iter->second)(); + } - return NULL; + return NULL; } -void PacketFactory::DestroyPacket(Pdu* pdu) -{ - delete pdu; -} +void PacketFactory::DestroyPacket(Pdu* pdu) { delete pdu; } -bool PacketFactory::IsRegistered(unsigned char id) const -{ - FunctionMap::const_iterator iter = _fMap.find(id); - return( iter != _fMap.end() ); +bool PacketFactory::IsRegistered(uint8_t id) const { + FunctionMap::const_iterator iter = _fMap.find(id); + return (iter != _fMap.end()); } diff --git a/src/dis6/utils/PacketFactory.h b/src/dis6/utils/PacketFactory.h index f41bf9bc..c2280769 100644 --- a/src/dis6/utils/PacketFactory.h +++ b/src/dis6/utils/PacketFactory.h @@ -4,68 +4,66 @@ #ifndef _dcl_dis_packet_factory_h_ #define _dcl_dis_packet_factory_h_ -#include // for member -#include // for library symbols +#include +#include // for member -namespace DIS -{ - class Pdu; +namespace dis { +class Pdu; - /// a utility to make functions - template - BaseT* CreateImplementation() - { - return new DerivedT(); - } - - /// responsible for mapping an ID value to a Pdu type. - class OPENDIS6_EXPORT PacketFactory - { - public: +/// a utility to make functions +template +BaseT* CreateImplementation() { + return new DerivedT(); +} - /// Create a Pdu. - /// @param id the value representing the "type" of the Pdu. The value will be stored in the 3rd position of the buffer, as defined by the DIS specification. - /// @return a dynamically allocated instance of a concrete Pdu. The value will be 'NULL' if no support for creating the concrete Pdu was registered. - Pdu* CreatePacket(unsigned char id); +/// responsible for mapping an ID value to a Pdu type. +class PacketFactory { + public: + /// Create a Pdu. + /// @param id the value representing the "type" of the Pdu. The value will be + /// stored in the 3rd position of the buffer, as defined by the DIS + /// specification. + /// @return a dynamically allocated instance of a concrete Pdu. The value + /// will be 'NULL' if no support for creating the concrete Pdu was registered. + Pdu* CreatePacket(uint8_t id); - /// Clean up the memory for the Pdu. - /// @param pdu The packet to be deleted. - void DestroyPacket(Pdu* pdu); + /// Clean up the memory for the Pdu. + /// @param pdu The packet to be deleted. + void DestroyPacket(Pdu* pdu); - /// Add support for creating the Pdu. - /// @param id The value identifying the type of the Pdu. - /// @return 'false' if a packet id was already registered for the Pdu type. 'true' if support was added. - template - bool RegisterPacket(unsigned char id) - { - FunctionMap::value_type candidate(id,&CreateImplementation); - std::pair result = _fMap.insert( candidate ); - return result.second; - } + /// Add support for creating the Pdu. + /// @param id The value identifying the type of the Pdu. + /// @return 'false' if a packet id was already registered for the Pdu type. + /// 'true' if support was added. + template + bool RegisterPacket(uint8_t id) { + FunctionMap::value_type candidate(id, &CreateImplementation); + std::pair result = f_map_.insert(candidate); + return result.second; + } - /// Remove support for creating the Pdu. - /// @param id The value identifying the type of the Pdu. - /// @return 'false' if no support previously existed. 'true' if support was removed. - bool UnRegisterPacket(char id) - { - return( _fMap.erase( id )>0 ); - } + /// Remove support for creating the Pdu. + /// @param id The value identifying the type of the Pdu. + /// @return 'false' if no support previously existed. 'true' if support was + /// removed. + bool UnRegisterPacket(char id) { return (f_map_.erase(id) > 0); } - /// Check to know if the Pdu type is supported. - /// @param id The value representing the Pdu type. - /// @return 'true' if support for creating a Pdu was found, 'false' if not found. - bool IsRegistered(unsigned char id) const; + /// Check to know if the Pdu type is supported. + /// @param id The value representing the Pdu type. + /// @return 'true' if support for creating a Pdu was found, 'false' if not + /// found. + [[nodiscard]] bool IsRegistered(uint8_t id) const; - private: - /// the function signature required for creating Pdu instances. - typedef Pdu* (*CREATE_FUNC)(); + private: + /// the function signature required for creating Pdu instances. + using CREATE_FUNC = Pdu* (*)(); - /// the type to contain mappings to functions used to create Pdu instances. - typedef std::map FunctionMap; + /// the type to contain mappings to functions used to create Pdu instances. + using FunctionMap = std::map; - /// instance of the storage mechanism for creating Pdu instances. - FunctionMap _fMap; - }; -} + /// instance of the storage mechanism for creating Pdu instances. + FunctionMap f_map_; +}; +} // namespace dis -#endif // _dcl_dis_packet_factory_h_ +#endif // _dcl_dis_packet_factory_h_ diff --git a/src/dis6/utils/PduFactory.cpp b/src/dis6/utils/PduFactory.cpp index 84d330f8..e217595f 100644 --- a/src/dis6/utils/PduFactory.cpp +++ b/src/dis6/utils/PduFactory.cpp @@ -1,35 +1,30 @@ #include "PduFactory.h" + +#include + +#include +#include +#include #include #include -#include -#include -#include +#include #include +#include +#include #include #include -#include -#include -#include -#include #include +#include #include #include -#include - using namespace DIS; -PduFactory::PduFactory(void) -{ -} - -PduFactory::~PduFactory(void) -{ -} +PduFactory::PduFactory() = default; /** * Converts data read from the wire--a byte array--to a DIS PDU language - * object. A new PDU is created for every data buffer. The consumer of this + * object. A new PDU is created for every data buffer. The consumer of this * object is responsible for freeing it. The PDUs can be up to MTU in size; * in some fairly rare instances, mostly involving multiple PDUs in a single * datagram packet, PDUs may be larger than this and this will fail horribly. @@ -37,89 +32,87 @@ PduFactory::~PduFactory(void) * returns NULL. The caller should check for this. */ -Pdu * PduFactory::createPdu(const char* data) -{ - int dataLength = 1500; // MTU, might fail for some very large PDUs - int pduType = data[2]; - - //std::cout << "Decoding PDU of type " << (int)pduType << std::endl; - - DataStream dataStream(data, dataLength, DIS::BIG); - - Pdu* pdu = NULL; - - switch(pduType) - { - case PDU_ENTITY_STATE: - pdu = new EntityStatePdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_FIRE: - pdu = new FirePdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_DETONATION: - pdu = new DetonationPdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_SET_DATA: - pdu = new SetDataPdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_CREATE_ENTITY: - pdu = new CreateEntityPdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_REMOVE_ENTITY: - pdu = new RemoveEntityPdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_START_RESUME: - pdu = new StartResumePdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_STOP_FREEZE: - pdu = new StopFreezePdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_ELECTRONIC_EMMISIONS: - pdu = new ElectromagneticEmissionsPdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_TRANSMITTER: - pdu = new TransmitterPdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_SIGNAL: - pdu = new SignalPdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_RECEIVER: - pdu = new ReceiverPdu(); - pdu->unmarshal(dataStream); - break; - - case PDU_TRANSFER_OWNERSHIP: - pdu = new TransferControlRequestPdu(); - pdu->unmarshal(dataStream); - break; - - default: - std::cout << "Received Unrecognized PDU of type " << (int)pduType << " change PduFactory.cpp to add new PDUs" << std::endl; - break; - } - - return pdu; - +Pdu* PduFactory::CreatePdu(const char* data) { + int const data_length = 1500; // MTU, might fail for some very large PDUs + int const pdu_type = data[2]; + + // std::cout << "Decoding PDU of type " << (int)pduType << std::endl; + + DataStream data_stream(data, dataLength, DIS::BIG); + + Pdu* pdu = NULL; + + switch (pdu_type) { + case PDU_ENTITY_STATE: + pdu = new EntityStatePdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_FIRE: + pdu = new FirePdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_DETONATION: + pdu = new DetonationPdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_SET_DATA: + pdu = new SetDataPdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_CREATE_ENTITY: + pdu = new CreateEntityPdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_REMOVE_ENTITY: + pdu = new RemoveEntityPdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_START_RESUME: + pdu = new StartResumePdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_STOP_FREEZE: + pdu = new StopFreezePdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_ELECTRONIC_EMMISIONS: + pdu = new ElectromagneticEmissionsPdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_TRANSMITTER: + pdu = new TransmitterPdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_SIGNAL: + pdu = new SignalPdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_RECEIVER: + pdu = new ReceiverPdu(); + pdu->unmarshal(dataStream); + break; + + case PDU_TRANSFER_OWNERSHIP: + pdu = new TransferControlRequestPdu(); + pdu->unmarshal(dataStream); + break; + + default: + std::cout << "Received Unrecognized PDU of type " << pdu_type + << " change PduFactory.cpp to add new PDUs" << std::endl; + break; + } + + return pdu; } diff --git a/src/dis6/utils/PduFactory.h b/src/dis6/utils/PduFactory.h index 0326d6dc..d6ce6947 100644 --- a/src/dis6/utils/PduFactory.h +++ b/src/dis6/utils/PduFactory.h @@ -1,29 +1,27 @@ #pragma once -#include // for library symbols #include +#include // for library symbols -namespace DIS -{ - /** - * PduFactory turns byte buffers in IEEE-1278.1 (DIS) format into - * C++ language objects. For example, if you read a datagram packet - * and extract a payload, and that payload is in DIS format, you can - * hand it off to this class and get back an EntityStatePdu, FirePdu, - * or whatever.

- * - * @author DMcG - */ +namespace DIS { +/** + * PduFactory turns byte buffers in IEEE-1278.1 (DIS) format into + * C++ language objects. For example, if you read a datagram packet + * and extract a payload, and that payload is in DIS format, you can + * hand it off to this class and get back an EntityStatePdu, FirePdu, + * or whatever.

+ * + * @author DMcG + */ -class OPENDIS6_EXPORT PduFactory -{ -public: - PduFactory(void); - ~PduFactory(void); +class PduFactory { + public: + PduFactory(void); + ~PduFactory(void) = default; - /** Returns a PDU of the appropriate concrete subclass. Returns NULL - * for failures or unrecognized PDU types. - */ - Pdu* createPdu(const char * data); + /** Returns a PDU of the appropriate concrete subclass. Returns NULL + * for failures or unrecognized PDU types. + */ + Pdu* createPdu(const char* data); }; -} +} // namespace DIS diff --git a/src/dis6/utils/StreamUtils.cpp b/src/dis6/utils/StreamUtils.cpp index 51aa38ff..24b22659 100644 --- a/src/dis6/utils/StreamUtils.cpp +++ b/src/dis6/utils/StreamUtils.cpp @@ -1,36 +1,27 @@ -#include - -#include -#include #include +#include +#include +#include -std::ostream& operator <<(std::ostream& lhs, const DIS::EntityType& rhs) -{ - lhs << "EntityType (" - << (unsigned int)rhs.getEntityKind() - << "," << (unsigned int)rhs.getDomain() - << "," << (unsigned int)rhs.getCountry() - << "," << (unsigned int)rhs.getCategory() - << "," << (unsigned int)rhs.getSubcategory() - << ") "; - return lhs; +std::ostream& operator<<(std::ostream& lhs, const DIS::EntityType& rhs) { + lhs << "EntityType (" << (uint32_t)rhs.getEntityKind() << "," + << (uint32_t)rhs.getDomain() << "," << (uint32_t)rhs.getCountry() + << "," << (uint32_t)rhs.getCategory() << "," + << (uint32_t)rhs.getSubcategory() << ") "; + return lhs; } -std::ostream& operator <<(std::ostream& lhs, const DIS::EntityID& rhs) -{ - lhs << "EntityID (" - << (unsigned int)rhs.getEntity() << ") "; - return lhs; +std::ostream& operator<<(std::ostream& lhs, const DIS::EntityID& rhs) { + lhs << "EntityID (" << (uint32_t)rhs.getEntity() << ") "; + return lhs; } -std::ostream& operator <<(std::ostream& lhs, const DIS::EntityStatePdu& rhs) -{ - lhs << "EntityStatePdu (" << rhs.getEntityID() << ") "; - return lhs; +std::ostream& operator<<(std::ostream& lhs, const DIS::EntityStatePdu& rhs) { + lhs << "EntityStatePdu (" << rhs.getEntityID() << ") "; + return lhs; } -std::ostream& operator <<(std::ostream& lhs, const DIS::DetonationPdu& rhs) -{ - lhs << "DetonationPDU (" << rhs.getFiringEntityID() << ") "; - return lhs; +std::ostream& operator<<(std::ostream& lhs, const DIS::DetonationPdu& rhs) { + lhs << "DetonationPDU (" << rhs.getFiringEntityID() << ") "; + return lhs; } diff --git a/src/dis6/utils/StreamUtils.h b/src/dis6/utils/StreamUtils.h index 53d2bc57..f72eb6e5 100644 --- a/src/dis6/utils/StreamUtils.h +++ b/src/dis6/utils/StreamUtils.h @@ -5,20 +5,18 @@ #ifndef _dis_stream_utils_h_ #define _dis_stream_utils_h_ -#include // for parameter type -#include // for library symbols +#include // for parameter type -namespace DIS -{ - class EntityStatePdu; - class EntityID; - class DetonationPdu; - class EntityType; -} +namespace dis { +class EntityStatePdu; +class EntityID; +class DetonationPdu; +class EntityType; +} // namespace dis -OPENDIS6_EXPORT std::ostream& operator <<(std::ostream& lhs, const DIS::EntityType& rhs); -OPENDIS6_EXPORT std::ostream& operator <<(std::ostream& lhs, const DIS::EntityID& rhs); -OPENDIS6_EXPORT std::ostream& operator <<(std::ostream& lhs, const DIS::EntityStatePdu& rhs); -OPENDIS6_EXPORT std::ostream& operator <<(std::ostream& lhs, const DIS::DetonationPdu& rhs); +std::ostream& operator<<(std::ostream& lhs, const dis::EntityType& rhs); +std::ostream& operator<<(std::ostream& lhs, const dis::EntityID& rhs); +std::ostream& operator<<(std::ostream& lhs, const dis::EntityStatePdu& rhs); +std::ostream& operator<<(std::ostream& lhs, const dis::DetonationPdu& rhs); -#endif // _dis_stream_utils_h_ +#endif // _dis_stream_utils_h_ diff --git a/src/dis6/warfare/BurstDescriptor.cpp b/src/dis6/warfare/BurstDescriptor.cpp new file mode 100644 index 00000000..09f9ee74 --- /dev/null +++ b/src/dis6/warfare/BurstDescriptor.cpp @@ -0,0 +1,112 @@ +#include "dis6/warfare/BurstDescriptor.h" + +using namespace DIS; + +BurstDescriptor::BurstDescriptor() + : _warhead(0), _fuse(0), _quantity(0), _rate(0) {} + +BurstDescriptor::~BurstDescriptor() = default; + +dis::EntityType& BurstDescriptor::getMunition() { return _munition; } + +const dis::EntityType& BurstDescriptor::getMunition() const { + return _munition; +} + +void BurstDescriptor::setMunition(const dis::EntityType& pX) { _munition = pX; } + +uint16_t BurstDescriptor::getWarhead() const { return _warhead; } + +void BurstDescriptor::setWarhead(uint16_t pX) { _warhead = pX; } + +uint16_t BurstDescriptor::getFuse() const { return _fuse; } + +void BurstDescriptor::setFuse(uint16_t pX) { _fuse = pX; } + +uint16_t BurstDescriptor::getQuantity() const { return _quantity; } + +void BurstDescriptor::setQuantity(uint16_t pX) { _quantity = pX; } + +uint16_t BurstDescriptor::getRate() const { return _rate; } + +void BurstDescriptor::setRate(uint16_t pX) { _rate = pX; } + +void BurstDescriptor::Marshal(DataStream& dataStream) const { + _munition.Marshal(dataStream); + dataStream << _warhead; + dataStream << _fuse; + dataStream << _quantity; + dataStream << _rate; +} + +void BurstDescriptor::Unmarshal(DataStream& dataStream) { + _munition.Unmarshal(dataStream); + dataStream >> _warhead; + dataStream >> _fuse; + dataStream >> _quantity; + dataStream >> _rate; +} + +bool BurstDescriptor::operator==(const BurstDescriptor& rhs) const { + bool ivars_equal = true; + + if (!(_munition == rhs._munition)) { + ivars_equal = false; + } + if (!(_warhead == rhs._warhead)) { + ivars_equal = false; + } + if (!(_fuse == rhs._fuse)) { + ivars_equal = false; + } + if (!(_quantity == rhs._quantity)) { + ivars_equal = false; + } + if (!(_rate == rhs._rate)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int BurstDescriptor::getMarshalledSize() const { + int marshal_size = 0; + + marshal_size = marshal_size + _munition.GetMarshalledSize(); // _munition + marshal_size = marshal_size + 2; // _warhead + marshal_size = marshal_size + 2; // _fuse + marshal_size = marshal_size + 2; // _quantity + marshal_size = marshal_size + 2; // _rate + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/warfare/BurstDescriptor.h b/src/dis6/warfare/BurstDescriptor.h new file mode 100644 index 00000000..b48c4fac --- /dev/null +++ b/src/dis6/warfare/BurstDescriptor.h @@ -0,0 +1,91 @@ +#pragma once + +#include "dis6/common/EntityType.h" +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.2.7. Specifies the type of muntion fired, the type of warhead, the +// type of fuse, the number of rounds fired, and the rate at which the roudns +// are fired in rounds per minute. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class BurstDescriptor { + protected: + /** What munition was used in the burst */ + dis::EntityType _munition; + + /** type of warhead */ + uint16_t _warhead; + + /** type of fuse used */ + uint16_t _fuse; + + /** how many of the munition were fired */ + uint16_t _quantity; + + /** rate at which the munition was fired */ + uint16_t _rate; + + public: + BurstDescriptor(); + virtual ~BurstDescriptor(); + + virtual void marshal(dis::DataStream& dataStream) const; + virtual void unmarshal(dis::DataStream& dataStream); + + dis::EntityType& getMunition(); + const dis::EntityType& getMunition() const; + void setMunition(const dis::EntityType& pX); + + uint16_t getWarhead() const; + void setWarhead(uint16_t pX); + + uint16_t getFuse() const; + void setFuse(uint16_t pX); + + uint16_t getQuantity() const; + void setQuantity(uint16_t pX); + + uint16_t getRate() const; + void setRate(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const BurstDescriptor& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/warfare/CMakeLists.txt b/src/dis6/warfare/CMakeLists.txt new file mode 100644 index 00000000..1347b9cf --- /dev/null +++ b/src/dis6/warfare/CMakeLists.txt @@ -0,0 +1,25 @@ +set(warfare_hdr + BurstDescriptor.h + DetonationPdu.h + FirePdu.h + WarfareFamilyPdu.h +) + +set(warfare_src + BurstDescriptor.cpp + DetonationPdu.cpp + FirePdu.cpp + WarfareFamilyPdu.cpp +) + +list(TRANSFORM warfare_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") + +include(GenerateExportHeader) +generate_export_header(OpenDIS6) +list(APPEND warfare_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis6_export.h") + +target_sources(OpenDIS6 PRIVATE ${warfare_src}) + +install(FILES ${warfare_hdr} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis6/warfare +) diff --git a/src/dis6/warfare/DetonationPdu.cpp b/src/dis6/warfare/DetonationPdu.cpp new file mode 100644 index 00000000..10675a01 --- /dev/null +++ b/src/dis6/warfare/DetonationPdu.cpp @@ -0,0 +1,235 @@ +#include "dis6/warfare/DetonationPdu.h" + +using namespace DIS; + +DetonationPdu::DetonationPdu() + : WarfareFamilyPdu(), + _munitionID(), + _eventID(), + _velocity(), + _locationInWorldCoordinates(), + _burstDescriptor(), + _locationInEntityCoordinates(), + _detonationResult(0), + _numberOfArticulationParameters(0), + _pad(0) { + setPduType(3); +} + +DetonationPdu::~DetonationPdu() { _articulationParameters.clear(); } + +EntityID& DetonationPdu::GetMunitionId() { return _munitionID; } + +const EntityID& DetonationPdu::GetMunitionId() const { return _munitionID; } + +void DetonationPdu::SetMunitionId(const EntityID& pX) { _munitionID = pX; } + +EventID& DetonationPdu::GetEventId() { return _eventID; } + +const EventID& DetonationPdu::GetEventId() const { return _eventID; } + +void DetonationPdu::SetEventId(const EventID& pX) { _eventID = pX; } + +Vector3Float& DetonationPdu::GetVelocity() { return _velocity; } + +const Vector3Float& DetonationPdu::GetVelocity() const { return _velocity; } + +void DetonationPdu::SetVelocity(const Vector3Float& pX) { _velocity = pX; } + +Vector3Double& DetonationPdu::GetLocationInWorldCoordinates() { + return _locationInWorldCoordinates; +} + +const Vector3Double& DetonationPdu::GetLocationInWorldCoordinates() const { + return _locationInWorldCoordinates; +} + +void DetonationPdu::SetLocationInWorldCoordinates(const Vector3Double& pX) { + _locationInWorldCoordinates = pX; +} + +BurstDescriptor& DetonationPdu::GetBurstDescriptor() { + return _burstDescriptor; +} + +const BurstDescriptor& DetonationPdu::GetBurstDescriptor() const { + return _burstDescriptor; +} + +void DetonationPdu::SetBurstDescriptor(const BurstDescriptor& pX) { + _burstDescriptor = pX; +} + +Vector3Float& DetonationPdu::GetLocationInEntityCoordinates() { + return _locationInEntityCoordinates; +} + +const Vector3Float& DetonationPdu::GetLocationInEntityCoordinates() const { + return _locationInEntityCoordinates; +} + +void DetonationPdu::SetLocationInEntityCoordinates(const Vector3Float& pX) { + _locationInEntityCoordinates = pX; +} + +uint8_t DetonationPdu::getDetonationResult() const { return _detonationResult; } + +void DetonationPdu::setDetonationResult(uint8_t pX) { _detonationResult = pX; } + +uint8_t DetonationPdu::getNumberOfArticulationParameters() const { + return _articulationParameters.size(); +} + +int16_t DetonationPdu::getPad() const { return _pad; } + +void DetonationPdu::setPad(int16_t pX) { _pad = pX; } + +std::vector& DetonationPdu::GetArticulationParameters() { + return _articulationParameters; +} + +const std::vector& +DetonationPdu::GetArticulationParameters() const { + return _articulationParameters; +} + +void DetonationPdu::SetArticulationParameters( + const std::vector& pX) { + _articulationParameters = pX; +} + +void DetonationPdu::Marshal(DataStream& dataStream) const { + WarfareFamilyPdu::marshal( + data_stream); // Marshal information in superclass first + _munitionID.marshal(dataStream); + _eventID.marshal(dataStream); + _velocity.marshal(dataStream); + _locationInWorldCoordinates.marshal(dataStream); + _burstDescriptor.marshal(dataStream); + _locationInEntityCoordinates.marshal(dataStream); + dataStream << _detonationResult; + dataStream << (uint8_t)_articulationParameters.size(); + dataStream << _pad; + + for (size_t idx = 0; idx < _articulationParameters.size(); idx++) { + ArticulationParameter x = _articulationParameters[idx]; + x.marshal(dataStream); + } +} + +void DetonationPdu::Unmarshal(DataStream& dataStream) { + WarfareFamilyPdu::unmarshal( + data_stream); // unmarshal information in superclass first + _munitionID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + _velocity.unmarshal(dataStream); + _locationInWorldCoordinates.unmarshal(dataStream); + _burstDescriptor.unmarshal(dataStream); + _locationInEntityCoordinates.unmarshal(dataStream); + dataStream >> _detonationResult; + dataStream >> _numberOfArticulationParameters; + dataStream >> _pad; + + _articulationParameters.clear(); + for (size_t idx = 0; idx < _numberOfArticulationParameters; idx++) { + ArticulationParameter x; + x.unmarshal(dataStream); + _articulationParameters.push_back(x); + } +} + +bool DetonationPdu::operator==(const DetonationPdu& rhs) const { + bool ivars_equal = true; + + ivarsEqual = WarfareFamilyPdu::operator==(rhs); + + if (!(_munitionID == rhs._munitionID)) { + ivars_equal = false; + } + if (!(_eventID == rhs._eventID)) { + ivars_equal = false; + } + if (!(_velocity == rhs._velocity)) { + ivars_equal = false; + } + if (!(_locationInWorldCoordinates == rhs._locationInWorldCoordinates)) { + ivars_equal = false; + } + if (!(_burstDescriptor == rhs._burstDescriptor)) { + ivars_equal = false; + } + if (!(_locationInEntityCoordinates == rhs._locationInEntityCoordinates)) { + ivars_equal = false; + } + if (!(_detonationResult == rhs._detonationResult)) { + ivars_equal = false; + } + if (!(_pad == rhs._pad)) { + ivars_equal = false; + } + + for (size_t idx = 0; idx < _articulationParameters.size(); idx++) { + if (!(_articulationParameters[idx] == rhs._articulationParameters[idx])) + ivarsEqual = false; + } + + return ivars_equal; +} + +int DetonationPdu::getMarshalledSize() const { + int marshal_size = 0; + + marshalSize = WarfareFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _munitionID.getMarshalledSize(); // _munitionID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity + marshalSize = + marshalSize + _locationInWorldCoordinates + .getMarshalledSize(); // _locationInWorldCoordinates + marshalSize = + marshalSize + _burstDescriptor.getMarshalledSize(); // _burstDescriptor + marshalSize = + marshalSize + _locationInEntityCoordinates + .getMarshalledSize(); // _locationInEntityCoordinates + marshal_size = marshal_size + 1; // _detonationResult + marshal_size = marshal_size + 1; // _numberOfArticulationParameters + marshal_size = marshal_size + 2; // _pad + + for (uint64_t idx = 0; idx < _articulationParameters.size(); idx++) { + ArticulationParameter listElement = _articulationParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshal_size; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/warfare/DetonationPdu.h b/src/dis6/warfare/DetonationPdu.h new file mode 100644 index 00000000..6c2261e7 --- /dev/null +++ b/src/dis6/warfare/DetonationPdu.h @@ -0,0 +1,133 @@ +#pragma once + +#include + +#include "dis6/ArticulationParameter.h" +#include "dis6/BurstDescriptor.h" +#include "dis6/EntityID.h" +#include "dis6/EventID.h" +#include "dis6/Vector3Double.h" +#include "dis6/Vector3Float.h" +#include "dis6/WarfareFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Section 5.3.4.2. Information about stuff exploding. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class DetonationPdu : public WarfareFamilyPdu { + protected: + /** ID of muntion that was fired */ + EntityID _munitionID; + + /** ID firing event */ + EventID _eventID; + + /** ID firing event */ + Vector3Float _velocity; + + /** where the detonation is, in world coordinates */ + Vector3Double _locationInWorldCoordinates; + + /** Describes munition used */ + BurstDescriptor _burstDescriptor; + + /** location of the detonation or impact in the target entity's coordinate + * system. This information should be used for damage assessment. */ + Vector3Float _locationInEntityCoordinates; + + /** result of the explosion */ + uint8_t _detonationResult; + + /** How many articulation parameters we have */ + uint8_t _numberOfArticulationParameters; + + /** padding */ + int16_t _pad; + + std::vector _articulationParameters; + + public: + DetonationPdu(); + virtual ~DetonationPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getMunitionID(); + const EntityID& getMunitionID() const; + void setMunitionID(const EntityID& pX); + + EventID& getEventID(); + const EventID& getEventID() const; + void setEventID(const EventID& pX); + + Vector3Float& getVelocity(); + const Vector3Float& getVelocity() const; + void setVelocity(const Vector3Float& pX); + + Vector3Double& getLocationInWorldCoordinates(); + const Vector3Double& getLocationInWorldCoordinates() const; + void setLocationInWorldCoordinates(const Vector3Double& pX); + + BurstDescriptor& getBurstDescriptor(); + const BurstDescriptor& getBurstDescriptor() const; + void setBurstDescriptor(const BurstDescriptor& pX); + + Vector3Float& getLocationInEntityCoordinates(); + const Vector3Float& getLocationInEntityCoordinates() const; + void setLocationInEntityCoordinates(const Vector3Float& pX); + + uint8_t getDetonationResult() const; + void setDetonationResult(uint8_t pX); + + uint8_t getNumberOfArticulationParameters() const; + + int16_t getPad() const; + void setPad(int16_t pX); + + std::vector& getArticulationParameters(); + const std::vector& getArticulationParameters() const; + void setArticulationParameters(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DetonationPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/warfare/FirePdu.cpp b/src/dis6/warfare/FirePdu.cpp new file mode 100644 index 00000000..86ebab9a --- /dev/null +++ b/src/dis6/warfare/FirePdu.cpp @@ -0,0 +1,154 @@ +#include "dis6/FirePdu.h" + +using namespace DIS; + +FirePdu::FirePdu() + : WarfareFamilyPdu(), + _munitionID(), + _eventID(), + _fireMissionIndex(0), + _locationInWorldCoordinates(), + _burstDescriptor(), + _velocity(), + _range(0.0) { + setPduType(2); +} + +FirePdu::~FirePdu() {} + +EntityID& FirePdu::getMunitionID() { return _munitionID; } + +const EntityID& FirePdu::getMunitionID() const { return _munitionID; } + +void FirePdu::setMunitionID(const EntityID& pX) { _munitionID = pX; } + +EventID& FirePdu::getEventID() { return _eventID; } + +const EventID& FirePdu::getEventID() const { return _eventID; } + +void FirePdu::setEventID(const EventID& pX) { _eventID = pX; } + +int FirePdu::getFireMissionIndex() const { return _fireMissionIndex; } + +void FirePdu::setFireMissionIndex(int pX) { _fireMissionIndex = pX; } + +Vector3Double& FirePdu::getLocationInWorldCoordinates() { + return _locationInWorldCoordinates; +} + +const Vector3Double& FirePdu::getLocationInWorldCoordinates() const { + return _locationInWorldCoordinates; +} + +void FirePdu::setLocationInWorldCoordinates(const Vector3Double& pX) { + _locationInWorldCoordinates = pX; +} + +BurstDescriptor& FirePdu::getBurstDescriptor() { return _burstDescriptor; } + +const BurstDescriptor& FirePdu::getBurstDescriptor() const { + return _burstDescriptor; +} + +void FirePdu::setBurstDescriptor(const BurstDescriptor& pX) { + _burstDescriptor = pX; +} + +Vector3Float& FirePdu::getVelocity() { return _velocity; } + +const Vector3Float& FirePdu::getVelocity() const { return _velocity; } + +void FirePdu::setVelocity(const Vector3Float& pX) { _velocity = pX; } + +float FirePdu::getRange() const { return _range; } + +void FirePdu::setRange(float pX) { _range = pX; } + +void FirePdu::marshal(DataStream& dataStream) const { + WarfareFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _munitionID.marshal(dataStream); + _eventID.marshal(dataStream); + dataStream << _fireMissionIndex; + _locationInWorldCoordinates.marshal(dataStream); + _burstDescriptor.marshal(dataStream); + _velocity.marshal(dataStream); + dataStream << _range; +} + +void FirePdu::unmarshal(DataStream& dataStream) { + WarfareFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _munitionID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + dataStream >> _fireMissionIndex; + _locationInWorldCoordinates.unmarshal(dataStream); + _burstDescriptor.unmarshal(dataStream); + _velocity.unmarshal(dataStream); + dataStream >> _range; +} + +bool FirePdu::operator==(const FirePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = WarfareFamilyPdu::operator==(rhs); + + if (!(_munitionID == rhs._munitionID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_fireMissionIndex == rhs._fireMissionIndex)) ivarsEqual = false; + if (!(_locationInWorldCoordinates == rhs._locationInWorldCoordinates)) + ivarsEqual = false; + if (!(_burstDescriptor == rhs._burstDescriptor)) ivarsEqual = false; + if (!(_velocity == rhs._velocity)) ivarsEqual = false; + if (!(_range == rhs._range)) ivarsEqual = false; + + return ivarsEqual; +} + +int FirePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = WarfareFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _munitionID.getMarshalledSize(); // _munitionID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + 4; // _fireMissionIndex + marshalSize = + marshalSize + _locationInWorldCoordinates + .getMarshalledSize(); // _locationInWorldCoordinates + marshalSize = + marshalSize + _burstDescriptor.getMarshalledSize(); // _burstDescriptor + marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity + marshalSize = marshalSize + 4; // _range + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/warfare/FirePdu.h b/src/dis6/warfare/FirePdu.h new file mode 100644 index 00000000..de015692 --- /dev/null +++ b/src/dis6/warfare/FirePdu.h @@ -0,0 +1,110 @@ +#pragma once + +#include "dis6/BurstDescriptor.h" +#include "dis6/EntityID.h" +#include "dis6/EventID.h" +#include "dis6/Vector3Double.h" +#include "dis6/Vector3Float.h" +#include "dis6/WarfareFamilyPdu.h" + +#include "dis6/utils/DataStream.h" + +namespace DIS { +// Sectioin 5.3.4.1. Information about someone firing something. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class FirePdu : public WarfareFamilyPdu { + protected: + /** ID of the munition that is being shot */ + EntityID _munitionID; + + /** ID of event */ + EventID _eventID; + + int _fireMissionIndex; + + /** location of the firing event */ + Vector3Double _locationInWorldCoordinates; + + /** Describes munitions used in the firing event */ + BurstDescriptor _burstDescriptor; + + /** Velocity of the ammunition */ + Vector3Float _velocity; + + /** range to the target */ + float _range; + + public: + FirePdu(); + virtual ~FirePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getMunitionID(); + const EntityID& getMunitionID() const; + void setMunitionID(const EntityID& pX); + + EventID& getEventID(); + const EventID& getEventID() const; + void setEventID(const EventID& pX); + + int getFireMissionIndex() const; + void setFireMissionIndex(int pX); + + Vector3Double& getLocationInWorldCoordinates(); + const Vector3Double& getLocationInWorldCoordinates() const; + void setLocationInWorldCoordinates(const Vector3Double& pX); + + BurstDescriptor& getBurstDescriptor(); + const BurstDescriptor& getBurstDescriptor() const; + void setBurstDescriptor(const BurstDescriptor& pX); + + Vector3Float& getVelocity(); + const Vector3Float& getVelocity() const; + void setVelocity(const Vector3Float& pX); + + float getRange() const; + void setRange(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FirePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/warfare/WarfareFamilyPdu.cpp b/src/dis6/warfare/WarfareFamilyPdu.cpp new file mode 100644 index 00000000..26e228d1 --- /dev/null +++ b/src/dis6/warfare/WarfareFamilyPdu.cpp @@ -0,0 +1,96 @@ +#include "dis6/warfare/WarfareFamilyPdu.h" + +namespace dis { +WarfareFamilyPdu::WarfareFamilyPdu() { SetProtocolFamily(2); } + +WarfareFamilyPdu::~WarfareFamilyPdu() = default; + +EntityID& WarfareFamilyPdu::getFiringEntityID() { return _firingEntityID; } + +const EntityID& WarfareFamilyPdu::getFiringEntityID() const { + return _firingEntityID; +} + +void WarfareFamilyPdu::setFiringEntityID(const EntityID& pX) { + _firingEntityID = pX; +} + +EntityID& WarfareFamilyPdu::getTargetEntityID() { return _targetEntityID; } + +const EntityID& WarfareFamilyPdu::getTargetEntityID() const { + return _targetEntityID; +} + +void WarfareFamilyPdu::setTargetEntityID(const EntityID& pX) { + _targetEntityID = pX; +} + +void WarfareFamilyPdu::Marshal(DataStream& dataStream) const { + Pdu::marshal(data_stream); // Marshal information in superclass first + _firingEntityID.Marshal(dataStream); + _targetEntityID.Marshal(dataStream); +} + +void WarfareFamilyPdu::Unmarshal(DataStream& dataStream) { + Pdu::unmarshal(data_stream); // unmarshal information in superclass first + _firingEntityID.Unmarshal(dataStream); + _targetEntityID.Unmarshal(dataStream); +} + +bool WarfareFamilyPdu::operator==(const WarfareFamilyPdu& rhs) const { + bool ivars_equal = true; + + ivars_equal = Pdu::operator==(rhs); + + if (!(_firingEntityID == rhs._firingEntityID)) { + ivars_equal = false; + } + if (!(_targetEntityID == rhs._targetEntityID)) { + ivars_equal = false; + } + + return ivars_equal; +} + +int WarfareFamilyPdu::GetMarshalledSize() const { + int marshal_size = 0; + + marshal_size = getMarshalledSize(); + marshal_size = + marshal_size + _firingEntityID.GetMarshalledSize(); // _firingEntityID + marshal_size = + marshal_size + _targetEntityID.GetMarshalledSize(); // _targetEntityID + return marshal_size; +} + +} // namespace dis +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis6/warfare/WarfareFamilyPdu.h b/src/dis6/warfare/WarfareFamilyPdu.h new file mode 100644 index 00000000..2ceef55e --- /dev/null +++ b/src/dis6/warfare/WarfareFamilyPdu.h @@ -0,0 +1,74 @@ +#pragma once + +#include "dis6/common/EntityID.h" +#include "dis6/common/Pdu.h" +#include "dis6/utils/DataStream.h" + +namespace dis { +// Section 5.3.4. abstract superclass for fire and detonation pdus that have +// shared information. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class WarfareFamilyPdu : public Pdu { + protected: + /** ID of the entity that shot */ + EntityID _firingEntityID; + + /** ID of the entity that is being shot at */ + EntityID _targetEntityID; + + public: + WarfareFamilyPdu(); + virtual ~WarfareFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getFiringEntityID(); + const EntityID& getFiringEntityID() const; + void setFiringEntityID(const EntityID& pX); + + EntityID& getTargetEntityID(); + const EntityID& getTargetEntityID() const; + void setTargetEntityID(const EntityID& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const WarfareFamilyPdu& rhs) const; +}; +} // namespace dis + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AcknowledgePdu.cpp b/src/dis7/AcknowledgePdu.cpp deleted file mode 100644 index cb4de52b..00000000 --- a/src/dis7/AcknowledgePdu.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include - -using namespace DIS; - - -AcknowledgePdu::AcknowledgePdu() : SimulationManagementFamilyPdu(), - _originatingID(), - _receivingID(), - _acknowledgeFlag(0), - _responseFlag(0), - _requestID(0) -{ - setPduType( 15 ); -} - -AcknowledgePdu::~AcknowledgePdu() -{ -} - -EntityID& AcknowledgePdu::getOriginatingID() -{ - return _originatingID; -} - -const EntityID& AcknowledgePdu::getOriginatingID() const -{ - return _originatingID; -} - -void AcknowledgePdu::setOriginatingID(const EntityID &pX) -{ - _originatingID = pX; -} - -EntityID& AcknowledgePdu::getReceivingID() -{ - return _receivingID; -} - -const EntityID& AcknowledgePdu::getReceivingID() const -{ - return _receivingID; -} - -void AcknowledgePdu::setReceivingID(const EntityID &pX) -{ - _receivingID = pX; -} - -unsigned short AcknowledgePdu::getAcknowledgeFlag() const -{ - return _acknowledgeFlag; -} - -void AcknowledgePdu::setAcknowledgeFlag(unsigned short pX) -{ - _acknowledgeFlag = pX; -} - -unsigned short AcknowledgePdu::getResponseFlag() const -{ - return _responseFlag; -} - -void AcknowledgePdu::setResponseFlag(unsigned short pX) -{ - _responseFlag = pX; -} - -unsigned int AcknowledgePdu::getRequestID() const -{ - return _requestID; -} - -void AcknowledgePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void AcknowledgePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _originatingID.marshal(dataStream); - _receivingID.marshal(dataStream); - dataStream << _acknowledgeFlag; - dataStream << _responseFlag; - dataStream << _requestID; -} - -void AcknowledgePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - dataStream >> _acknowledgeFlag; - dataStream >> _responseFlag; - dataStream >> _requestID; -} - - -bool AcknowledgePdu::operator ==(const AcknowledgePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_originatingID == rhs._originatingID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_acknowledgeFlag == rhs._acknowledgeFlag) ) ivarsEqual = false; - if( ! (_responseFlag == rhs._responseFlag) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcknowledgePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingID.getMarshalledSize(); // _originatingID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + 2; // _acknowledgeFlag - marshalSize = marshalSize + 2; // _responseFlag - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AcknowledgePdu.h b/src/dis7/AcknowledgePdu.h deleted file mode 100644 index 4e350db8..00000000 --- a/src/dis7/AcknowledgePdu.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.6. Acknowledge the receipt of a start/resume, stop/freeze, or RemoveEntityPDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AcknowledgePdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for originating entity(or simulation) */ - EntityID _originatingID; - - /** Identifier for the receiving entity(or simulation) */ - EntityID _receivingID; - - /** type of message being acknowledged */ - unsigned short _acknowledgeFlag; - - /** Whether or not the receiving entity was able to comply with the request */ - unsigned short _responseFlag; - - /** Request ID that is unique */ - unsigned int _requestID; - - - public: - AcknowledgePdu(); - virtual ~AcknowledgePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingID(); - const EntityID& getOriginatingID() const; - void setOriginatingID(const EntityID &pX); - - EntityID& getReceivingID(); - const EntityID& getReceivingID() const; - void setReceivingID(const EntityID &pX); - - unsigned short getAcknowledgeFlag() const; - void setAcknowledgeFlag(unsigned short pX); - - unsigned short getResponseFlag() const; - void setResponseFlag(unsigned short pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcknowledgePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AcknowledgeReliablePdu.cpp b/src/dis7/AcknowledgeReliablePdu.cpp deleted file mode 100644 index 57940d1a..00000000 --- a/src/dis7/AcknowledgeReliablePdu.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include - -using namespace DIS; - - -AcknowledgeReliablePdu::AcknowledgeReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _acknowledgeFlag(0), - _responseFlag(0), - _requestID(0) -{ - setPduType( 55 ); -} - -AcknowledgeReliablePdu::~AcknowledgeReliablePdu() -{ -} - -unsigned short AcknowledgeReliablePdu::getAcknowledgeFlag() const -{ - return _acknowledgeFlag; -} - -void AcknowledgeReliablePdu::setAcknowledgeFlag(unsigned short pX) -{ - _acknowledgeFlag = pX; -} - -unsigned short AcknowledgeReliablePdu::getResponseFlag() const -{ - return _responseFlag; -} - -void AcknowledgeReliablePdu::setResponseFlag(unsigned short pX) -{ - _responseFlag = pX; -} - -unsigned int AcknowledgeReliablePdu::getRequestID() const -{ - return _requestID; -} - -void AcknowledgeReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void AcknowledgeReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _acknowledgeFlag; - dataStream << _responseFlag; - dataStream << _requestID; -} - -void AcknowledgeReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _acknowledgeFlag; - dataStream >> _responseFlag; - dataStream >> _requestID; -} - - -bool AcknowledgeReliablePdu::operator ==(const AcknowledgeReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_acknowledgeFlag == rhs._acknowledgeFlag) ) ivarsEqual = false; - if( ! (_responseFlag == rhs._responseFlag) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcknowledgeReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _acknowledgeFlag - marshalSize = marshalSize + 2; // _responseFlag - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AcknowledgeReliablePdu.h b/src/dis7/AcknowledgeReliablePdu.h deleted file mode 100644 index 0d7dc9cd..00000000 --- a/src/dis7/AcknowledgeReliablePdu.h +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.5: Ack receipt of a start-resume, stop-freeze, create-entity or remove enitty (reliable) pdus. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AcknowledgeReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** ack flags */ - unsigned short _acknowledgeFlag; - - /** response flags */ - unsigned short _responseFlag; - - /** Request ID */ - unsigned int _requestID; - - - public: - AcknowledgeReliablePdu(); - virtual ~AcknowledgeReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getAcknowledgeFlag() const; - void setAcknowledgeFlag(unsigned short pX); - - unsigned short getResponseFlag() const; - void setResponseFlag(unsigned short pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcknowledgeReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AcousticEmitter.cpp b/src/dis7/AcousticEmitter.cpp deleted file mode 100644 index 1945bf24..00000000 --- a/src/dis7/AcousticEmitter.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -AcousticEmitter::AcousticEmitter(): - _acousticName(0), - _function(0), - _acousticIdNumber(0) -{ -} - -AcousticEmitter::~AcousticEmitter() -{ -} - -unsigned short AcousticEmitter::getAcousticName() const -{ - return _acousticName; -} - -void AcousticEmitter::setAcousticName(unsigned short pX) -{ - _acousticName = pX; -} - -unsigned char AcousticEmitter::getFunction() const -{ - return _function; -} - -void AcousticEmitter::setFunction(unsigned char pX) -{ - _function = pX; -} - -unsigned char AcousticEmitter::getAcousticIdNumber() const -{ - return _acousticIdNumber; -} - -void AcousticEmitter::setAcousticIdNumber(unsigned char pX) -{ - _acousticIdNumber = pX; -} - -void AcousticEmitter::marshal(DataStream& dataStream) const -{ - dataStream << _acousticName; - dataStream << _function; - dataStream << _acousticIdNumber; -} - -void AcousticEmitter::unmarshal(DataStream& dataStream) -{ - dataStream >> _acousticName; - dataStream >> _function; - dataStream >> _acousticIdNumber; -} - - -bool AcousticEmitter::operator ==(const AcousticEmitter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_acousticName == rhs._acousticName) ) ivarsEqual = false; - if( ! (_function == rhs._function) ) ivarsEqual = false; - if( ! (_acousticIdNumber == rhs._acousticIdNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AcousticEmitter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _acousticName - marshalSize = marshalSize + 1; // _function - marshalSize = marshalSize + 1; // _acousticIdNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AcousticEmitter.h b/src/dis7/AcousticEmitter.h deleted file mode 100644 index 6b58e4a2..00000000 --- a/src/dis7/AcousticEmitter.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// information about a specific UA emmtter. Section 6.2.2. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AcousticEmitter -{ -protected: - /** the system for a particular UA emitter, and an enumeration */ - unsigned short _acousticName; - - /** The function of the acoustic system */ - unsigned char _function; - - /** The UA emitter identification number relative to a specific system */ - unsigned char _acousticIdNumber; - - - public: - AcousticEmitter(); - virtual ~AcousticEmitter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getAcousticName() const; - void setAcousticName(unsigned short pX); - - unsigned char getFunction() const; - void setFunction(unsigned char pX); - - unsigned char getAcousticIdNumber() const; - void setAcousticIdNumber(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AcousticEmitter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ActionRequestPdu.cpp b/src/dis7/ActionRequestPdu.cpp deleted file mode 100644 index 3b02b464..00000000 --- a/src/dis7/ActionRequestPdu.cpp +++ /dev/null @@ -1,249 +0,0 @@ -#include - -using namespace DIS; - - -ActionRequestPdu::ActionRequestPdu() : SimulationManagementFamilyPdu(), - _originatingID(), - _receivingID(), - _requestID(0), - _actionID(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 16 ); -} - -ActionRequestPdu::~ActionRequestPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -EntityID& ActionRequestPdu::getOriginatingID() -{ - return _originatingID; -} - -const EntityID& ActionRequestPdu::getOriginatingID() const -{ - return _originatingID; -} - -void ActionRequestPdu::setOriginatingID(const EntityID &pX) -{ - _originatingID = pX; -} - -EntityID& ActionRequestPdu::getReceivingID() -{ - return _receivingID; -} - -const EntityID& ActionRequestPdu::getReceivingID() const -{ - return _receivingID; -} - -void ActionRequestPdu::setReceivingID(const EntityID &pX) -{ - _receivingID = pX; -} - -unsigned int ActionRequestPdu::getRequestID() const -{ - return _requestID; -} - -void ActionRequestPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int ActionRequestPdu::getActionID() const -{ - return _actionID; -} - -void ActionRequestPdu::setActionID(unsigned int pX) -{ - _actionID = pX; -} - -unsigned int ActionRequestPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int ActionRequestPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& ActionRequestPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& ActionRequestPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void ActionRequestPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& ActionRequestPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& ActionRequestPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void ActionRequestPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void ActionRequestPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _originatingID.marshal(dataStream); - _receivingID.marshal(dataStream); - dataStream << _requestID; - dataStream << _actionID; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void ActionRequestPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - dataStream >> _requestID; - dataStream >> _actionID; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool ActionRequestPdu::operator ==(const ActionRequestPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_originatingID == rhs._originatingID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_actionID == rhs._actionID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ActionRequestPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingID.getMarshalledSize(); // _originatingID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _actionID - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ActionRequestPdu.h b/src/dis7/ActionRequestPdu.h deleted file mode 100644 index 136fe427..00000000 --- a/src/dis7/ActionRequestPdu.h +++ /dev/null @@ -1,118 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.7. Request from simulation manager to a managed entity to perform a specified action. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ActionRequestPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for originating entity(or simulation) */ - EntityID _originatingID; - - /** Identifier for the receiving entity(or simulation) */ - EntityID _receivingID; - - /** identifies the request being made by the simulaton manager */ - unsigned int _requestID; - - /** identifies the particular action being requested(see Section 7 of SISO-REF-010). */ - unsigned int _actionID; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - ActionRequestPdu(); - virtual ~ActionRequestPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingID(); - const EntityID& getOriginatingID() const; - void setOriginatingID(const EntityID &pX); - - EntityID& getReceivingID(); - const EntityID& getReceivingID() const; - void setReceivingID(const EntityID &pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getActionID() const; - void setActionID(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ActionRequestPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ActionRequestReliablePdu.cpp b/src/dis7/ActionRequestReliablePdu.cpp deleted file mode 100644 index 22a3b9e9..00000000 --- a/src/dis7/ActionRequestReliablePdu.cpp +++ /dev/null @@ -1,254 +0,0 @@ -#include - -using namespace DIS; - - -ActionRequestReliablePdu::ActionRequestReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0), - _actionID(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 56 ); -} - -ActionRequestReliablePdu::~ActionRequestReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned char ActionRequestReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void ActionRequestReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short ActionRequestReliablePdu::getPad1() const -{ - return _pad1; -} - -void ActionRequestReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char ActionRequestReliablePdu::getPad2() const -{ - return _pad2; -} - -void ActionRequestReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int ActionRequestReliablePdu::getRequestID() const -{ - return _requestID; -} - -void ActionRequestReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int ActionRequestReliablePdu::getActionID() const -{ - return _actionID; -} - -void ActionRequestReliablePdu::setActionID(unsigned int pX) -{ - _actionID = pX; -} - -unsigned int ActionRequestReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int ActionRequestReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& ActionRequestReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& ActionRequestReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void ActionRequestReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& ActionRequestReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& ActionRequestReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void ActionRequestReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void ActionRequestReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; - dataStream << _actionID; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void ActionRequestReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; - dataStream >> _actionID; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool ActionRequestReliablePdu::operator ==(const ActionRequestReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_actionID == rhs._actionID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ActionRequestReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _actionID - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ActionRequestReliablePdu.h b/src/dis7/ActionRequestReliablePdu.h deleted file mode 100644 index 29c09b29..00000000 --- a/src/dis7/ActionRequestReliablePdu.h +++ /dev/null @@ -1,120 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.6: request from a simulation manager to a managed entity to perform a specified action. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ActionRequestReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** request ID */ - unsigned int _requestID; - - /** request ID */ - unsigned int _actionID; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - ActionRequestReliablePdu(); - virtual ~ActionRequestReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getActionID() const; - void setActionID(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ActionRequestReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ActionResponsePdu.cpp b/src/dis7/ActionResponsePdu.cpp deleted file mode 100644 index 033d8543..00000000 --- a/src/dis7/ActionResponsePdu.cpp +++ /dev/null @@ -1,249 +0,0 @@ -#include - -using namespace DIS; - - -ActionResponsePdu::ActionResponsePdu() : SimulationManagementFamilyPdu(), - _originatingID(), - _receivingID(), - _requestID(0), - _requestStatus(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 17 ); -} - -ActionResponsePdu::~ActionResponsePdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -EntityID& ActionResponsePdu::getOriginatingID() -{ - return _originatingID; -} - -const EntityID& ActionResponsePdu::getOriginatingID() const -{ - return _originatingID; -} - -void ActionResponsePdu::setOriginatingID(const EntityID &pX) -{ - _originatingID = pX; -} - -EntityID& ActionResponsePdu::getReceivingID() -{ - return _receivingID; -} - -const EntityID& ActionResponsePdu::getReceivingID() const -{ - return _receivingID; -} - -void ActionResponsePdu::setReceivingID(const EntityID &pX) -{ - _receivingID = pX; -} - -unsigned int ActionResponsePdu::getRequestID() const -{ - return _requestID; -} - -void ActionResponsePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int ActionResponsePdu::getRequestStatus() const -{ - return _requestStatus; -} - -void ActionResponsePdu::setRequestStatus(unsigned int pX) -{ - _requestStatus = pX; -} - -unsigned int ActionResponsePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int ActionResponsePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& ActionResponsePdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& ActionResponsePdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void ActionResponsePdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& ActionResponsePdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& ActionResponsePdu::getVariableDatums() const -{ - return _variableDatums; -} - -void ActionResponsePdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void ActionResponsePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _originatingID.marshal(dataStream); - _receivingID.marshal(dataStream); - dataStream << _requestID; - dataStream << _requestStatus; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void ActionResponsePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - dataStream >> _requestID; - dataStream >> _requestStatus; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool ActionResponsePdu::operator ==(const ActionResponsePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_originatingID == rhs._originatingID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_requestStatus == rhs._requestStatus) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ActionResponsePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingID.getMarshalledSize(); // _originatingID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _requestStatus - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ActionResponsePdu.h b/src/dis7/ActionResponsePdu.h deleted file mode 100644 index 36ebe434..00000000 --- a/src/dis7/ActionResponsePdu.h +++ /dev/null @@ -1,118 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.8. response to an action request PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ActionResponsePdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for originating entity(or simulation) */ - EntityID _originatingID; - - /** Identifier for the receiving entity(or simulation) */ - EntityID _receivingID; - - /** Request ID that is unique */ - unsigned int _requestID; - - /** Status of response */ - unsigned int _requestStatus; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - ActionResponsePdu(); - virtual ~ActionResponsePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingID(); - const EntityID& getOriginatingID() const; - void setOriginatingID(const EntityID &pX); - - EntityID& getReceivingID(); - const EntityID& getReceivingID() const; - void setReceivingID(const EntityID &pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getRequestStatus() const; - void setRequestStatus(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ActionResponsePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ActionResponseReliablePdu.cpp b/src/dis7/ActionResponseReliablePdu.cpp deleted file mode 100644 index 1b65ec97..00000000 --- a/src/dis7/ActionResponseReliablePdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -ActionResponseReliablePdu::ActionResponseReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requestID(0), - _responseStatus(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 57 ); -} - -ActionResponseReliablePdu::~ActionResponseReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned int ActionResponseReliablePdu::getRequestID() const -{ - return _requestID; -} - -void ActionResponseReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int ActionResponseReliablePdu::getResponseStatus() const -{ - return _responseStatus; -} - -void ActionResponseReliablePdu::setResponseStatus(unsigned int pX) -{ - _responseStatus = pX; -} - -unsigned int ActionResponseReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int ActionResponseReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& ActionResponseReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& ActionResponseReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void ActionResponseReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& ActionResponseReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& ActionResponseReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void ActionResponseReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void ActionResponseReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _responseStatus; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void ActionResponseReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _responseStatus; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool ActionResponseReliablePdu::operator ==(const ActionResponseReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_responseStatus == rhs._responseStatus) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ActionResponseReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _responseStatus - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ActionResponseReliablePdu.h b/src/dis7/ActionResponseReliablePdu.h deleted file mode 100644 index bbc6516d..00000000 --- a/src/dis7/ActionResponseReliablePdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.7: Response from an entity to an action request PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ActionResponseReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** request ID */ - unsigned int _requestID; - - /** status of response */ - unsigned int _responseStatus; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - ActionResponseReliablePdu(); - virtual ~ActionResponseReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getResponseStatus() const; - void setResponseStatus(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ActionResponseReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AggregateIdentifier.cpp b/src/dis7/AggregateIdentifier.cpp deleted file mode 100644 index ad4cb3ca..00000000 --- a/src/dis7/AggregateIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -AggregateIdentifier::AggregateIdentifier(): - _simulationAddress(), - _aggregateID(0) -{ -} - -AggregateIdentifier::~AggregateIdentifier() -{ -} - -SimulationAddress& AggregateIdentifier::getSimulationAddress() -{ - return _simulationAddress; -} - -const SimulationAddress& AggregateIdentifier::getSimulationAddress() const -{ - return _simulationAddress; -} - -void AggregateIdentifier::setSimulationAddress(const SimulationAddress &pX) -{ - _simulationAddress = pX; -} - -unsigned short AggregateIdentifier::getAggregateID() const -{ - return _aggregateID; -} - -void AggregateIdentifier::setAggregateID(unsigned short pX) -{ - _aggregateID = pX; -} - -void AggregateIdentifier::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _aggregateID; -} - -void AggregateIdentifier::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _aggregateID; -} - - -bool AggregateIdentifier::operator ==(const AggregateIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_aggregateID == rhs._aggregateID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AggregateIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _aggregateID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AggregateIdentifier.h b/src/dis7/AggregateIdentifier.h deleted file mode 100644 index 8d307178..00000000 --- a/src/dis7/AggregateIdentifier.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// The unique designation of each aggrgate in an exercise is specified by an aggregate identifier record. The aggregate ID is not an entity and shall not be treated as such. Section 6.2.3. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AggregateIdentifier -{ -protected: - /** Simulation address, ie site and application, the first two fields of the entity ID */ - SimulationAddress _simulationAddress; - - /** the aggregate ID */ - unsigned short _aggregateID; - - - public: - AggregateIdentifier(); - virtual ~AggregateIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getSimulationAddress(); - const SimulationAddress& getSimulationAddress() const; - void setSimulationAddress(const SimulationAddress &pX); - - unsigned short getAggregateID() const; - void setAggregateID(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AggregateIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AggregateMarking.cpp b/src/dis7/AggregateMarking.cpp deleted file mode 100644 index 0786aabc..00000000 --- a/src/dis7/AggregateMarking.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include - -using namespace DIS; - - -AggregateMarking::AggregateMarking(): - _characterSet(0) -{ - // Initialize fixed length array - for(int lengthcharacters= 0; lengthcharacters < 31; lengthcharacters++) - { - _characters[lengthcharacters] = 0; - } - -} - -AggregateMarking::~AggregateMarking() -{ -} - -unsigned char AggregateMarking::getCharacterSet() const -{ - return _characterSet; -} - -void AggregateMarking::setCharacterSet(unsigned char pX) -{ - _characterSet = pX; -} - -unsigned char* AggregateMarking::getCharacters() -{ - return _characters; -} - -const unsigned char* AggregateMarking::getCharacters() const -{ - return _characters; -} - -void AggregateMarking::setCharacters(const unsigned char* x) -{ - for(int i = 0; i < 31; i++) - { - _characters[i] = x[i]; - } -} - -void AggregateMarking::marshal(DataStream& dataStream) const -{ - dataStream << _characterSet; - - for(size_t idx = 0; idx < 31; idx++) - { - dataStream << _characters[idx]; - } - -} - -void AggregateMarking::unmarshal(DataStream& dataStream) -{ - dataStream >> _characterSet; - - for(size_t idx = 0; idx < 31; idx++) - { - dataStream >> _characters[idx]; - } - -} - - -bool AggregateMarking::operator ==(const AggregateMarking& rhs) const - { - bool ivarsEqual = true; - - if( ! (_characterSet == rhs._characterSet) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 31; idx++) - { - if(!(_characters[idx] == rhs._characters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int AggregateMarking::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _characterSet - marshalSize = marshalSize + 31 * 1; // _characters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AggregateMarking.h b/src/dis7/AggregateMarking.h deleted file mode 100644 index 7a80a243..00000000 --- a/src/dis7/AggregateMarking.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Specifies the character set used in the first byte, followed by up to 31 characters of text data. Section 6.2.4. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AggregateMarking -{ -protected: - /** The character set */ - unsigned char _characterSet; - - /** The characters */ - unsigned char _characters[31]; - - - public: - AggregateMarking(); - virtual ~AggregateMarking(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getCharacterSet() const; - void setCharacterSet(unsigned char pX); - - unsigned char* getCharacters(); - const unsigned char* getCharacters() const; - void setCharacters( const unsigned char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AggregateMarking& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AggregateType.cpp b/src/dis7/AggregateType.cpp deleted file mode 100644 index 266aa565..00000000 --- a/src/dis7/AggregateType.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -AggregateType::AggregateType(): - _aggregateKind(0), - _domain(0), - _country(0), - _category(0), - _subcategory(0), - _specific(0), - _extra(0) -{ -} - -AggregateType::~AggregateType() -{ -} - -unsigned char AggregateType::getAggregateKind() const -{ - return _aggregateKind; -} - -void AggregateType::setAggregateKind(unsigned char pX) -{ - _aggregateKind = pX; -} - -unsigned char AggregateType::getDomain() const -{ - return _domain; -} - -void AggregateType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short AggregateType::getCountry() const -{ - return _country; -} - -void AggregateType::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char AggregateType::getCategory() const -{ - return _category; -} - -void AggregateType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char AggregateType::getSubcategory() const -{ - return _subcategory; -} - -void AggregateType::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char AggregateType::getSpecific() const -{ - return _specific; -} - -void AggregateType::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -unsigned char AggregateType::getExtra() const -{ - return _extra; -} - -void AggregateType::setExtra(unsigned char pX) -{ - _extra = pX; -} - -void AggregateType::marshal(DataStream& dataStream) const -{ - dataStream << _aggregateKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; - dataStream << _extra; -} - -void AggregateType::unmarshal(DataStream& dataStream) -{ - dataStream >> _aggregateKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; - dataStream >> _extra; -} - - -bool AggregateType::operator ==(const AggregateType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_aggregateKind == rhs._aggregateKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - if( ! (_extra == rhs._extra) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AggregateType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _aggregateKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - marshalSize = marshalSize + 1; // _extra - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AggregateType.h b/src/dis7/AggregateType.h deleted file mode 100644 index 8364794a..00000000 --- a/src/dis7/AggregateType.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Identifies the type and organization of an aggregate. Section 6.2.5 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AggregateType -{ -protected: - /** Grouping criterion used to group the aggregate. Enumeration from EBV document */ - unsigned char _aggregateKind; - - /** Domain of entity (air, surface, subsurface, space, etc) Zero means domain does not apply. */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - /** specific info based on subcategory field */ - unsigned char _specific; - - unsigned char _extra; - - - public: - AggregateType(); - virtual ~AggregateType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getAggregateKind() const; - void setAggregateKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - unsigned char getExtra() const; - void setExtra(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AggregateType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AngleDeception.cpp b/src/dis7/AngleDeception.cpp deleted file mode 100644 index 4c917420..00000000 --- a/src/dis7/AngleDeception.cpp +++ /dev/null @@ -1,307 +0,0 @@ -#include - -using namespace DIS; - - -AngleDeception::AngleDeception(): - _recordType(3501), - _recordLength(48), - _padding(0), - _emitterNumber(0), - _beamNumber(0), - _stateIndicator(0), - _padding2(0), - _azimuthOffset(0.0), - _azimuthWidth(0.0), - _azimuthPullRate(0.0), - _azimuthPullAcceleration(0.0), - _elevationOffset(0.0), - _elevationWidth(0.0), - _elevationPullRate(0.0), - _elevationPullAcceleration(0.0), - _padding3(0) -{ -} - -AngleDeception::~AngleDeception() -{ -} - -unsigned int AngleDeception::getRecordType() const -{ - return _recordType; -} - -void AngleDeception::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short AngleDeception::getRecordLength() const -{ - return _recordLength; -} - -void AngleDeception::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned short AngleDeception::getPadding() const -{ - return _padding; -} - -void AngleDeception::setPadding(unsigned short pX) -{ - _padding = pX; -} - -unsigned char AngleDeception::getEmitterNumber() const -{ - return _emitterNumber; -} - -void AngleDeception::setEmitterNumber(unsigned char pX) -{ - _emitterNumber = pX; -} - -unsigned char AngleDeception::getBeamNumber() const -{ - return _beamNumber; -} - -void AngleDeception::setBeamNumber(unsigned char pX) -{ - _beamNumber = pX; -} - -unsigned char AngleDeception::getStateIndicator() const -{ - return _stateIndicator; -} - -void AngleDeception::setStateIndicator(unsigned char pX) -{ - _stateIndicator = pX; -} - -unsigned int AngleDeception::getPadding2() const -{ - return _padding2; -} - -void AngleDeception::setPadding2(unsigned int pX) -{ - _padding2 = pX; -} - -float AngleDeception::getAzimuthOffset() const -{ - return _azimuthOffset; -} - -void AngleDeception::setAzimuthOffset(float pX) -{ - _azimuthOffset = pX; -} - -float AngleDeception::getAzimuthWidth() const -{ - return _azimuthWidth; -} - -void AngleDeception::setAzimuthWidth(float pX) -{ - _azimuthWidth = pX; -} - -float AngleDeception::getAzimuthPullRate() const -{ - return _azimuthPullRate; -} - -void AngleDeception::setAzimuthPullRate(float pX) -{ - _azimuthPullRate = pX; -} - -float AngleDeception::getAzimuthPullAcceleration() const -{ - return _azimuthPullAcceleration; -} - -void AngleDeception::setAzimuthPullAcceleration(float pX) -{ - _azimuthPullAcceleration = pX; -} - -float AngleDeception::getElevationOffset() const -{ - return _elevationOffset; -} - -void AngleDeception::setElevationOffset(float pX) -{ - _elevationOffset = pX; -} - -float AngleDeception::getElevationWidth() const -{ - return _elevationWidth; -} - -void AngleDeception::setElevationWidth(float pX) -{ - _elevationWidth = pX; -} - -float AngleDeception::getElevationPullRate() const -{ - return _elevationPullRate; -} - -void AngleDeception::setElevationPullRate(float pX) -{ - _elevationPullRate = pX; -} - -float AngleDeception::getElevationPullAcceleration() const -{ - return _elevationPullAcceleration; -} - -void AngleDeception::setElevationPullAcceleration(float pX) -{ - _elevationPullAcceleration = pX; -} - -unsigned int AngleDeception::getPadding3() const -{ - return _padding3; -} - -void AngleDeception::setPadding3(unsigned int pX) -{ - _padding3 = pX; -} - -void AngleDeception::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _padding; - dataStream << _emitterNumber; - dataStream << _beamNumber; - dataStream << _stateIndicator; - dataStream << _padding2; - dataStream << _azimuthOffset; - dataStream << _azimuthWidth; - dataStream << _azimuthPullRate; - dataStream << _azimuthPullAcceleration; - dataStream << _elevationOffset; - dataStream << _elevationWidth; - dataStream << _elevationPullRate; - dataStream << _elevationPullAcceleration; - dataStream << _padding3; -} - -void AngleDeception::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _padding; - dataStream >> _emitterNumber; - dataStream >> _beamNumber; - dataStream >> _stateIndicator; - dataStream >> _padding2; - dataStream >> _azimuthOffset; - dataStream >> _azimuthWidth; - dataStream >> _azimuthPullRate; - dataStream >> _azimuthPullAcceleration; - dataStream >> _elevationOffset; - dataStream >> _elevationWidth; - dataStream >> _elevationPullRate; - dataStream >> _elevationPullAcceleration; - dataStream >> _padding3; -} - - -bool AngleDeception::operator ==(const AngleDeception& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_emitterNumber == rhs._emitterNumber) ) ivarsEqual = false; - if( ! (_beamNumber == rhs._beamNumber) ) ivarsEqual = false; - if( ! (_stateIndicator == rhs._stateIndicator) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_azimuthOffset == rhs._azimuthOffset) ) ivarsEqual = false; - if( ! (_azimuthWidth == rhs._azimuthWidth) ) ivarsEqual = false; - if( ! (_azimuthPullRate == rhs._azimuthPullRate) ) ivarsEqual = false; - if( ! (_azimuthPullAcceleration == rhs._azimuthPullAcceleration) ) ivarsEqual = false; - if( ! (_elevationOffset == rhs._elevationOffset) ) ivarsEqual = false; - if( ! (_elevationWidth == rhs._elevationWidth) ) ivarsEqual = false; - if( ! (_elevationPullRate == rhs._elevationPullRate) ) ivarsEqual = false; - if( ! (_elevationPullAcceleration == rhs._elevationPullAcceleration) ) ivarsEqual = false; - if( ! (_padding3 == rhs._padding3) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AngleDeception::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + 1; // _emitterNumber - marshalSize = marshalSize + 1; // _beamNumber - marshalSize = marshalSize + 1; // _stateIndicator - marshalSize = marshalSize + 4; // _padding2 - marshalSize = marshalSize + 4; // _azimuthOffset - marshalSize = marshalSize + 4; // _azimuthWidth - marshalSize = marshalSize + 4; // _azimuthPullRate - marshalSize = marshalSize + 4; // _azimuthPullAcceleration - marshalSize = marshalSize + 4; // _elevationOffset - marshalSize = marshalSize + 4; // _elevationWidth - marshalSize = marshalSize + 4; // _elevationPullRate - marshalSize = marshalSize + 4; // _elevationPullAcceleration - marshalSize = marshalSize + 4; // _padding3 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AngleDeception.h b/src/dis7/AngleDeception.h deleted file mode 100644 index 8eeb1ccf..00000000 --- a/src/dis7/AngleDeception.h +++ /dev/null @@ -1,142 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The Angle Deception attribute record may be used to communicate discrete values that are associated with angle deception jamming that cannot be referenced to an emitter mode. The values provided in the record records (provided in the associated Electromagnetic Emission PDU). (The victim radar beams are those that are targeted by the jammer.) Section 6.2.12.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AngleDeception -{ -protected: - unsigned int _recordType; - - unsigned short _recordLength; - - unsigned short _padding; - - unsigned char _emitterNumber; - - unsigned char _beamNumber; - - unsigned char _stateIndicator; - - unsigned int _padding2; - - float _azimuthOffset; - - float _azimuthWidth; - - float _azimuthPullRate; - - float _azimuthPullAcceleration; - - float _elevationOffset; - - float _elevationWidth; - - float _elevationPullRate; - - float _elevationPullAcceleration; - - unsigned int _padding3; - - - public: - AngleDeception(); - virtual ~AngleDeception(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - unsigned char getEmitterNumber() const; - void setEmitterNumber(unsigned char pX); - - unsigned char getBeamNumber() const; - void setBeamNumber(unsigned char pX); - - unsigned char getStateIndicator() const; - void setStateIndicator(unsigned char pX); - - unsigned int getPadding2() const; - void setPadding2(unsigned int pX); - - float getAzimuthOffset() const; - void setAzimuthOffset(float pX); - - float getAzimuthWidth() const; - void setAzimuthWidth(float pX); - - float getAzimuthPullRate() const; - void setAzimuthPullRate(float pX); - - float getAzimuthPullAcceleration() const; - void setAzimuthPullAcceleration(float pX); - - float getElevationOffset() const; - void setElevationOffset(float pX); - - float getElevationWidth() const; - void setElevationWidth(float pX); - - float getElevationPullRate() const; - void setElevationPullRate(float pX); - - float getElevationPullAcceleration() const; - void setElevationPullAcceleration(float pX); - - unsigned int getPadding3() const; - void setPadding3(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AngleDeception& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AngularVelocityVector.cpp b/src/dis7/AngularVelocityVector.cpp deleted file mode 100644 index 4d8342e4..00000000 --- a/src/dis7/AngularVelocityVector.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -AngularVelocityVector::AngularVelocityVector(): - _x(0), - _y(0), - _z(0) -{ -} - -AngularVelocityVector::~AngularVelocityVector() -{ -} - -float AngularVelocityVector::getX() const -{ - return _x; -} - -void AngularVelocityVector::setX(float pX) -{ - _x = pX; -} - -float AngularVelocityVector::getY() const -{ - return _y; -} - -void AngularVelocityVector::setY(float pX) -{ - _y = pX; -} - -float AngularVelocityVector::getZ() const -{ - return _z; -} - -void AngularVelocityVector::setZ(float pX) -{ - _z = pX; -} - -void AngularVelocityVector::marshal(DataStream& dataStream) const -{ - dataStream << _x; - dataStream << _y; - dataStream << _z; -} - -void AngularVelocityVector::unmarshal(DataStream& dataStream) -{ - dataStream >> _x; - dataStream >> _y; - dataStream >> _z; -} - - -bool AngularVelocityVector::operator ==(const AngularVelocityVector& rhs) const - { - bool ivarsEqual = true; - - if( ! (_x == rhs._x) ) ivarsEqual = false; - if( ! (_y == rhs._y) ) ivarsEqual = false; - if( ! (_z == rhs._z) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AngularVelocityVector::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _x - marshalSize = marshalSize + 4; // _y - marshalSize = marshalSize + 4; // _z - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AngularVelocityVector.h b/src/dis7/AngularVelocityVector.h deleted file mode 100644 index c4e30312..00000000 --- a/src/dis7/AngularVelocityVector.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Angular velocity measured in radians per second out each of the entity's own coordinate axes. Order of measurement is angular velocity around the x, y, and z axis of the entity. The positive direction is determined by the right hand rule. Section 6.2.7 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AngularVelocityVector -{ -protected: - /** velocity about the x axis */ - float _x; - - /** velocity about the y axis */ - float _y; - - /** velocity about the zaxis */ - float _z; - - - public: - AngularVelocityVector(); - virtual ~AngularVelocityVector(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getX() const; - void setX(float pX); - - float getY() const; - void setY(float pX); - - float getZ() const; - void setZ(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AngularVelocityVector& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AntennaLocation.cpp b/src/dis7/AntennaLocation.cpp deleted file mode 100644 index a2a32182..00000000 --- a/src/dis7/AntennaLocation.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include - -using namespace DIS; - - -AntennaLocation::AntennaLocation(): - _antennaLocation(), - _relativeAntennaLocation() -{ -} - -AntennaLocation::~AntennaLocation() -{ -} - -Vector3Double& AntennaLocation::getAntennaLocation() -{ - return _antennaLocation; -} - -const Vector3Double& AntennaLocation::getAntennaLocation() const -{ - return _antennaLocation; -} - -void AntennaLocation::setAntennaLocation(const Vector3Double &pX) -{ - _antennaLocation = pX; -} - -Vector3Float& AntennaLocation::getRelativeAntennaLocation() -{ - return _relativeAntennaLocation; -} - -const Vector3Float& AntennaLocation::getRelativeAntennaLocation() const -{ - return _relativeAntennaLocation; -} - -void AntennaLocation::setRelativeAntennaLocation(const Vector3Float &pX) -{ - _relativeAntennaLocation = pX; -} - -void AntennaLocation::marshal(DataStream& dataStream) const -{ - _antennaLocation.marshal(dataStream); - _relativeAntennaLocation.marshal(dataStream); -} - -void AntennaLocation::unmarshal(DataStream& dataStream) -{ - _antennaLocation.unmarshal(dataStream); - _relativeAntennaLocation.unmarshal(dataStream); -} - - -bool AntennaLocation::operator ==(const AntennaLocation& rhs) const - { - bool ivarsEqual = true; - - if( ! (_antennaLocation == rhs._antennaLocation) ) ivarsEqual = false; - if( ! (_relativeAntennaLocation == rhs._relativeAntennaLocation) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AntennaLocation::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _antennaLocation.getMarshalledSize(); // _antennaLocation - marshalSize = marshalSize + _relativeAntennaLocation.getMarshalledSize(); // _relativeAntennaLocation - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AntennaLocation.h b/src/dis7/AntennaLocation.h deleted file mode 100644 index 76cf8131..00000000 --- a/src/dis7/AntennaLocation.h +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Location of the radiating portion of the antenna, specified in world coordinates and entity coordinates. Section 6.2.8 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AntennaLocation -{ -protected: - /** Location of the radiating portion of the antenna in world coordinates */ - Vector3Double _antennaLocation; - - /** Location of the radiating portion of the antenna in entity coordinates */ - Vector3Float _relativeAntennaLocation; - - - public: - AntennaLocation(); - virtual ~AntennaLocation(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - Vector3Double& getAntennaLocation(); - const Vector3Double& getAntennaLocation() const; - void setAntennaLocation(const Vector3Double &pX); - - Vector3Float& getRelativeAntennaLocation(); - const Vector3Float& getRelativeAntennaLocation() const; - void setRelativeAntennaLocation(const Vector3Float &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AntennaLocation& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ArealObjectStatePdu.cpp b/src/dis7/ArealObjectStatePdu.cpp deleted file mode 100644 index 8a31a993..00000000 --- a/src/dis7/ArealObjectStatePdu.cpp +++ /dev/null @@ -1,301 +0,0 @@ -#include - -using namespace DIS; - - -ArealObjectStatePdu::ArealObjectStatePdu() : SyntheticEnvironmentFamilyPdu(), - _objectID(), - _referencedObjectID(), - _updateNumber(0), - _forceID(0), - _modifications(0), - _objectType(), - _specificObjectAppearance(0), - _generalObjectAppearance(0), - _numberOfPoints(0), - _requesterID(), - _receivingID() -{ - setPduType( 45 ); -} - -ArealObjectStatePdu::~ArealObjectStatePdu() -{ - _objectLocation.clear(); -} - -EntityID& ArealObjectStatePdu::getObjectID() -{ - return _objectID; -} - -const EntityID& ArealObjectStatePdu::getObjectID() const -{ - return _objectID; -} - -void ArealObjectStatePdu::setObjectID(const EntityID &pX) -{ - _objectID = pX; -} - -EntityID& ArealObjectStatePdu::getReferencedObjectID() -{ - return _referencedObjectID; -} - -const EntityID& ArealObjectStatePdu::getReferencedObjectID() const -{ - return _referencedObjectID; -} - -void ArealObjectStatePdu::setReferencedObjectID(const EntityID &pX) -{ - _referencedObjectID = pX; -} - -unsigned short ArealObjectStatePdu::getUpdateNumber() const -{ - return _updateNumber; -} - -void ArealObjectStatePdu::setUpdateNumber(unsigned short pX) -{ - _updateNumber = pX; -} - -unsigned char ArealObjectStatePdu::getForceID() const -{ - return _forceID; -} - -void ArealObjectStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char ArealObjectStatePdu::getModifications() const -{ - return _modifications; -} - -void ArealObjectStatePdu::setModifications(unsigned char pX) -{ - _modifications = pX; -} - -EntityType& ArealObjectStatePdu::getObjectType() -{ - return _objectType; -} - -const EntityType& ArealObjectStatePdu::getObjectType() const -{ - return _objectType; -} - -void ArealObjectStatePdu::setObjectType(const EntityType &pX) -{ - _objectType = pX; -} - -unsigned int ArealObjectStatePdu::getSpecificObjectAppearance() const -{ - return _specificObjectAppearance; -} - -void ArealObjectStatePdu::setSpecificObjectAppearance(unsigned int pX) -{ - _specificObjectAppearance = pX; -} - -unsigned short ArealObjectStatePdu::getGeneralObjectAppearance() const -{ - return _generalObjectAppearance; -} - -void ArealObjectStatePdu::setGeneralObjectAppearance(unsigned short pX) -{ - _generalObjectAppearance = pX; -} - -unsigned short ArealObjectStatePdu::getNumberOfPoints() const -{ - return _objectLocation.size(); -} - -SimulationAddress& ArealObjectStatePdu::getRequesterID() -{ - return _requesterID; -} - -const SimulationAddress& ArealObjectStatePdu::getRequesterID() const -{ - return _requesterID; -} - -void ArealObjectStatePdu::setRequesterID(const SimulationAddress &pX) -{ - _requesterID = pX; -} - -SimulationAddress& ArealObjectStatePdu::getReceivingID() -{ - return _receivingID; -} - -const SimulationAddress& ArealObjectStatePdu::getReceivingID() const -{ - return _receivingID; -} - -void ArealObjectStatePdu::setReceivingID(const SimulationAddress &pX) -{ - _receivingID = pX; -} - -std::vector& ArealObjectStatePdu::getObjectLocation() -{ - return _objectLocation; -} - -const std::vector& ArealObjectStatePdu::getObjectLocation() const -{ - return _objectLocation; -} - -void ArealObjectStatePdu::setObjectLocation(const std::vector& pX) -{ - _objectLocation = pX; -} - -void ArealObjectStatePdu::marshal(DataStream& dataStream) const -{ - SyntheticEnvironmentFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _objectID.marshal(dataStream); - _referencedObjectID.marshal(dataStream); - dataStream << _updateNumber; - dataStream << _forceID; - dataStream << _modifications; - _objectType.marshal(dataStream); - dataStream << _specificObjectAppearance; - dataStream << _generalObjectAppearance; - dataStream << ( unsigned short )_objectLocation.size(); - _requesterID.marshal(dataStream); - _receivingID.marshal(dataStream); - - for(size_t idx = 0; idx < _objectLocation.size(); idx++) - { - Vector3Double x = _objectLocation[idx]; - x.marshal(dataStream); - } - -} - -void ArealObjectStatePdu::unmarshal(DataStream& dataStream) -{ - SyntheticEnvironmentFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _objectID.unmarshal(dataStream); - _referencedObjectID.unmarshal(dataStream); - dataStream >> _updateNumber; - dataStream >> _forceID; - dataStream >> _modifications; - _objectType.unmarshal(dataStream); - dataStream >> _specificObjectAppearance; - dataStream >> _generalObjectAppearance; - dataStream >> _numberOfPoints; - _requesterID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - - _objectLocation.clear(); - for(size_t idx = 0; idx < _numberOfPoints; idx++) - { - Vector3Double x; - x.unmarshal(dataStream); - _objectLocation.push_back(x); - } -} - - -bool ArealObjectStatePdu::operator ==(const ArealObjectStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); - - if( ! (_objectID == rhs._objectID) ) ivarsEqual = false; - if( ! (_referencedObjectID == rhs._referencedObjectID) ) ivarsEqual = false; - if( ! (_updateNumber == rhs._updateNumber) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_modifications == rhs._modifications) ) ivarsEqual = false; - if( ! (_objectType == rhs._objectType) ) ivarsEqual = false; - if( ! (_specificObjectAppearance == rhs._specificObjectAppearance) ) ivarsEqual = false; - if( ! (_generalObjectAppearance == rhs._generalObjectAppearance) ) ivarsEqual = false; - if( ! (_requesterID == rhs._requesterID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _objectLocation.size(); idx++) - { - if( ! ( _objectLocation[idx] == rhs._objectLocation[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ArealObjectStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID - marshalSize = marshalSize + _referencedObjectID.getMarshalledSize(); // _referencedObjectID - marshalSize = marshalSize + 2; // _updateNumber - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _modifications - marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType - marshalSize = marshalSize + 4; // _specificObjectAppearance - marshalSize = marshalSize + 2; // _generalObjectAppearance - marshalSize = marshalSize + 2; // _numberOfPoints - marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - - for(unsigned long long idx=0; idx < _objectLocation.size(); idx++) - { - Vector3Double listElement = _objectLocation[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ArealObjectStatePdu.h b/src/dis7/ArealObjectStatePdu.h deleted file mode 100644 index 07b38f23..00000000 --- a/src/dis7/ArealObjectStatePdu.h +++ /dev/null @@ -1,147 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Information about the addition/modification of an oobject that is geometrically anchored to the terrain with a set of three or more points that come to a closure. Section 7.10.6 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ArealObjectStatePdu : public SyntheticEnvironmentFamilyPdu -{ -protected: - /** Object in synthetic environment */ - EntityID _objectID; - - /** Object with which this point object is associated */ - EntityID _referencedObjectID; - - /** unique update number of each state transition of an object */ - unsigned short _updateNumber; - - /** force ID */ - unsigned char _forceID; - - /** modifications enumeration */ - unsigned char _modifications; - - /** Object type */ - EntityType _objectType; - - /** Object appearance */ - unsigned int _specificObjectAppearance; - - /** Object appearance */ - unsigned short _generalObjectAppearance; - - /** Number of points */ - unsigned short _numberOfPoints; - - /** requesterID */ - SimulationAddress _requesterID; - - /** receiver ID */ - SimulationAddress _receivingID; - - /** location of object */ - std::vector _objectLocation; - - - public: - ArealObjectStatePdu(); - virtual ~ArealObjectStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getObjectID(); - const EntityID& getObjectID() const; - void setObjectID(const EntityID &pX); - - EntityID& getReferencedObjectID(); - const EntityID& getReferencedObjectID() const; - void setReferencedObjectID(const EntityID &pX); - - unsigned short getUpdateNumber() const; - void setUpdateNumber(unsigned short pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getModifications() const; - void setModifications(unsigned char pX); - - EntityType& getObjectType(); - const EntityType& getObjectType() const; - void setObjectType(const EntityType &pX); - - unsigned int getSpecificObjectAppearance() const; - void setSpecificObjectAppearance(unsigned int pX); - - unsigned short getGeneralObjectAppearance() const; - void setGeneralObjectAppearance(unsigned short pX); - - unsigned short getNumberOfPoints() const; - - SimulationAddress& getRequesterID(); - const SimulationAddress& getRequesterID() const; - void setRequesterID(const SimulationAddress &pX); - - SimulationAddress& getReceivingID(); - const SimulationAddress& getReceivingID() const; - void setReceivingID(const SimulationAddress &pX); - - std::vector& getObjectLocation(); - const std::vector& getObjectLocation() const; - void setObjectLocation(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ArealObjectStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ArticulatedParts.cpp b/src/dis7/ArticulatedParts.cpp deleted file mode 100644 index d407e413..00000000 --- a/src/dis7/ArticulatedParts.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include - -using namespace DIS; - - -ArticulatedParts::ArticulatedParts(): - _recordType(0), - _changeIndicator(0), - _partAttachedTo(0), - _parameterType(0), - _parameterValue(0), - _padding(0) -{ -} - -ArticulatedParts::~ArticulatedParts() -{ -} - -unsigned char ArticulatedParts::getRecordType() const -{ - return _recordType; -} - -void ArticulatedParts::setRecordType(unsigned char pX) -{ - _recordType = pX; -} - -unsigned char ArticulatedParts::getChangeIndicator() const -{ - return _changeIndicator; -} - -void ArticulatedParts::setChangeIndicator(unsigned char pX) -{ - _changeIndicator = pX; -} - -unsigned short ArticulatedParts::getPartAttachedTo() const -{ - return _partAttachedTo; -} - -void ArticulatedParts::setPartAttachedTo(unsigned short pX) -{ - _partAttachedTo = pX; -} - -unsigned int ArticulatedParts::getParameterType() const -{ - return _parameterType; -} - -void ArticulatedParts::setParameterType(unsigned int pX) -{ - _parameterType = pX; -} - -float ArticulatedParts::getParameterValue() const -{ - return _parameterValue; -} - -void ArticulatedParts::setParameterValue(float pX) -{ - _parameterValue = pX; -} - -void ArticulatedParts::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _changeIndicator; - dataStream << _partAttachedTo; - dataStream << _parameterType; - dataStream << _parameterValue; - dataStream << _padding; -} - -void ArticulatedParts::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _changeIndicator; - dataStream >> _partAttachedTo; - dataStream >> _parameterType; - dataStream >> _parameterValue; - dataStream >> _padding; -} - - -bool ArticulatedParts::operator ==(const ArticulatedParts& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_changeIndicator == rhs._changeIndicator) ) ivarsEqual = false; - if( ! (_partAttachedTo == rhs._partAttachedTo) ) ivarsEqual = false; - if( ! (_parameterType == rhs._parameterType) ) ivarsEqual = false; - if( ! (_parameterValue == rhs._parameterValue) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ArticulatedParts::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _recordType - marshalSize = marshalSize + 1; // _changeIndicator - marshalSize = marshalSize + 2; // _partAttachedTo - marshalSize = marshalSize + 4; // _parameterType - marshalSize = marshalSize + 4; // _parameterValue - marshalSize = marshalSize + 4; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ArticulatedParts.h b/src/dis7/ArticulatedParts.h deleted file mode 100644 index fa618ec8..00000000 --- a/src/dis7/ArticulatedParts.h +++ /dev/null @@ -1,96 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// articulated parts for movable parts and a combination of moveable/attached parts of an entity. Section 6.2.94.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ArticulatedParts -{ -protected: - /** the identification of the Variable Parameter record. Enumeration from EBV */ - unsigned char _recordType; - - /** indicate the change of any parameter for any articulated part. Starts at zero, incremented for each change */ - unsigned char _changeIndicator; - - /** the identification of the articulated part to which this articulation parameter is attached. This field shall be specified by a 16-bit unsigned integer. This field shall contain the value zero if the articulated part is attached directly to the entity. */ - unsigned short _partAttachedTo; - - /** the type of parameter represented, 32 bit enumeration */ - unsigned int _parameterType; - - /** This field shall specify the parameter value and shall be specified by a 32-bit -floating point number. */ - float _parameterValue; - - /** 32 bits of unused padding */ - unsigned int _padding; - - - public: - ArticulatedParts(); - virtual ~ArticulatedParts(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRecordType() const; - void setRecordType(unsigned char pX); - - unsigned char getChangeIndicator() const; - void setChangeIndicator(unsigned char pX); - - unsigned short getPartAttachedTo() const; - void setPartAttachedTo(unsigned short pX); - - unsigned int getParameterType() const; - void setParameterType(unsigned int pX); - - float getParameterValue() const; - void setParameterValue(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ArticulatedParts& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Association.cpp b/src/dis7/Association.cpp deleted file mode 100644 index 8dab492c..00000000 --- a/src/dis7/Association.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include - -using namespace DIS; - - -Association::Association(): - _associationType(0), - _padding4(0), - _associatedEntityID(), - _associatedLocation() -{ -} - -Association::~Association() -{ -} - -unsigned char Association::getAssociationType() const -{ - return _associationType; -} - -void Association::setAssociationType(unsigned char pX) -{ - _associationType = pX; -} - -unsigned char Association::getPadding4() const -{ - return _padding4; -} - -void Association::setPadding4(unsigned char pX) -{ - _padding4 = pX; -} - -EntityID& Association::getAssociatedEntityID() -{ - return _associatedEntityID; -} - -const EntityID& Association::getAssociatedEntityID() const -{ - return _associatedEntityID; -} - -void Association::setAssociatedEntityID(const EntityID &pX) -{ - _associatedEntityID = pX; -} - -Vector3Double& Association::getAssociatedLocation() -{ - return _associatedLocation; -} - -const Vector3Double& Association::getAssociatedLocation() const -{ - return _associatedLocation; -} - -void Association::setAssociatedLocation(const Vector3Double &pX) -{ - _associatedLocation = pX; -} - -void Association::marshal(DataStream& dataStream) const -{ - dataStream << _associationType; - dataStream << _padding4; - _associatedEntityID.marshal(dataStream); - _associatedLocation.marshal(dataStream); -} - -void Association::unmarshal(DataStream& dataStream) -{ - dataStream >> _associationType; - dataStream >> _padding4; - _associatedEntityID.unmarshal(dataStream); - _associatedLocation.unmarshal(dataStream); -} - - -bool Association::operator ==(const Association& rhs) const - { - bool ivarsEqual = true; - - if( ! (_associationType == rhs._associationType) ) ivarsEqual = false; - if( ! (_padding4 == rhs._padding4) ) ivarsEqual = false; - if( ! (_associatedEntityID == rhs._associatedEntityID) ) ivarsEqual = false; - if( ! (_associatedLocation == rhs._associatedLocation) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Association::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _associationType - marshalSize = marshalSize + 1; // _padding4 - marshalSize = marshalSize + _associatedEntityID.getMarshalledSize(); // _associatedEntityID - marshalSize = marshalSize + _associatedLocation.getMarshalledSize(); // _associatedLocation - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Association.h b/src/dis7/Association.h deleted file mode 100644 index 3daf988f..00000000 --- a/src/dis7/Association.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// An entity's associations with other entities and/or locations. For each association, this record shall specify the type of the association, the associated entity's EntityID and/or the associated location's world coordinates. This record may be used (optionally) in a transfer transaction to send internal state data from the divesting simulation to the acquiring simulation (see 5.9.4). This record may also be used for other purposes. Section 6.2.10 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Association -{ -protected: - unsigned char _associationType; - - unsigned char _padding4; - - /** identity of associated entity. If none, NO_SPECIFIC_ENTITY */ - EntityID _associatedEntityID; - - /** location, in world coordinates */ - Vector3Double _associatedLocation; - - - public: - Association(); - virtual ~Association(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getAssociationType() const; - void setAssociationType(unsigned char pX); - - unsigned char getPadding4() const; - void setPadding4(unsigned char pX); - - EntityID& getAssociatedEntityID(); - const EntityID& getAssociatedEntityID() const; - void setAssociatedEntityID(const EntityID &pX); - - Vector3Double& getAssociatedLocation(); - const Vector3Double& getAssociatedLocation() const; - void setAssociatedLocation(const Vector3Double &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Association& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AttachedParts.cpp b/src/dis7/AttachedParts.cpp deleted file mode 100644 index 048ad95a..00000000 --- a/src/dis7/AttachedParts.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -AttachedParts::AttachedParts(): - _recordType(1), - _detachedIndicator(0), - _partAttachedTo(0), - _parameterType(0), - _attachedPartType(0) -{ -} - -AttachedParts::~AttachedParts() -{ -} - -unsigned char AttachedParts::getRecordType() const -{ - return _recordType; -} - -void AttachedParts::setRecordType(unsigned char pX) -{ - _recordType = pX; -} - -unsigned char AttachedParts::getDetachedIndicator() const -{ - return _detachedIndicator; -} - -void AttachedParts::setDetachedIndicator(unsigned char pX) -{ - _detachedIndicator = pX; -} - -unsigned short AttachedParts::getPartAttachedTo() const -{ - return _partAttachedTo; -} - -void AttachedParts::setPartAttachedTo(unsigned short pX) -{ - _partAttachedTo = pX; -} - -unsigned int AttachedParts::getParameterType() const -{ - return _parameterType; -} - -void AttachedParts::setParameterType(unsigned int pX) -{ - _parameterType = pX; -} - -unsigned long long AttachedParts::getAttachedPartType() const -{ - return _attachedPartType; -} - -void AttachedParts::setAttachedPartType(unsigned long long pX) -{ - _attachedPartType = pX; -} - -void AttachedParts::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _detachedIndicator; - dataStream << _partAttachedTo; - dataStream << _parameterType; - dataStream << _attachedPartType; -} - -void AttachedParts::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _detachedIndicator; - dataStream >> _partAttachedTo; - dataStream >> _parameterType; - dataStream >> _attachedPartType; -} - - -bool AttachedParts::operator ==(const AttachedParts& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_detachedIndicator == rhs._detachedIndicator) ) ivarsEqual = false; - if( ! (_partAttachedTo == rhs._partAttachedTo) ) ivarsEqual = false; - if( ! (_parameterType == rhs._parameterType) ) ivarsEqual = false; - if( ! (_attachedPartType == rhs._attachedPartType) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AttachedParts::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _recordType - marshalSize = marshalSize + 1; // _detachedIndicator - marshalSize = marshalSize + 2; // _partAttachedTo - marshalSize = marshalSize + 4; // _parameterType - marshalSize = marshalSize + 8; // _attachedPartType - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AttachedParts.h b/src/dis7/AttachedParts.h deleted file mode 100644 index b80f7547..00000000 --- a/src/dis7/AttachedParts.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Removable parts that may be attached to an entity. Section 6.2.94.3 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AttachedParts -{ -protected: - /** the identification of the Variable Parameter record. Enumeration from EBV */ - unsigned char _recordType; - - /** 0 = attached, 1 = detached. See I.2.3.1 for state transition diagram */ - unsigned char _detachedIndicator; - - /** the identification of the articulated part to which this articulation parameter is attached. This field shall be specified by a 16-bit unsigned integer. This field shall contain the value zero if the articulated part is attached directly to the entity. */ - unsigned short _partAttachedTo; - - /** The location or station to which the part is attached */ - unsigned int _parameterType; - - /** The definition of the 64 bits shall be determined based on the type of parameter specified in the Parameter Type field */ - unsigned long long _attachedPartType; - - - public: - AttachedParts(); - virtual ~AttachedParts(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRecordType() const; - void setRecordType(unsigned char pX); - - unsigned char getDetachedIndicator() const; - void setDetachedIndicator(unsigned char pX); - - unsigned short getPartAttachedTo() const; - void setPartAttachedTo(unsigned short pX); - - unsigned int getParameterType() const; - void setParameterType(unsigned int pX); - - unsigned long long getAttachedPartType() const; - void setAttachedPartType(unsigned long long pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AttachedParts& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Attribute.cpp b/src/dis7/Attribute.cpp deleted file mode 100644 index fa7bf7c4..00000000 --- a/src/dis7/Attribute.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -Attribute::Attribute(): - _recordType(0), - _recordLength(0), - _recordSpecificFields(0) -{ -} - -Attribute::~Attribute() -{ -} - -unsigned int Attribute::getRecordType() const -{ - return _recordType; -} - -void Attribute::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short Attribute::getRecordLength() const -{ - return _recordLength; -} - -void Attribute::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -long long Attribute::getRecordSpecificFields() const -{ - return _recordSpecificFields; -} - -void Attribute::setRecordSpecificFields(long long pX) -{ - _recordSpecificFields = pX; -} - -void Attribute::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _recordSpecificFields; -} - -void Attribute::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _recordSpecificFields; -} - - -bool Attribute::operator ==(const Attribute& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_recordSpecificFields == rhs._recordSpecificFields) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Attribute::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 1; // _recordLength - marshalSize = marshalSize + 8; // _recordSpecificFields - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Attribute.h b/src/dis7/Attribute.h deleted file mode 100644 index 22bea221..00000000 --- a/src/dis7/Attribute.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Used to convey information for one or more attributes. Attributes conform to the standard variable record format of 6.2.82. Section 6.2.10 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Attribute -{ -protected: - unsigned int _recordType; - - unsigned short _recordLength; - - long long _recordSpecificFields; - - - public: - Attribute(); - virtual ~Attribute(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - long long getRecordSpecificFields() const; - void setRecordSpecificFields(long long pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Attribute& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AttributePdu.cpp b/src/dis7/AttributePdu.cpp deleted file mode 100644 index 8d97bd2c..00000000 --- a/src/dis7/AttributePdu.cpp +++ /dev/null @@ -1,212 +0,0 @@ -#include - -using namespace DIS; - - -AttributePdu::AttributePdu() : EntityInformationFamilyPdu(), - _originatingSimulationAddress(), - _padding1(0), - _padding2(0), - _attributeRecordPduType(0), - _attributeRecordProtocolVersion(0), - _masterAttributeRecordType(0), - _actionCode(0), - _padding3(0), - _numberAttributeRecordSet(0) -{ -} - -AttributePdu::~AttributePdu() -{ -} - -SimulationAddress& AttributePdu::getOriginatingSimulationAddress() -{ - return _originatingSimulationAddress; -} - -const SimulationAddress& AttributePdu::getOriginatingSimulationAddress() const -{ - return _originatingSimulationAddress; -} - -void AttributePdu::setOriginatingSimulationAddress(const SimulationAddress &pX) -{ - _originatingSimulationAddress = pX; -} - -int AttributePdu::getPadding1() const -{ - return _padding1; -} - -void AttributePdu::setPadding1(int pX) -{ - _padding1 = pX; -} - -short AttributePdu::getPadding2() const -{ - return _padding2; -} - -void AttributePdu::setPadding2(short pX) -{ - _padding2 = pX; -} - -unsigned char AttributePdu::getAttributeRecordPduType() const -{ - return _attributeRecordPduType; -} - -void AttributePdu::setAttributeRecordPduType(unsigned char pX) -{ - _attributeRecordPduType = pX; -} - -unsigned char AttributePdu::getAttributeRecordProtocolVersion() const -{ - return _attributeRecordProtocolVersion; -} - -void AttributePdu::setAttributeRecordProtocolVersion(unsigned char pX) -{ - _attributeRecordProtocolVersion = pX; -} - -unsigned int AttributePdu::getMasterAttributeRecordType() const -{ - return _masterAttributeRecordType; -} - -void AttributePdu::setMasterAttributeRecordType(unsigned int pX) -{ - _masterAttributeRecordType = pX; -} - -unsigned char AttributePdu::getActionCode() const -{ - return _actionCode; -} - -void AttributePdu::setActionCode(unsigned char pX) -{ - _actionCode = pX; -} - -char AttributePdu::getPadding3() const -{ - return _padding3; -} - -void AttributePdu::setPadding3(char pX) -{ - _padding3 = pX; -} - -unsigned short AttributePdu::getNumberAttributeRecordSet() const -{ - return _numberAttributeRecordSet; -} - -void AttributePdu::setNumberAttributeRecordSet(unsigned short pX) -{ - _numberAttributeRecordSet = pX; -} - -void AttributePdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _originatingSimulationAddress.marshal(dataStream); - dataStream << _padding1; - dataStream << _padding2; - dataStream << _attributeRecordPduType; - dataStream << _attributeRecordProtocolVersion; - dataStream << _masterAttributeRecordType; - dataStream << _actionCode; - dataStream << _padding3; - dataStream << _numberAttributeRecordSet; -} - -void AttributePdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingSimulationAddress.unmarshal(dataStream); - dataStream >> _padding1; - dataStream >> _padding2; - dataStream >> _attributeRecordPduType; - dataStream >> _attributeRecordProtocolVersion; - dataStream >> _masterAttributeRecordType; - dataStream >> _actionCode; - dataStream >> _padding3; - dataStream >> _numberAttributeRecordSet; -} - - -bool AttributePdu::operator ==(const AttributePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_originatingSimulationAddress == rhs._originatingSimulationAddress) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_attributeRecordPduType == rhs._attributeRecordPduType) ) ivarsEqual = false; - if( ! (_attributeRecordProtocolVersion == rhs._attributeRecordProtocolVersion) ) ivarsEqual = false; - if( ! (_masterAttributeRecordType == rhs._masterAttributeRecordType) ) ivarsEqual = false; - if( ! (_actionCode == rhs._actionCode) ) ivarsEqual = false; - if( ! (_padding3 == rhs._padding3) ) ivarsEqual = false; - if( ! (_numberAttributeRecordSet == rhs._numberAttributeRecordSet) ) ivarsEqual = false; - - return ivarsEqual; - } - -int AttributePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingSimulationAddress.getMarshalledSize(); // _originatingSimulationAddress - marshalSize = marshalSize + 4; // _padding1 - marshalSize = marshalSize + 2; // _padding2 - marshalSize = marshalSize + 1; // _attributeRecordPduType - marshalSize = marshalSize + 1; // _attributeRecordProtocolVersion - marshalSize = marshalSize + 4; // _masterAttributeRecordType - marshalSize = marshalSize + 1; // _actionCode - marshalSize = marshalSize + 1; // _padding3 - marshalSize = marshalSize + 2; // _numberAttributeRecordSet - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/AttributePdu.h b/src/dis7/AttributePdu.h deleted file mode 100644 index ff194bbf..00000000 --- a/src/dis7/AttributePdu.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Information about individual attributes for a particular entity, other object, or event may be communicated using an Attribute PDU. The Attribute PDU shall not be used to exchange data available in any other PDU except where explicitly mentioned in the PDU issuance instructions within this standard. See 5.3.6 for the information requirements and issuance and receipt rules for this PDU. Section 7.2.6. INCOMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT AttributePdu : public EntityInformationFamilyPdu -{ -protected: - /** This field shall identify the simulation issuing the Attribute PDU. It shall be represented by a Simulation Address record (see 6.2.79). */ - SimulationAddress _originatingSimulationAddress; - - /** Padding */ - int _padding1; - - /** Padding */ - short _padding2; - - /** This field shall represent the type of the PDU that is being extended or updated, if applicable. It shall be represented by an 8-bit enumeration. */ - unsigned char _attributeRecordPduType; - - /** This field shall indicate the Protocol Version associated with the Attribute Record PDU Type. It shall be represented by an 8-bit enumeration. */ - unsigned char _attributeRecordProtocolVersion; - - /** This field shall contain the Attribute record type of the Attribute records in the PDU if they all have the same Attribute record type. It shall be represented by a 32-bit enumeration. */ - unsigned int _masterAttributeRecordType; - - /** This field shall identify the action code applicable to this Attribute PDU. The Action Code shall apply to all Attribute records contained in the PDU. It shall be represented by an 8-bit enumeration. */ - unsigned char _actionCode; - - /** Padding */ - char _padding3; - - /** This field shall specify the number of Attribute Record Sets that make up the remainder of the PDU. It shall be represented by a 16-bit unsigned integer. */ - unsigned short _numberAttributeRecordSet; - - - public: - AttributePdu(); - virtual ~AttributePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getOriginatingSimulationAddress(); - const SimulationAddress& getOriginatingSimulationAddress() const; - void setOriginatingSimulationAddress(const SimulationAddress &pX); - - int getPadding1() const; - void setPadding1(int pX); - - short getPadding2() const; - void setPadding2(short pX); - - unsigned char getAttributeRecordPduType() const; - void setAttributeRecordPduType(unsigned char pX); - - unsigned char getAttributeRecordProtocolVersion() const; - void setAttributeRecordProtocolVersion(unsigned char pX); - - unsigned int getMasterAttributeRecordType() const; - void setMasterAttributeRecordType(unsigned int pX); - - unsigned char getActionCode() const; - void setActionCode(unsigned char pX); - - char getPadding3() const; - void setPadding3(char pX); - - unsigned short getNumberAttributeRecordSet() const; - void setNumberAttributeRecordSet(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const AttributePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/BeamAntennaPattern.cpp b/src/dis7/BeamAntennaPattern.cpp deleted file mode 100644 index a37cc85a..00000000 --- a/src/dis7/BeamAntennaPattern.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include - -using namespace DIS; - - -BeamAntennaPattern::BeamAntennaPattern(): - _beamDirection(), - _azimuthBeamwidth(0), - _elevationBeamwidth(0), - _referenceSystem(0), - _padding1(0), - _padding2(0), - _ez(0.0), - _ex(0.0), - _phase(0.0), - _padding3(0) -{ -} - -BeamAntennaPattern::~BeamAntennaPattern() -{ -} - -EulerAngles& BeamAntennaPattern::getBeamDirection() -{ - return _beamDirection; -} - -const EulerAngles& BeamAntennaPattern::getBeamDirection() const -{ - return _beamDirection; -} - -void BeamAntennaPattern::setBeamDirection(const EulerAngles &pX) -{ - _beamDirection = pX; -} - -float BeamAntennaPattern::getAzimuthBeamwidth() const -{ - return _azimuthBeamwidth; -} - -void BeamAntennaPattern::setAzimuthBeamwidth(float pX) -{ - _azimuthBeamwidth = pX; -} - -float BeamAntennaPattern::getElevationBeamwidth() const -{ - return _elevationBeamwidth; -} - -void BeamAntennaPattern::setElevationBeamwidth(float pX) -{ - _elevationBeamwidth = pX; -} - -float BeamAntennaPattern::getReferenceSystem() const -{ - return _referenceSystem; -} - -void BeamAntennaPattern::setReferenceSystem(float pX) -{ - _referenceSystem = pX; -} - -unsigned char BeamAntennaPattern::getPadding1() const -{ - return _padding1; -} - -void BeamAntennaPattern::setPadding1(unsigned char pX) -{ - _padding1 = pX; -} - -unsigned short BeamAntennaPattern::getPadding2() const -{ - return _padding2; -} - -void BeamAntennaPattern::setPadding2(unsigned short pX) -{ - _padding2 = pX; -} - -float BeamAntennaPattern::getEz() const -{ - return _ez; -} - -void BeamAntennaPattern::setEz(float pX) -{ - _ez = pX; -} - -float BeamAntennaPattern::getEx() const -{ - return _ex; -} - -void BeamAntennaPattern::setEx(float pX) -{ - _ex = pX; -} - -float BeamAntennaPattern::getPhase() const -{ - return _phase; -} - -void BeamAntennaPattern::setPhase(float pX) -{ - _phase = pX; -} - -unsigned int BeamAntennaPattern::getPadding3() const -{ - return _padding3; -} - -void BeamAntennaPattern::setPadding3(unsigned int pX) -{ - _padding3 = pX; -} - -void BeamAntennaPattern::marshal(DataStream& dataStream) const -{ - _beamDirection.marshal(dataStream); - dataStream << _azimuthBeamwidth; - dataStream << _elevationBeamwidth; - dataStream << _referenceSystem; - dataStream << _padding1; - dataStream << _padding2; - dataStream << _ez; - dataStream << _ex; - dataStream << _phase; - dataStream << _padding3; -} - -void BeamAntennaPattern::unmarshal(DataStream& dataStream) -{ - _beamDirection.unmarshal(dataStream); - dataStream >> _azimuthBeamwidth; - dataStream >> _elevationBeamwidth; - dataStream >> _referenceSystem; - dataStream >> _padding1; - dataStream >> _padding2; - dataStream >> _ez; - dataStream >> _ex; - dataStream >> _phase; - dataStream >> _padding3; -} - - -bool BeamAntennaPattern::operator ==(const BeamAntennaPattern& rhs) const - { - bool ivarsEqual = true; - - if( ! (_beamDirection == rhs._beamDirection) ) ivarsEqual = false; - if( ! (_azimuthBeamwidth == rhs._azimuthBeamwidth) ) ivarsEqual = false; - if( ! (_elevationBeamwidth == rhs._elevationBeamwidth) ) ivarsEqual = false; - if( ! (_referenceSystem == rhs._referenceSystem) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_ez == rhs._ez) ) ivarsEqual = false; - if( ! (_ex == rhs._ex) ) ivarsEqual = false; - if( ! (_phase == rhs._phase) ) ivarsEqual = false; - if( ! (_padding3 == rhs._padding3) ) ivarsEqual = false; - - return ivarsEqual; - } - -int BeamAntennaPattern::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _beamDirection.getMarshalledSize(); // _beamDirection - marshalSize = marshalSize + 4; // _azimuthBeamwidth - marshalSize = marshalSize + 4; // _elevationBeamwidth - marshalSize = marshalSize + 4; // _referenceSystem - marshalSize = marshalSize + 1; // _padding1 - marshalSize = marshalSize + 2; // _padding2 - marshalSize = marshalSize + 4; // _ez - marshalSize = marshalSize + 4; // _ex - marshalSize = marshalSize + 4; // _phase - marshalSize = marshalSize + 4; // _padding3 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/BeamAntennaPattern.h b/src/dis7/BeamAntennaPattern.h deleted file mode 100644 index 3137ab96..00000000 --- a/src/dis7/BeamAntennaPattern.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Used when the antenna pattern type field has a value of 1. Specifies the direction, pattern, and polarization of radiation from an antenna. Section 6.2.9.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT BeamAntennaPattern -{ -protected: - /** The rotation that transforms the reference coordinate sytem into the beam coordinate system. Either world coordinates or entity coordinates may be used as the reference coordinate system, as specified by the reference system field of the antenna pattern record. */ - EulerAngles _beamDirection; - - float _azimuthBeamwidth; - - float _elevationBeamwidth; - - float _referenceSystem; - - unsigned char _padding1; - - unsigned short _padding2; - - /** This field shall specify the magnitude of the Z-component (in beam coordinates) of the Electrical field at some arbitrary single point in the main beam and in the far field of the antenna. */ - float _ez; - - /** This field shall specify the magnitude of the X-component (in beam coordinates) of the Electri- cal field at some arbitrary single point in the main beam and in the far field of the antenna. */ - float _ex; - - /** This field shall specify the phase angle between EZ and EX in radians. If fully omni-direc- tional antenna is modeled using beam pattern type one, the omni-directional antenna shall be repre- sented by beam direction Euler angles psi, theta, and phi of zero, an azimuth beamwidth of 2PI, and an elevation beamwidth of PI */ - float _phase; - - /** padding */ - unsigned int _padding3; - - - public: - BeamAntennaPattern(); - virtual ~BeamAntennaPattern(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EulerAngles& getBeamDirection(); - const EulerAngles& getBeamDirection() const; - void setBeamDirection(const EulerAngles &pX); - - float getAzimuthBeamwidth() const; - void setAzimuthBeamwidth(float pX); - - float getElevationBeamwidth() const; - void setElevationBeamwidth(float pX); - - float getReferenceSystem() const; - void setReferenceSystem(float pX); - - unsigned char getPadding1() const; - void setPadding1(unsigned char pX); - - unsigned short getPadding2() const; - void setPadding2(unsigned short pX); - - float getEz() const; - void setEz(float pX); - - float getEx() const; - void setEx(float pX); - - float getPhase() const; - void setPhase(float pX); - - unsigned int getPadding3() const; - void setPadding3(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const BeamAntennaPattern& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/BeamData.cpp b/src/dis7/BeamData.cpp deleted file mode 100644 index 8c86b4bc..00000000 --- a/src/dis7/BeamData.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -BeamData::BeamData(): - _beamAzimuthCenter(0.0), - _beamAzimuthSweep(0.0), - _beamElevationCenter(0.0), - _beamElevationSweep(0.0), - _beamSweepSync(0.0) -{ -} - -BeamData::~BeamData() -{ -} - -float BeamData::getBeamAzimuthCenter() const -{ - return _beamAzimuthCenter; -} - -void BeamData::setBeamAzimuthCenter(float pX) -{ - _beamAzimuthCenter = pX; -} - -float BeamData::getBeamAzimuthSweep() const -{ - return _beamAzimuthSweep; -} - -void BeamData::setBeamAzimuthSweep(float pX) -{ - _beamAzimuthSweep = pX; -} - -float BeamData::getBeamElevationCenter() const -{ - return _beamElevationCenter; -} - -void BeamData::setBeamElevationCenter(float pX) -{ - _beamElevationCenter = pX; -} - -float BeamData::getBeamElevationSweep() const -{ - return _beamElevationSweep; -} - -void BeamData::setBeamElevationSweep(float pX) -{ - _beamElevationSweep = pX; -} - -float BeamData::getBeamSweepSync() const -{ - return _beamSweepSync; -} - -void BeamData::setBeamSweepSync(float pX) -{ - _beamSweepSync = pX; -} - -void BeamData::marshal(DataStream& dataStream) const -{ - dataStream << _beamAzimuthCenter; - dataStream << _beamAzimuthSweep; - dataStream << _beamElevationCenter; - dataStream << _beamElevationSweep; - dataStream << _beamSweepSync; -} - -void BeamData::unmarshal(DataStream& dataStream) -{ - dataStream >> _beamAzimuthCenter; - dataStream >> _beamAzimuthSweep; - dataStream >> _beamElevationCenter; - dataStream >> _beamElevationSweep; - dataStream >> _beamSweepSync; -} - - -bool BeamData::operator ==(const BeamData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_beamAzimuthCenter == rhs._beamAzimuthCenter) ) ivarsEqual = false; - if( ! (_beamAzimuthSweep == rhs._beamAzimuthSweep) ) ivarsEqual = false; - if( ! (_beamElevationCenter == rhs._beamElevationCenter) ) ivarsEqual = false; - if( ! (_beamElevationSweep == rhs._beamElevationSweep) ) ivarsEqual = false; - if( ! (_beamSweepSync == rhs._beamSweepSync) ) ivarsEqual = false; - - return ivarsEqual; - } - -int BeamData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _beamAzimuthCenter - marshalSize = marshalSize + 4; // _beamAzimuthSweep - marshalSize = marshalSize + 4; // _beamElevationCenter - marshalSize = marshalSize + 4; // _beamElevationSweep - marshalSize = marshalSize + 4; // _beamSweepSync - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/BeamData.h b/src/dis7/BeamData.h deleted file mode 100644 index 2d29f95b..00000000 --- a/src/dis7/BeamData.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Describes the scan volue of an emitter beam. Section 6.2.13. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT BeamData -{ -protected: - /** Specifies the beam azimuth an elevation centers and corresponding half-angles to describe the scan volume */ - float _beamAzimuthCenter; - - /** Specifies the beam azimuth sweep to determine scan volume */ - float _beamAzimuthSweep; - - /** Specifies the beam elevation center to determine scan volume */ - float _beamElevationCenter; - - /** Specifies the beam elevation sweep to determine scan volume */ - float _beamElevationSweep; - - /** allows receiver to synchronize its regenerated scan pattern to that of the emmitter. Specifies the percentage of time a scan is through its pattern from its origion. */ - float _beamSweepSync; - - - public: - BeamData(); - virtual ~BeamData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getBeamAzimuthCenter() const; - void setBeamAzimuthCenter(float pX); - - float getBeamAzimuthSweep() const; - void setBeamAzimuthSweep(float pX); - - float getBeamElevationCenter() const; - void setBeamElevationCenter(float pX); - - float getBeamElevationSweep() const; - void setBeamElevationSweep(float pX); - - float getBeamSweepSync() const; - void setBeamSweepSync(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const BeamData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/BeamStatus.cpp b/src/dis7/BeamStatus.cpp deleted file mode 100644 index 7ab7807d..00000000 --- a/src/dis7/BeamStatus.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include - -using namespace DIS; - - -BeamStatus::BeamStatus(): - _beamState(0) -{ -} - -BeamStatus::~BeamStatus() -{ -} - -unsigned char BeamStatus::getBeamState() const -{ - return _beamState; -} - -void BeamStatus::setBeamState(unsigned char pX) -{ - _beamState = pX; -} - -void BeamStatus::marshal(DataStream& dataStream) const -{ - dataStream << _beamState; -} - -void BeamStatus::unmarshal(DataStream& dataStream) -{ - dataStream >> _beamState; -} - - -bool BeamStatus::operator ==(const BeamStatus& rhs) const - { - bool ivarsEqual = true; - - if( ! (_beamState == rhs._beamState) ) ivarsEqual = false; - - return ivarsEqual; - } - -int BeamStatus::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _beamState - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/BeamStatus.h b/src/dis7/BeamStatus.h deleted file mode 100644 index e7f5fef8..00000000 --- a/src/dis7/BeamStatus.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Information related to the status of a beam. This is contained in the beam status field of the electromagnitec emission PDU. The first bit determines whether the beam is active (0) or deactivated (1). - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT BeamStatus -{ -protected: - /** First bit zero means beam is active, first bit = 1 means deactivated. The rest is padding. */ - unsigned char _beamState; - - - public: - BeamStatus(); - virtual ~BeamStatus(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getBeamState() const; - void setBeamState(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const BeamStatus& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/BlankingSector.cpp b/src/dis7/BlankingSector.cpp deleted file mode 100644 index e589ab30..00000000 --- a/src/dis7/BlankingSector.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include - -using namespace DIS; - - -BlankingSector::BlankingSector(): - _recordType(3500), - _recordLength(0), - _emitterNumber(0), - _beamNumber(0), - _stateIndicator(0), - _leftAzimuth(0.0), - _rightAzimuth(0.0), - _lowerElevation(0.0), - _upperElevation(0.0), - _residualPower(0.0) -{ -} - -BlankingSector::~BlankingSector() -{ -} - -unsigned int BlankingSector::getRecordType() const -{ - return _recordType; -} - -void BlankingSector::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short BlankingSector::getRecordLength() const -{ - return _recordLength; -} - -void BlankingSector::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned char BlankingSector::getEmitterNumber() const -{ - return _emitterNumber; -} - -void BlankingSector::setEmitterNumber(unsigned char pX) -{ - _emitterNumber = pX; -} - -unsigned char BlankingSector::getBeamNumber() const -{ - return _beamNumber; -} - -void BlankingSector::setBeamNumber(unsigned char pX) -{ - _beamNumber = pX; -} - -unsigned char BlankingSector::getStateIndicator() const -{ - return _stateIndicator; -} - -void BlankingSector::setStateIndicator(unsigned char pX) -{ - _stateIndicator = pX; -} - -float BlankingSector::getLeftAzimuth() const -{ - return _leftAzimuth; -} - -void BlankingSector::setLeftAzimuth(float pX) -{ - _leftAzimuth = pX; -} - -float BlankingSector::getRightAzimuth() const -{ - return _rightAzimuth; -} - -void BlankingSector::setRightAzimuth(float pX) -{ - _rightAzimuth = pX; -} - -float BlankingSector::getLowerElevation() const -{ - return _lowerElevation; -} - -void BlankingSector::setLowerElevation(float pX) -{ - _lowerElevation = pX; -} - -float BlankingSector::getUpperElevation() const -{ - return _upperElevation; -} - -void BlankingSector::setUpperElevation(float pX) -{ - _upperElevation = pX; -} - -float BlankingSector::getResidualPower() const -{ - return _residualPower; -} - -void BlankingSector::setResidualPower(float pX) -{ - _residualPower = pX; -} - -void BlankingSector::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _emitterNumber; - dataStream << _beamNumber; - dataStream << _stateIndicator; - dataStream << _leftAzimuth; - dataStream << _rightAzimuth; - dataStream << _lowerElevation; - dataStream << _upperElevation; - dataStream << _residualPower; -} - -void BlankingSector::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _emitterNumber; - dataStream >> _beamNumber; - dataStream >> _stateIndicator; - dataStream >> _leftAzimuth; - dataStream >> _rightAzimuth; - dataStream >> _lowerElevation; - dataStream >> _upperElevation; - dataStream >> _residualPower; -} - - -bool BlankingSector::operator ==(const BlankingSector& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_emitterNumber == rhs._emitterNumber) ) ivarsEqual = false; - if( ! (_beamNumber == rhs._beamNumber) ) ivarsEqual = false; - if( ! (_stateIndicator == rhs._stateIndicator) ) ivarsEqual = false; - if( ! (_leftAzimuth == rhs._leftAzimuth) ) ivarsEqual = false; - if( ! (_rightAzimuth == rhs._rightAzimuth) ) ivarsEqual = false; - if( ! (_lowerElevation == rhs._lowerElevation) ) ivarsEqual = false; - if( ! (_upperElevation == rhs._upperElevation) ) ivarsEqual = false; - if( ! (_residualPower == rhs._residualPower) ) ivarsEqual = false; - - return ivarsEqual; - } - -int BlankingSector::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 1; // _emitterNumber - marshalSize = marshalSize + 1; // _beamNumber - marshalSize = marshalSize + 1; // _stateIndicator - marshalSize = marshalSize + 4; // _leftAzimuth - marshalSize = marshalSize + 4; // _rightAzimuth - marshalSize = marshalSize + 4; // _lowerElevation - marshalSize = marshalSize + 4; // _upperElevation - marshalSize = marshalSize + 4; // _residualPower - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/BlankingSector.h b/src/dis7/BlankingSector.h deleted file mode 100644 index bf2cbd81..00000000 --- a/src/dis7/BlankingSector.h +++ /dev/null @@ -1,112 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The Blanking Sector attribute record may be used to convey persistent areas within a scan volume where emitter power for a specific active emitter beam is reduced to an insignificant value. Section 6.2.12 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT BlankingSector -{ -protected: - unsigned int _recordType; - - unsigned short _recordLength; - - unsigned char _emitterNumber; - - unsigned char _beamNumber; - - unsigned char _stateIndicator; - - float _leftAzimuth; - - float _rightAzimuth; - - float _lowerElevation; - - float _upperElevation; - - float _residualPower; - - - public: - BlankingSector(); - virtual ~BlankingSector(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned char getEmitterNumber() const; - void setEmitterNumber(unsigned char pX); - - unsigned char getBeamNumber() const; - void setBeamNumber(unsigned char pX); - - unsigned char getStateIndicator() const; - void setStateIndicator(unsigned char pX); - - float getLeftAzimuth() const; - void setLeftAzimuth(float pX); - - float getRightAzimuth() const; - void setRightAzimuth(float pX); - - float getLowerElevation() const; - void setLowerElevation(float pX); - - float getUpperElevation() const; - void setUpperElevation(float pX); - - float getResidualPower() const; - void setResidualPower(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const BlankingSector& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CMakeLists.txt b/src/dis7/CMakeLists.txt index c922d3a4..2fc0a8f1 100644 --- a/src/dis7/CMakeLists.txt +++ b/src/dis7/CMakeLists.txt @@ -1,374 +1,11 @@ add_subdirectory(utils) - -# Create list of all headers -set(dis7_hdr - AcknowledgePdu.h - AcknowledgeReliablePdu.h - AcousticEmitter.h - ActionRequestPdu.h - ActionRequestReliablePdu.h - ActionResponsePdu.h - ActionResponseReliablePdu.h - AggregateIdentifier.h - AggregateMarking.h - AggregateType.h - AngleDeception.h - AngularVelocityVector.h - AntennaLocation.h - ArealObjectStatePdu.h - ArticulatedParts.h - Association.h - AttachedParts.h - Attribute.h - AttributePdu.h - BeamAntennaPattern.h - BeamData.h - BeamStatus.h - BlankingSector.h - ClockTime.h - CollisionElasticPdu.h - CollisionPdu.h - CommentPdu.h - CommentReliablePdu.h - CommunicationsNodeID.h - CreateEntityPdu.h - CreateEntityReliablePdu.h - DataPdu.h - DataQueryDatumSpecification.h - DataQueryPdu.h - DataQueryReliablePdu.h - DataReliablePdu.h - DatumSpecification.h - DeadReckoningParameters.h - DesignatorPdu.h - DetonationPdu.h - DirectedEnergyAreaAimpoint.h - DirectedEnergyDamage.h - DirectedEnergyFirePdu.h - DirectedEnergyPrecisionAimpoint.h - DirectedEnergyTargetEnergyDeposition.h - DistributedEmissionsFamilyPdu.h - EEFundamentalParameterData.h - EightByteChunk.h - ElectromagneticEmissionBeamData.h - ElectromagneticEmissionsPdu.h - ElectromagneticEmissionSystemData.h - EmitterSystem.h - EngineFuel.h - EngineFuelReload.h - EntityAssociation.h - EntityDamageStatusPdu.h - EntityID.h - EntityInformationFamilyPdu.h - EntityManagementFamilyPdu.h - EntityMarking.h - EntityStatePdu.h - EntityStateUpdatePdu.h - EntityType.h - EntityTypeVP.h - EnvironmentGeneral.h - Environment.h - EnvironmentType.h - EulerAngles.h - EventIdentifier.h - EventIdentifierLiveEntity.h - EventReportPdu.h - EventReportReliablePdu.h - ExpendableDescriptor.h - Expendable.h - ExpendableReload.h - ExplosionDescriptor.h - FalseTargetsAttribute.h - FastEntityStatePdu.h - FirePdu.h - FixedDatum.h - FourByteChunk.h - FundamentalOperationalData.h - GridAxis.h - GroupIdentifier.h - IffDataSpecification.h - IFFFundamentalParameterData.h - IFFPdu.h - IntercomCommunicationsParameters.h - IntercomIdentifier.h - IntercomSignalPdu.h - IOCommunicationsNode.h - IOEffect.h - IsPartOfPdu.h - JammingTechnique.h - LaunchedMunitionRecord.h - LayerHeader.h - LinearObjectStatePdu.h - LinearSegmentParameter.h - LiveEntityIdentifier.h - LiveEntityPdu.h - LiveSimulationAddress.h - LogisticsFamilyPdu.h - MineEntityIdentifier.h - MinefieldFamilyPdu.h - MinefieldIdentifier.h - MinefieldResponseNackPdu.h - MinefieldStatePdu.h - ModulationParameters.h - ModulationType.h - MunitionDescriptor.h - Munition.h - MunitionReload.h - NamedLocationIdentification.h - ObjectIdentifier.h - ObjectType.h - OwnershipStatus.h - PduContainer.h - Pdu.h - PduHeader.h - PduStatus.h - PduSuperclass.h - PointObjectStatePdu.h - PropulsionSystemData.h - RadioCommunicationsFamilyPdu.h - RadioIdentifier.h - RadioType.h - ReceiverPdu.h - RecordQueryReliablePdu.h - RecordQuerySpecification.h - RecordSpecificationElement.h - RecordSpecification.h - Relationship.h - RemoveEntityPdu.h - RemoveEntityReliablePdu.h - RepairCompletePdu.h - RepairResponsePdu.h - ResupplyOfferPdu.h - ResupplyReceivedPdu.h - SecondaryOperationalData.h - SeesPdu.h - Sensor.h - SeparationVP.h - ServiceRequestPdu.h - SetDataPdu.h - SetDataReliablePdu.h - SimulationAddress.h - SimulationIdentifier.h - SimulationManagementFamilyPdu.h - SimulationManagementPduHeader.h - SimulationManagementWithReliabilityFamilyPdu.h - StandardVariableSpecification.h - StartResumePdu.h - StartResumeReliablePdu.h - StopFreezePdu.h - StopFreezeReliablePdu.h - StorageFuel.h - StorageFuelReload.h - SupplyQuantity.h - SyntheticEnvironmentFamilyPdu.h - SystemIdentifier.h - TotalRecordSets.h - TrackJamData.h - TwoByteChunk.h - UAFundamentalParameter.h - UaPdu.h - UnattachedIdentifier.h - UnsignedDISInteger.h - VariableDatum.h - VariableParameter.h - VariableTransmitterParameters.h - Vector2Float.h - Vector3Double.h - Vector3Float.h - VectoringNozzleSystem.h - WarfareFamilyPdu.h -) - -# Create list of all source files -set(dis7_src - AcknowledgePdu.cpp - AcknowledgeReliablePdu.cpp - AcousticEmitter.cpp - ActionRequestPdu.cpp - ActionRequestReliablePdu.cpp - ActionResponsePdu.cpp - ActionResponseReliablePdu.cpp - AggregateIdentifier.cpp - AggregateMarking.cpp - AggregateType.cpp - AngleDeception.cpp - AngularVelocityVector.cpp - AntennaLocation.cpp - ArealObjectStatePdu.cpp - ArticulatedParts.cpp - Association.cpp - AttachedParts.cpp - Attribute.cpp - AttributePdu.cpp - BeamAntennaPattern.cpp - BeamData.cpp - BeamStatus.cpp - BlankingSector.cpp - ClockTime.cpp - CollisionElasticPdu.cpp - CollisionPdu.cpp - CommentPdu.cpp - CommentReliablePdu.cpp - CommunicationsNodeID.cpp - CreateEntityPdu.cpp - CreateEntityReliablePdu.cpp - DataPdu.cpp - DataQueryDatumSpecification.cpp - DataQueryPdu.cpp - DataQueryReliablePdu.cpp - DataReliablePdu.cpp - DatumSpecification.cpp - DeadReckoningParameters.cpp - DesignatorPdu.cpp - DetonationPdu.cpp - DirectedEnergyAreaAimpoint.cpp - DirectedEnergyDamage.cpp - DirectedEnergyFirePdu.cpp - DirectedEnergyPrecisionAimpoint.cpp - DirectedEnergyTargetEnergyDeposition.cpp - DistributedEmissionsFamilyPdu.cpp - EEFundamentalParameterData.cpp - EightByteChunk.cpp - ElectromagneticEmissionBeamData.cpp - ElectromagneticEmissionsPdu.cpp - ElectromagneticEmissionSystemData.cpp - EmitterSystem.cpp - EngineFuel.cpp - EngineFuelReload.cpp - EntityAssociation.cpp - EntityDamageStatusPdu.cpp - EntityID.cpp - EntityInformationFamilyPdu.cpp - EntityManagementFamilyPdu.cpp - EntityMarking.cpp - EntityStatePdu.cpp - EntityStateUpdatePdu.cpp - EntityType.cpp - EntityTypeVP.cpp - Environment.cpp - EnvironmentGeneral.cpp - EnvironmentType.cpp - EulerAngles.cpp - EventIdentifier.cpp - EventIdentifierLiveEntity.cpp - EventReportPdu.cpp - EventReportReliablePdu.cpp - Expendable.cpp - ExpendableDescriptor.cpp - ExpendableReload.cpp - ExplosionDescriptor.cpp - FalseTargetsAttribute.cpp - FastEntityStatePdu.cpp - FirePdu.cpp - FixedDatum.cpp - FourByteChunk.cpp - FundamentalOperationalData.cpp - GridAxis.cpp - GroupIdentifier.cpp - IffDataSpecification.cpp - IFFFundamentalParameterData.cpp - IFFPdu.cpp - IntercomCommunicationsParameters.cpp - IntercomIdentifier.cpp - IntercomSignalPdu.cpp - IOCommunicationsNode.cpp - IOEffect.cpp - IsPartOfPdu.cpp - JammingTechnique.cpp - LaunchedMunitionRecord.cpp - LayerHeader.cpp - LinearObjectStatePdu.cpp - LinearSegmentParameter.cpp - LiveEntityIdentifier.cpp - LiveEntityPdu.cpp - LiveSimulationAddress.cpp - LogisticsFamilyPdu.cpp - MineEntityIdentifier.cpp - MinefieldFamilyPdu.cpp - MinefieldIdentifier.cpp - MinefieldResponseNackPdu.cpp - MinefieldStatePdu.cpp - ModulationParameters.cpp - ModulationType.cpp - Munition.cpp - MunitionDescriptor.cpp - MunitionReload.cpp - NamedLocationIdentification.cpp - ObjectIdentifier.cpp - ObjectType.cpp - OwnershipStatus.cpp - PduContainer.cpp - Pdu.cpp - PduHeader.cpp - PduStatus.cpp - PduSuperclass.cpp - PointObjectStatePdu.cpp - PropulsionSystemData.cpp - RadioCommunicationsFamilyPdu.cpp - RadioIdentifier.cpp - RadioType.cpp - ReceiverPdu.cpp - RecordQueryReliablePdu.cpp - RecordQuerySpecification.cpp - RecordSpecification.cpp - RecordSpecificationElement.cpp - Relationship.cpp - RemoveEntityPdu.cpp - RemoveEntityReliablePdu.cpp - RepairCompletePdu.cpp - RepairResponsePdu.cpp - ResupplyOfferPdu.cpp - ResupplyReceivedPdu.cpp - SecondaryOperationalData.cpp - SeesPdu.cpp - Sensor.cpp - SeparationVP.cpp - ServiceRequestPdu.cpp - SetDataPdu.cpp - SetDataReliablePdu.cpp - SimulationAddress.cpp - SimulationIdentifier.cpp - SimulationManagementFamilyPdu.cpp - SimulationManagementPduHeader.cpp - SimulationManagementWithReliabilityFamilyPdu.cpp - StandardVariableSpecification.cpp - StartResumePdu.cpp - StartResumeReliablePdu.cpp - StopFreezePdu.cpp - StopFreezeReliablePdu.cpp - StorageFuel.cpp - StorageFuelReload.cpp - SupplyQuantity.cpp - SyntheticEnvironmentFamilyPdu.cpp - SystemIdentifier.cpp - TotalRecordSets.cpp - TrackJamData.cpp - TwoByteChunk.cpp - UAFundamentalParameter.cpp - UaPdu.cpp - UnattachedIdentifier.cpp - UnsignedDISInteger.cpp - VariableDatum.cpp - VariableParameter.cpp - VariableTransmitterParameters.cpp - Vector2Float.cpp - Vector3Double.cpp - Vector3Float.cpp - VectoringNozzleSystem.cpp - WarfareFamilyPdu.cpp -) - -# CMake < 3.16 requires target_sources to be specified as -# absolute paths if not in the same directory as the target -# definition. If cmake_minimum_required is ever changed to -# be >= 16, this line can be removed. -list(TRANSFORM dis7_src PREPEND "${CMAKE_CURRENT_LIST_DIR}/") - -include(GenerateExportHeader) -generate_export_header(OpenDIS7) -list(APPEND dis7_hdr "${CMAKE_CURRENT_BINARY_DIR}/opendis7_export.h") - -target_sources(OpenDIS7 PRIVATE ${dis7_src}) - -install(FILES ${dis7_hdr} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dis7) +add_subdirectory(distributed_emissions) +add_subdirectory(entity_information) +add_subdirectory(entity_management) +add_subdirectory(logistics) +add_subdirectory(minefield) +add_subdirectory(radio_communications) +add_subdirectory(simulation_management) +add_subdirectory(simulation_management_with_reliability) +add_subdirectory(synthetic_environment) +add_subdirectory(warfare) diff --git a/src/dis7/ClockTime.cpp b/src/dis7/ClockTime.cpp deleted file mode 100644 index eabc4612..00000000 --- a/src/dis7/ClockTime.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -ClockTime::ClockTime(): - _hour(0), - _timePastHour(0) -{ -} - -ClockTime::~ClockTime() -{ -} - -unsigned int ClockTime::getHour() const -{ - return _hour; -} - -void ClockTime::setHour(unsigned int pX) -{ - _hour = pX; -} - -unsigned int ClockTime::getTimePastHour() const -{ - return _timePastHour; -} - -void ClockTime::setTimePastHour(unsigned int pX) -{ - _timePastHour = pX; -} - -void ClockTime::marshal(DataStream& dataStream) const -{ - dataStream << _hour; - dataStream << _timePastHour; -} - -void ClockTime::unmarshal(DataStream& dataStream) -{ - dataStream >> _hour; - dataStream >> _timePastHour; -} - - -bool ClockTime::operator ==(const ClockTime& rhs) const - { - bool ivarsEqual = true; - - if( ! (_hour == rhs._hour) ) ivarsEqual = false; - if( ! (_timePastHour == rhs._timePastHour) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ClockTime::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _hour - marshalSize = marshalSize + 4; // _timePastHour - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ClockTime.h b/src/dis7/ClockTime.h deleted file mode 100644 index a7d735ad..00000000 --- a/src/dis7/ClockTime.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Time measurements that exceed one hour are represented by this record. The first field is the hours since the unix epoch (Jan 1 1970, used by most Unix systems and java) and the second field the timestamp units since the top of the hour. Section 6.2.16 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ClockTime -{ -protected: - /** Hours in UTC */ - unsigned int _hour; - - /** Time past the hour */ - unsigned int _timePastHour; - - - public: - ClockTime(); - virtual ~ClockTime(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getHour() const; - void setHour(unsigned int pX); - - unsigned int getTimePastHour() const; - void setTimePastHour(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ClockTime& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CollisionElasticPdu.cpp b/src/dis7/CollisionElasticPdu.cpp deleted file mode 100644 index fa99bf92..00000000 --- a/src/dis7/CollisionElasticPdu.cpp +++ /dev/null @@ -1,329 +0,0 @@ -#include - -using namespace DIS; - - -CollisionElasticPdu::CollisionElasticPdu() : EntityInformationFamilyPdu(), - _issuingEntityID(), - _collidingEntityID(), - _collisionEventID(), - _pad(0), - _contactVelocity(), - _mass(0.0), - _locationOfImpact(), - _collisionIntermediateResultXX(0.0), - _collisionIntermediateResultXY(0.0), - _collisionIntermediateResultXZ(0.0), - _collisionIntermediateResultYY(0.0), - _collisionIntermediateResultYZ(0.0), - _collisionIntermediateResultZZ(0.0), - _unitSurfaceNormal(), - _coefficientOfRestitution(0.0) -{ - setPduType( 66 ); - setProtocolFamily( 1 ); -} - -CollisionElasticPdu::~CollisionElasticPdu() -{ -} - -EntityID& CollisionElasticPdu::getIssuingEntityID() -{ - return _issuingEntityID; -} - -const EntityID& CollisionElasticPdu::getIssuingEntityID() const -{ - return _issuingEntityID; -} - -void CollisionElasticPdu::setIssuingEntityID(const EntityID &pX) -{ - _issuingEntityID = pX; -} - -EntityID& CollisionElasticPdu::getCollidingEntityID() -{ - return _collidingEntityID; -} - -const EntityID& CollisionElasticPdu::getCollidingEntityID() const -{ - return _collidingEntityID; -} - -void CollisionElasticPdu::setCollidingEntityID(const EntityID &pX) -{ - _collidingEntityID = pX; -} - -EventIdentifier& CollisionElasticPdu::getCollisionEventID() -{ - return _collisionEventID; -} - -const EventIdentifier& CollisionElasticPdu::getCollisionEventID() const -{ - return _collisionEventID; -} - -void CollisionElasticPdu::setCollisionEventID(const EventIdentifier &pX) -{ - _collisionEventID = pX; -} - -short CollisionElasticPdu::getPad() const -{ - return _pad; -} - -void CollisionElasticPdu::setPad(short pX) -{ - _pad = pX; -} - -Vector3Float& CollisionElasticPdu::getContactVelocity() -{ - return _contactVelocity; -} - -const Vector3Float& CollisionElasticPdu::getContactVelocity() const -{ - return _contactVelocity; -} - -void CollisionElasticPdu::setContactVelocity(const Vector3Float &pX) -{ - _contactVelocity = pX; -} - -float CollisionElasticPdu::getMass() const -{ - return _mass; -} - -void CollisionElasticPdu::setMass(float pX) -{ - _mass = pX; -} - -Vector3Float& CollisionElasticPdu::getLocationOfImpact() -{ - return _locationOfImpact; -} - -const Vector3Float& CollisionElasticPdu::getLocationOfImpact() const -{ - return _locationOfImpact; -} - -void CollisionElasticPdu::setLocationOfImpact(const Vector3Float &pX) -{ - _locationOfImpact = pX; -} - -float CollisionElasticPdu::getCollisionIntermediateResultXX() const -{ - return _collisionIntermediateResultXX; -} - -void CollisionElasticPdu::setCollisionIntermediateResultXX(float pX) -{ - _collisionIntermediateResultXX = pX; -} - -float CollisionElasticPdu::getCollisionIntermediateResultXY() const -{ - return _collisionIntermediateResultXY; -} - -void CollisionElasticPdu::setCollisionIntermediateResultXY(float pX) -{ - _collisionIntermediateResultXY = pX; -} - -float CollisionElasticPdu::getCollisionIntermediateResultXZ() const -{ - return _collisionIntermediateResultXZ; -} - -void CollisionElasticPdu::setCollisionIntermediateResultXZ(float pX) -{ - _collisionIntermediateResultXZ = pX; -} - -float CollisionElasticPdu::getCollisionIntermediateResultYY() const -{ - return _collisionIntermediateResultYY; -} - -void CollisionElasticPdu::setCollisionIntermediateResultYY(float pX) -{ - _collisionIntermediateResultYY = pX; -} - -float CollisionElasticPdu::getCollisionIntermediateResultYZ() const -{ - return _collisionIntermediateResultYZ; -} - -void CollisionElasticPdu::setCollisionIntermediateResultYZ(float pX) -{ - _collisionIntermediateResultYZ = pX; -} - -float CollisionElasticPdu::getCollisionIntermediateResultZZ() const -{ - return _collisionIntermediateResultZZ; -} - -void CollisionElasticPdu::setCollisionIntermediateResultZZ(float pX) -{ - _collisionIntermediateResultZZ = pX; -} - -Vector3Float& CollisionElasticPdu::getUnitSurfaceNormal() -{ - return _unitSurfaceNormal; -} - -const Vector3Float& CollisionElasticPdu::getUnitSurfaceNormal() const -{ - return _unitSurfaceNormal; -} - -void CollisionElasticPdu::setUnitSurfaceNormal(const Vector3Float &pX) -{ - _unitSurfaceNormal = pX; -} - -float CollisionElasticPdu::getCoefficientOfRestitution() const -{ - return _coefficientOfRestitution; -} - -void CollisionElasticPdu::setCoefficientOfRestitution(float pX) -{ - _coefficientOfRestitution = pX; -} - -void CollisionElasticPdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _issuingEntityID.marshal(dataStream); - _collidingEntityID.marshal(dataStream); - _collisionEventID.marshal(dataStream); - dataStream << _pad; - _contactVelocity.marshal(dataStream); - dataStream << _mass; - _locationOfImpact.marshal(dataStream); - dataStream << _collisionIntermediateResultXX; - dataStream << _collisionIntermediateResultXY; - dataStream << _collisionIntermediateResultXZ; - dataStream << _collisionIntermediateResultYY; - dataStream << _collisionIntermediateResultYZ; - dataStream << _collisionIntermediateResultZZ; - _unitSurfaceNormal.marshal(dataStream); - dataStream << _coefficientOfRestitution; -} - -void CollisionElasticPdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _issuingEntityID.unmarshal(dataStream); - _collidingEntityID.unmarshal(dataStream); - _collisionEventID.unmarshal(dataStream); - dataStream >> _pad; - _contactVelocity.unmarshal(dataStream); - dataStream >> _mass; - _locationOfImpact.unmarshal(dataStream); - dataStream >> _collisionIntermediateResultXX; - dataStream >> _collisionIntermediateResultXY; - dataStream >> _collisionIntermediateResultXZ; - dataStream >> _collisionIntermediateResultYY; - dataStream >> _collisionIntermediateResultYZ; - dataStream >> _collisionIntermediateResultZZ; - _unitSurfaceNormal.unmarshal(dataStream); - dataStream >> _coefficientOfRestitution; -} - - -bool CollisionElasticPdu::operator ==(const CollisionElasticPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_issuingEntityID == rhs._issuingEntityID) ) ivarsEqual = false; - if( ! (_collidingEntityID == rhs._collidingEntityID) ) ivarsEqual = false; - if( ! (_collisionEventID == rhs._collisionEventID) ) ivarsEqual = false; - if( ! (_pad == rhs._pad) ) ivarsEqual = false; - if( ! (_contactVelocity == rhs._contactVelocity) ) ivarsEqual = false; - if( ! (_mass == rhs._mass) ) ivarsEqual = false; - if( ! (_locationOfImpact == rhs._locationOfImpact) ) ivarsEqual = false; - if( ! (_collisionIntermediateResultXX == rhs._collisionIntermediateResultXX) ) ivarsEqual = false; - if( ! (_collisionIntermediateResultXY == rhs._collisionIntermediateResultXY) ) ivarsEqual = false; - if( ! (_collisionIntermediateResultXZ == rhs._collisionIntermediateResultXZ) ) ivarsEqual = false; - if( ! (_collisionIntermediateResultYY == rhs._collisionIntermediateResultYY) ) ivarsEqual = false; - if( ! (_collisionIntermediateResultYZ == rhs._collisionIntermediateResultYZ) ) ivarsEqual = false; - if( ! (_collisionIntermediateResultZZ == rhs._collisionIntermediateResultZZ) ) ivarsEqual = false; - if( ! (_unitSurfaceNormal == rhs._unitSurfaceNormal) ) ivarsEqual = false; - if( ! (_coefficientOfRestitution == rhs._coefficientOfRestitution) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CollisionElasticPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _issuingEntityID.getMarshalledSize(); // _issuingEntityID - marshalSize = marshalSize + _collidingEntityID.getMarshalledSize(); // _collidingEntityID - marshalSize = marshalSize + _collisionEventID.getMarshalledSize(); // _collisionEventID - marshalSize = marshalSize + 2; // _pad - marshalSize = marshalSize + _contactVelocity.getMarshalledSize(); // _contactVelocity - marshalSize = marshalSize + 4; // _mass - marshalSize = marshalSize + _locationOfImpact.getMarshalledSize(); // _locationOfImpact - marshalSize = marshalSize + 4; // _collisionIntermediateResultXX - marshalSize = marshalSize + 4; // _collisionIntermediateResultXY - marshalSize = marshalSize + 4; // _collisionIntermediateResultXZ - marshalSize = marshalSize + 4; // _collisionIntermediateResultYY - marshalSize = marshalSize + 4; // _collisionIntermediateResultYZ - marshalSize = marshalSize + 4; // _collisionIntermediateResultZZ - marshalSize = marshalSize + _unitSurfaceNormal.getMarshalledSize(); // _unitSurfaceNormal - marshalSize = marshalSize + 4; // _coefficientOfRestitution - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CollisionElasticPdu.h b/src/dis7/CollisionElasticPdu.h deleted file mode 100644 index c3b016d4..00000000 --- a/src/dis7/CollisionElasticPdu.h +++ /dev/null @@ -1,165 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Information about elastic collisions in a DIS exercise shall be communicated using a Collision-Elastic PDU. Section 7.2.4. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT CollisionElasticPdu : public EntityInformationFamilyPdu -{ -protected: - /** This field shall identify the entity that is issuing the PDU and shall be represented by an Entity Identifier record (see 6.2.28) */ - EntityID _issuingEntityID; - - /** This field shall identify the entity that has collided with the issuing entity. This field shall be a valid identifier of an entity or server capable of responding to the receipt of this Collision-Elastic PDU. This field shall be represented by an Entity Identifier record (see 6.2.28). */ - EntityID _collidingEntityID; - - /** This field shall contain an identification generated by the issuing simulation application to associate related collision events. This field shall be represented by an Event Identifier record (see 6.2.34). */ - EventIdentifier _collisionEventID; - - /** some padding */ - short _pad; - - /** This field shall contain the velocity at the time the collision is detected at the point the collision is detected. The velocity shall be represented in world coordinates. This field shall be represented by the Linear Velocity Vector record [see 6.2.95 item c)] */ - Vector3Float _contactVelocity; - - /** This field shall contain the mass of the issuing entity and shall be represented by a 32-bit floating point number representing kilograms */ - float _mass; - - /** This field shall specify the location of the collision with respect to the entity with which the issuing entity collided. This field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. */ - Vector3Float _locationOfImpact; - - /** These six records represent the six independent components of a positive semi-definite matrix formed by pre-multiplying and post-multiplying the tensor of inertia, by the anti-symmetric matrix generated by the moment arm, and shall be represented by 32-bit floating point numbers (see 5.3.4.4) */ - float _collisionIntermediateResultXX; - - /** tensor values */ - float _collisionIntermediateResultXY; - - /** tensor values */ - float _collisionIntermediateResultXZ; - - /** tensor values */ - float _collisionIntermediateResultYY; - - /** tensor values */ - float _collisionIntermediateResultYZ; - - /** tensor values */ - float _collisionIntermediateResultZZ; - - /** This record shall represent the normal vector to the surface at the point of collision detection. The surface normal shall be represented in world coordinates. This field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. */ - Vector3Float _unitSurfaceNormal; - - /** This field shall represent the degree to which energy is conserved in a collision and shall be represented by a 32-bit floating point number. In addition, it represents a free parameter by which simulation application developers may “tune” their collision interactions. */ - float _coefficientOfRestitution; - - - public: - CollisionElasticPdu(); - virtual ~CollisionElasticPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getIssuingEntityID(); - const EntityID& getIssuingEntityID() const; - void setIssuingEntityID(const EntityID &pX); - - EntityID& getCollidingEntityID(); - const EntityID& getCollidingEntityID() const; - void setCollidingEntityID(const EntityID &pX); - - EventIdentifier& getCollisionEventID(); - const EventIdentifier& getCollisionEventID() const; - void setCollisionEventID(const EventIdentifier &pX); - - short getPad() const; - void setPad(short pX); - - Vector3Float& getContactVelocity(); - const Vector3Float& getContactVelocity() const; - void setContactVelocity(const Vector3Float &pX); - - float getMass() const; - void setMass(float pX); - - Vector3Float& getLocationOfImpact(); - const Vector3Float& getLocationOfImpact() const; - void setLocationOfImpact(const Vector3Float &pX); - - float getCollisionIntermediateResultXX() const; - void setCollisionIntermediateResultXX(float pX); - - float getCollisionIntermediateResultXY() const; - void setCollisionIntermediateResultXY(float pX); - - float getCollisionIntermediateResultXZ() const; - void setCollisionIntermediateResultXZ(float pX); - - float getCollisionIntermediateResultYY() const; - void setCollisionIntermediateResultYY(float pX); - - float getCollisionIntermediateResultYZ() const; - void setCollisionIntermediateResultYZ(float pX); - - float getCollisionIntermediateResultZZ() const; - void setCollisionIntermediateResultZZ(float pX); - - Vector3Float& getUnitSurfaceNormal(); - const Vector3Float& getUnitSurfaceNormal() const; - void setUnitSurfaceNormal(const Vector3Float &pX); - - float getCoefficientOfRestitution() const; - void setCoefficientOfRestitution(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CollisionElasticPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CollisionPdu.cpp b/src/dis7/CollisionPdu.cpp deleted file mode 100644 index 03b163b1..00000000 --- a/src/dis7/CollisionPdu.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include - -using namespace DIS; - - -CollisionPdu::CollisionPdu() : EntityInformationFamilyPdu(), - _issuingEntityID(), - _collidingEntityID(), - _eventID(), - _collisionType(0), - _pad(0), - _velocity(), - _mass(0.0), - _location() -{ - setPduType( 4 ); - setProtocolFamily( 1 ); -} - -CollisionPdu::~CollisionPdu() -{ -} - -EntityID& CollisionPdu::getIssuingEntityID() -{ - return _issuingEntityID; -} - -const EntityID& CollisionPdu::getIssuingEntityID() const -{ - return _issuingEntityID; -} - -void CollisionPdu::setIssuingEntityID(const EntityID &pX) -{ - _issuingEntityID = pX; -} - -EntityID& CollisionPdu::getCollidingEntityID() -{ - return _collidingEntityID; -} - -const EntityID& CollisionPdu::getCollidingEntityID() const -{ - return _collidingEntityID; -} - -void CollisionPdu::setCollidingEntityID(const EntityID &pX) -{ - _collidingEntityID = pX; -} - -EventIdentifier& CollisionPdu::getEventID() -{ - return _eventID; -} - -const EventIdentifier& CollisionPdu::getEventID() const -{ - return _eventID; -} - -void CollisionPdu::setEventID(const EventIdentifier &pX) -{ - _eventID = pX; -} - -unsigned char CollisionPdu::getCollisionType() const -{ - return _collisionType; -} - -void CollisionPdu::setCollisionType(unsigned char pX) -{ - _collisionType = pX; -} - -char CollisionPdu::getPad() const -{ - return _pad; -} - -void CollisionPdu::setPad(char pX) -{ - _pad = pX; -} - -Vector3Float& CollisionPdu::getVelocity() -{ - return _velocity; -} - -const Vector3Float& CollisionPdu::getVelocity() const -{ - return _velocity; -} - -void CollisionPdu::setVelocity(const Vector3Float &pX) -{ - _velocity = pX; -} - -float CollisionPdu::getMass() const -{ - return _mass; -} - -void CollisionPdu::setMass(float pX) -{ - _mass = pX; -} - -Vector3Float& CollisionPdu::getLocation() -{ - return _location; -} - -const Vector3Float& CollisionPdu::getLocation() const -{ - return _location; -} - -void CollisionPdu::setLocation(const Vector3Float &pX) -{ - _location = pX; -} - -void CollisionPdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _issuingEntityID.marshal(dataStream); - _collidingEntityID.marshal(dataStream); - _eventID.marshal(dataStream); - dataStream << _collisionType; - dataStream << _pad; - _velocity.marshal(dataStream); - dataStream << _mass; - _location.marshal(dataStream); -} - -void CollisionPdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _issuingEntityID.unmarshal(dataStream); - _collidingEntityID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - dataStream >> _collisionType; - dataStream >> _pad; - _velocity.unmarshal(dataStream); - dataStream >> _mass; - _location.unmarshal(dataStream); -} - - -bool CollisionPdu::operator ==(const CollisionPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_issuingEntityID == rhs._issuingEntityID) ) ivarsEqual = false; - if( ! (_collidingEntityID == rhs._collidingEntityID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_collisionType == rhs._collisionType) ) ivarsEqual = false; - if( ! (_pad == rhs._pad) ) ivarsEqual = false; - if( ! (_velocity == rhs._velocity) ) ivarsEqual = false; - if( ! (_mass == rhs._mass) ) ivarsEqual = false; - if( ! (_location == rhs._location) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CollisionPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _issuingEntityID.getMarshalledSize(); // _issuingEntityID - marshalSize = marshalSize + _collidingEntityID.getMarshalledSize(); // _collidingEntityID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + 1; // _collisionType - marshalSize = marshalSize + 1; // _pad - marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity - marshalSize = marshalSize + 4; // _mass - marshalSize = marshalSize + _location.getMarshalledSize(); // _location - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CollisionPdu.h b/src/dis7/CollisionPdu.h deleted file mode 100644 index 7faf5d24..00000000 --- a/src/dis7/CollisionPdu.h +++ /dev/null @@ -1,121 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.2.3 Collisions between entities shall be communicated by issuing a Collision PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT CollisionPdu : public EntityInformationFamilyPdu -{ -protected: - /** This field shall identify the entity that is issuing the PDU, and shall be represented by an Entity Identifier record (see 6.2.28). */ - EntityID _issuingEntityID; - - /** This field shall identify the entity that has collided with the issuing entity (see 5.3.3.4). This field shall be represented by an Entity Identifier record (see 6.2.28). */ - EntityID _collidingEntityID; - - /** This field shall contain an identification generated by the issuing simulation application to associate related collision events. This field shall be represented by an Event Identifier record (see 6.2.34). */ - EventIdentifier _eventID; - - /** This field shall identify the type of collision. The Collision Type field shall be represented by an 8-bit record of enumerations */ - unsigned char _collisionType; - - /** some padding */ - char _pad; - - /** This field shall contain the velocity (at the time the collision is detected) of the issuing entity. The velocity shall be represented in world coordinates. This field shall be represented by the Linear Velocity Vector record [see 6.2.95 item c)]. */ - Vector3Float _velocity; - - /** This field shall contain the mass of the issuing entity, and shall be represented by a 32-bit floating point number representing kilograms. */ - float _mass; - - /** This field shall specify the location of the collision with respect to the entity with which the issuing entity collided. The Location field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. */ - Vector3Float _location; - - - public: - CollisionPdu(); - virtual ~CollisionPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getIssuingEntityID(); - const EntityID& getIssuingEntityID() const; - void setIssuingEntityID(const EntityID &pX); - - EntityID& getCollidingEntityID(); - const EntityID& getCollidingEntityID() const; - void setCollidingEntityID(const EntityID &pX); - - EventIdentifier& getEventID(); - const EventIdentifier& getEventID() const; - void setEventID(const EventIdentifier &pX); - - unsigned char getCollisionType() const; - void setCollisionType(unsigned char pX); - - char getPad() const; - void setPad(char pX); - - Vector3Float& getVelocity(); - const Vector3Float& getVelocity() const; - void setVelocity(const Vector3Float &pX); - - float getMass() const; - void setMass(float pX); - - Vector3Float& getLocation(); - const Vector3Float& getLocation() const; - void setLocation(const Vector3Float &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CollisionPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CommentPdu.cpp b/src/dis7/CommentPdu.cpp deleted file mode 100644 index c79e16c7..00000000 --- a/src/dis7/CommentPdu.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include - -using namespace DIS; - - -CommentPdu::CommentPdu() : SimulationManagementFamilyPdu(), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 22 ); -} - -CommentPdu::~CommentPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int CommentPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int CommentPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& CommentPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& CommentPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void CommentPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& CommentPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& CommentPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void CommentPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void CommentPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void CommentPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool CommentPdu::operator ==(const CommentPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int CommentPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CommentPdu.h b/src/dis7/CommentPdu.h deleted file mode 100644 index bdd2dab4..00000000 --- a/src/dis7/CommentPdu.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Arbitrary messages can be entered into the data stream via use of this PDU. Section 7.5.13 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT CommentPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - CommentPdu(); - virtual ~CommentPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CommentPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CommentReliablePdu.cpp b/src/dis7/CommentReliablePdu.cpp deleted file mode 100644 index f5afc2b6..00000000 --- a/src/dis7/CommentReliablePdu.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include - -using namespace DIS; - - -CommentReliablePdu::CommentReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 62 ); -} - -CommentReliablePdu::~CommentReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned int CommentReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int CommentReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& CommentReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& CommentReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void CommentReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& CommentReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& CommentReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void CommentReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void CommentReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void CommentReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool CommentReliablePdu::operator ==(const CommentReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int CommentReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CommentReliablePdu.h b/src/dis7/CommentReliablePdu.h deleted file mode 100644 index 5d67d7d5..00000000 --- a/src/dis7/CommentReliablePdu.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.12: Arbitrary messages. Only reliable this time. Neds manual intervention to fix padding in variable datums. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT CommentReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - CommentReliablePdu(); - virtual ~CommentReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CommentReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CommunicationsNodeID.cpp b/src/dis7/CommunicationsNodeID.cpp deleted file mode 100644 index 198f503b..00000000 --- a/src/dis7/CommunicationsNodeID.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -CommunicationsNodeID::CommunicationsNodeID(): - _entityID(), - _elementID(0) -{ -} - -CommunicationsNodeID::~CommunicationsNodeID() -{ -} - -EntityID& CommunicationsNodeID::getEntityID() -{ - return _entityID; -} - -const EntityID& CommunicationsNodeID::getEntityID() const -{ - return _entityID; -} - -void CommunicationsNodeID::setEntityID(const EntityID &pX) -{ - _entityID = pX; -} - -unsigned short CommunicationsNodeID::getElementID() const -{ - return _elementID; -} - -void CommunicationsNodeID::setElementID(unsigned short pX) -{ - _elementID = pX; -} - -void CommunicationsNodeID::marshal(DataStream& dataStream) const -{ - _entityID.marshal(dataStream); - dataStream << _elementID; -} - -void CommunicationsNodeID::unmarshal(DataStream& dataStream) -{ - _entityID.unmarshal(dataStream); - dataStream >> _elementID; -} - - -bool CommunicationsNodeID::operator ==(const CommunicationsNodeID& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityID == rhs._entityID) ) ivarsEqual = false; - if( ! (_elementID == rhs._elementID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CommunicationsNodeID::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID - marshalSize = marshalSize + 2; // _elementID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CommunicationsNodeID.h b/src/dis7/CommunicationsNodeID.h deleted file mode 100644 index e83220e7..00000000 --- a/src/dis7/CommunicationsNodeID.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Identity of a communications node. Section 6.2.49.4 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT CommunicationsNodeID -{ -protected: - EntityID _entityID; - - unsigned short _elementID; - - - public: - CommunicationsNodeID(); - virtual ~CommunicationsNodeID(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityID(); - const EntityID& getEntityID() const; - void setEntityID(const EntityID &pX); - - unsigned short getElementID() const; - void setElementID(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CommunicationsNodeID& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CreateEntityPdu.cpp b/src/dis7/CreateEntityPdu.cpp deleted file mode 100644 index c3f14f14..00000000 --- a/src/dis7/CreateEntityPdu.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include - -using namespace DIS; - - -CreateEntityPdu::CreateEntityPdu() : SimulationManagementFamilyPdu(), - _originatingID(), - _receivingID(), - _requestID(0) -{ - setPduType( 11 ); -} - -CreateEntityPdu::~CreateEntityPdu() -{ -} - -EntityID& CreateEntityPdu::getOriginatingID() -{ - return _originatingID; -} - -const EntityID& CreateEntityPdu::getOriginatingID() const -{ - return _originatingID; -} - -void CreateEntityPdu::setOriginatingID(const EntityID &pX) -{ - _originatingID = pX; -} - -EntityID& CreateEntityPdu::getReceivingID() -{ - return _receivingID; -} - -const EntityID& CreateEntityPdu::getReceivingID() const -{ - return _receivingID; -} - -void CreateEntityPdu::setReceivingID(const EntityID &pX) -{ - _receivingID = pX; -} - -unsigned int CreateEntityPdu::getRequestID() const -{ - return _requestID; -} - -void CreateEntityPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void CreateEntityPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _originatingID.marshal(dataStream); - _receivingID.marshal(dataStream); - dataStream << _requestID; -} - -void CreateEntityPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - dataStream >> _requestID; -} - - -bool CreateEntityPdu::operator ==(const CreateEntityPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_originatingID == rhs._originatingID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CreateEntityPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingID.getMarshalledSize(); // _originatingID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CreateEntityPdu.h b/src/dis7/CreateEntityPdu.h deleted file mode 100644 index 7b72aacc..00000000 --- a/src/dis7/CreateEntityPdu.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.2. Create a new entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT CreateEntityPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for the request */ - EntityID _originatingID; - - /** Identifier for the request */ - EntityID _receivingID; - - /** Identifier for the request. See 6.2.75 */ - unsigned int _requestID; - - - public: - CreateEntityPdu(); - virtual ~CreateEntityPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingID(); - const EntityID& getOriginatingID() const; - void setOriginatingID(const EntityID &pX); - - EntityID& getReceivingID(); - const EntityID& getReceivingID() const; - void setReceivingID(const EntityID &pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CreateEntityPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CreateEntityReliablePdu.cpp b/src/dis7/CreateEntityReliablePdu.cpp deleted file mode 100644 index 51c1eb4e..00000000 --- a/src/dis7/CreateEntityReliablePdu.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include - -using namespace DIS; - - -CreateEntityReliablePdu::CreateEntityReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0) -{ - setPduType( 51 ); -} - -CreateEntityReliablePdu::~CreateEntityReliablePdu() -{ -} - -unsigned char CreateEntityReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void CreateEntityReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short CreateEntityReliablePdu::getPad1() const -{ - return _pad1; -} - -void CreateEntityReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char CreateEntityReliablePdu::getPad2() const -{ - return _pad2; -} - -void CreateEntityReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int CreateEntityReliablePdu::getRequestID() const -{ - return _requestID; -} - -void CreateEntityReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void CreateEntityReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; -} - -void CreateEntityReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; -} - - -bool CreateEntityReliablePdu::operator ==(const CreateEntityReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int CreateEntityReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/CreateEntityReliablePdu.h b/src/dis7/CreateEntityReliablePdu.h deleted file mode 100644 index a74885fa..00000000 --- a/src/dis7/CreateEntityReliablePdu.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.1: creation of an entity , reliable. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT CreateEntityReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Request ID */ - unsigned int _requestID; - - - public: - CreateEntityReliablePdu(); - virtual ~CreateEntityReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const CreateEntityReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataPdu.cpp b/src/dis7/DataPdu.cpp deleted file mode 100644 index 51eb0c39..00000000 --- a/src/dis7/DataPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -DataPdu::DataPdu() : SimulationManagementFamilyPdu(), - _requestID(0), - _padding1(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 20 ); -} - -DataPdu::~DataPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int DataPdu::getRequestID() const -{ - return _requestID; -} - -void DataPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int DataPdu::getPadding1() const -{ - return _padding1; -} - -void DataPdu::setPadding1(unsigned int pX) -{ - _padding1 = pX; -} - -unsigned int DataPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int DataPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& DataPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& DataPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void DataPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& DataPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& DataPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void DataPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void DataPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _padding1; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void DataPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _padding1; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool DataPdu::operator ==(const DataPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _padding1 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataPdu.h b/src/dis7/DataPdu.h deleted file mode 100644 index 5e430061..00000000 --- a/src/dis7/DataPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Information issued in response to a data query pdu or a set data pdu is communicated using a data pdu. Section 7.5.11 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DataPdu : public SimulationManagementFamilyPdu -{ -protected: - /** ID of request */ - unsigned int _requestID; - - /** padding */ - unsigned int _padding1; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - DataPdu(); - virtual ~DataPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getPadding1() const; - void setPadding1(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataQueryDatumSpecification.cpp b/src/dis7/DataQueryDatumSpecification.cpp deleted file mode 100644 index b9ec943b..00000000 --- a/src/dis7/DataQueryDatumSpecification.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include - -using namespace DIS; - - -DataQueryDatumSpecification::DataQueryDatumSpecification(): - _numberOfFixedDatums(0), - _numberOfVariableDatums(0) -{ -} - -DataQueryDatumSpecification::~DataQueryDatumSpecification() -{ - _fixedDatumIDList.clear(); - _variableDatumIDList.clear(); -} - -unsigned int DataQueryDatumSpecification::getNumberOfFixedDatums() const -{ - return _fixedDatumIDList.size(); -} - -unsigned int DataQueryDatumSpecification::getNumberOfVariableDatums() const -{ - return _variableDatumIDList.size(); -} - -std::vector& DataQueryDatumSpecification::getFixedDatumIDList() -{ - return _fixedDatumIDList; -} - -const std::vector& DataQueryDatumSpecification::getFixedDatumIDList() const -{ - return _fixedDatumIDList; -} - -void DataQueryDatumSpecification::setFixedDatumIDList(const std::vector& pX) -{ - _fixedDatumIDList = pX; -} - -std::vector& DataQueryDatumSpecification::getVariableDatumIDList() -{ - return _variableDatumIDList; -} - -const std::vector& DataQueryDatumSpecification::getVariableDatumIDList() const -{ - return _variableDatumIDList; -} - -void DataQueryDatumSpecification::setVariableDatumIDList(const std::vector& pX) -{ - _variableDatumIDList = pX; -} - -void DataQueryDatumSpecification::marshal(DataStream& dataStream) const -{ - dataStream << ( unsigned int )_fixedDatumIDList.size(); - dataStream << ( unsigned int )_variableDatumIDList.size(); - - for(size_t idx = 0; idx < _fixedDatumIDList.size(); idx++) - { - UnsignedDISInteger x = _fixedDatumIDList[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumIDList.size(); idx++) - { - UnsignedDISInteger x = _variableDatumIDList[idx]; - x.marshal(dataStream); - } - -} - -void DataQueryDatumSpecification::unmarshal(DataStream& dataStream) -{ - dataStream >> _numberOfFixedDatums; - dataStream >> _numberOfVariableDatums; - - _fixedDatumIDList.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatums; idx++) - { - UnsignedDISInteger x; - x.unmarshal(dataStream); - _fixedDatumIDList.push_back(x); - } - - _variableDatumIDList.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatums; idx++) - { - UnsignedDISInteger x; - x.unmarshal(dataStream); - _variableDatumIDList.push_back(x); - } -} - - -bool DataQueryDatumSpecification::operator ==(const DataQueryDatumSpecification& rhs) const - { - bool ivarsEqual = true; - - - for(size_t idx = 0; idx < _fixedDatumIDList.size(); idx++) - { - if( ! ( _fixedDatumIDList[idx] == rhs._fixedDatumIDList[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumIDList.size(); idx++) - { - if( ! ( _variableDatumIDList[idx] == rhs._variableDatumIDList[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataQueryDatumSpecification::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _numberOfFixedDatums - marshalSize = marshalSize + 4; // _numberOfVariableDatums - - for(unsigned long long idx=0; idx < _fixedDatumIDList.size(); idx++) - { - UnsignedDISInteger listElement = _fixedDatumIDList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumIDList.size(); idx++) - { - UnsignedDISInteger listElement = _variableDatumIDList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataQueryDatumSpecification.h b/src/dis7/DataQueryDatumSpecification.h deleted file mode 100644 index 924430c9..00000000 --- a/src/dis7/DataQueryDatumSpecification.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// List of fixed and variable datum records. Section 6.2.18 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DataQueryDatumSpecification -{ -protected: - /** Number of fixed datums */ - unsigned int _numberOfFixedDatums; - - /** Number of variable datums */ - unsigned int _numberOfVariableDatums; - - /** variable length list fixed datum IDs */ - std::vector _fixedDatumIDList; - - /** variable length list variable datum IDs */ - std::vector _variableDatumIDList; - - - public: - DataQueryDatumSpecification(); - virtual ~DataQueryDatumSpecification(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfFixedDatums() const; - - unsigned int getNumberOfVariableDatums() const; - - std::vector& getFixedDatumIDList(); - const std::vector& getFixedDatumIDList() const; - void setFixedDatumIDList(const std::vector& pX); - - std::vector& getVariableDatumIDList(); - const std::vector& getVariableDatumIDList() const; - void setVariableDatumIDList(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataQueryDatumSpecification& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataQueryPdu.cpp b/src/dis7/DataQueryPdu.cpp deleted file mode 100644 index 212125e1..00000000 --- a/src/dis7/DataQueryPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -DataQueryPdu::DataQueryPdu() : SimulationManagementFamilyPdu(), - _requestID(0), - _timeInterval(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 18 ); -} - -DataQueryPdu::~DataQueryPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int DataQueryPdu::getRequestID() const -{ - return _requestID; -} - -void DataQueryPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int DataQueryPdu::getTimeInterval() const -{ - return _timeInterval; -} - -void DataQueryPdu::setTimeInterval(unsigned int pX) -{ - _timeInterval = pX; -} - -unsigned int DataQueryPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int DataQueryPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& DataQueryPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& DataQueryPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void DataQueryPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& DataQueryPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& DataQueryPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void DataQueryPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void DataQueryPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _timeInterval; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void DataQueryPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _timeInterval; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool DataQueryPdu::operator ==(const DataQueryPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_timeInterval == rhs._timeInterval) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataQueryPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _timeInterval - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataQueryPdu.h b/src/dis7/DataQueryPdu.h deleted file mode 100644 index b6042fe1..00000000 --- a/src/dis7/DataQueryPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.9. Request for data from an entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DataQueryPdu : public SimulationManagementFamilyPdu -{ -protected: - /** ID of request */ - unsigned int _requestID; - - /** time issues between issues of Data PDUs. Zero means send once only. */ - unsigned int _timeInterval; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - DataQueryPdu(); - virtual ~DataQueryPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getTimeInterval() const; - void setTimeInterval(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataQueryPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataQueryReliablePdu.cpp b/src/dis7/DataQueryReliablePdu.cpp deleted file mode 100644 index e89dd005..00000000 --- a/src/dis7/DataQueryReliablePdu.cpp +++ /dev/null @@ -1,254 +0,0 @@ -#include - -using namespace DIS; - - -DataQueryReliablePdu::DataQueryReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0), - _timeInterval(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 58 ); -} - -DataQueryReliablePdu::~DataQueryReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned char DataQueryReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void DataQueryReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short DataQueryReliablePdu::getPad1() const -{ - return _pad1; -} - -void DataQueryReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char DataQueryReliablePdu::getPad2() const -{ - return _pad2; -} - -void DataQueryReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int DataQueryReliablePdu::getRequestID() const -{ - return _requestID; -} - -void DataQueryReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int DataQueryReliablePdu::getTimeInterval() const -{ - return _timeInterval; -} - -void DataQueryReliablePdu::setTimeInterval(unsigned int pX) -{ - _timeInterval = pX; -} - -unsigned int DataQueryReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int DataQueryReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& DataQueryReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& DataQueryReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void DataQueryReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& DataQueryReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& DataQueryReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void DataQueryReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void DataQueryReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; - dataStream << _timeInterval; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void DataQueryReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; - dataStream >> _timeInterval; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool DataQueryReliablePdu::operator ==(const DataQueryReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_timeInterval == rhs._timeInterval) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataQueryReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _timeInterval - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataQueryReliablePdu.h b/src/dis7/DataQueryReliablePdu.h deleted file mode 100644 index 04890920..00000000 --- a/src/dis7/DataQueryReliablePdu.h +++ /dev/null @@ -1,120 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.8: request for data from an entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DataQueryReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** request ID */ - unsigned int _requestID; - - /** time interval between issuing data query PDUs */ - unsigned int _timeInterval; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - DataQueryReliablePdu(); - virtual ~DataQueryReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getTimeInterval() const; - void setTimeInterval(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataQueryReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataReliablePdu.cpp b/src/dis7/DataReliablePdu.cpp deleted file mode 100644 index b5c4cdf0..00000000 --- a/src/dis7/DataReliablePdu.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include - -using namespace DIS; - - -DataReliablePdu::DataReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requestID(0), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 60 ); -} - -DataReliablePdu::~DataReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned int DataReliablePdu::getRequestID() const -{ - return _requestID; -} - -void DataReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned char DataReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void DataReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short DataReliablePdu::getPad1() const -{ - return _pad1; -} - -void DataReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char DataReliablePdu::getPad2() const -{ - return _pad2; -} - -void DataReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int DataReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int DataReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& DataReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& DataReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void DataReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& DataReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& DataReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void DataReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void DataReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void DataReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool DataReliablePdu::operator ==(const DataReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DataReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DataReliablePdu.h b/src/dis7/DataReliablePdu.h deleted file mode 100644 index 34af78b0..00000000 --- a/src/dis7/DataReliablePdu.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.10: issued in response to a data query R or set dataR pdu. Needs manual intervention to fix padding on variable datums. UNFINSIHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DataReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** Request ID */ - unsigned int _requestID; - - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - DataReliablePdu(); - virtual ~DataReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DataReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DatumSpecification.cpp b/src/dis7/DatumSpecification.cpp deleted file mode 100644 index a0778dc5..00000000 --- a/src/dis7/DatumSpecification.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include - -using namespace DIS; - - -DatumSpecification::DatumSpecification(): - _numberOfFixedDatums(0), - _numberOfVariableDatums(0) -{ -} - -DatumSpecification::~DatumSpecification() -{ - _fixedDatumIDList.clear(); - _variableDatumIDList.clear(); -} - -unsigned int DatumSpecification::getNumberOfFixedDatums() const -{ - return _fixedDatumIDList.size(); -} - -unsigned int DatumSpecification::getNumberOfVariableDatums() const -{ - return _variableDatumIDList.size(); -} - -std::vector& DatumSpecification::getFixedDatumIDList() -{ - return _fixedDatumIDList; -} - -const std::vector& DatumSpecification::getFixedDatumIDList() const -{ - return _fixedDatumIDList; -} - -void DatumSpecification::setFixedDatumIDList(const std::vector& pX) -{ - _fixedDatumIDList = pX; -} - -std::vector& DatumSpecification::getVariableDatumIDList() -{ - return _variableDatumIDList; -} - -const std::vector& DatumSpecification::getVariableDatumIDList() const -{ - return _variableDatumIDList; -} - -void DatumSpecification::setVariableDatumIDList(const std::vector& pX) -{ - _variableDatumIDList = pX; -} - -void DatumSpecification::marshal(DataStream& dataStream) const -{ - dataStream << ( unsigned int )_fixedDatumIDList.size(); - dataStream << ( unsigned int )_variableDatumIDList.size(); - - for(size_t idx = 0; idx < _fixedDatumIDList.size(); idx++) - { - FixedDatum x = _fixedDatumIDList[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumIDList.size(); idx++) - { - VariableDatum x = _variableDatumIDList[idx]; - x.marshal(dataStream); - } - -} - -void DatumSpecification::unmarshal(DataStream& dataStream) -{ - dataStream >> _numberOfFixedDatums; - dataStream >> _numberOfVariableDatums; - - _fixedDatumIDList.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatums; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumIDList.push_back(x); - } - - _variableDatumIDList.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatums; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumIDList.push_back(x); - } -} - - -bool DatumSpecification::operator ==(const DatumSpecification& rhs) const - { - bool ivarsEqual = true; - - - for(size_t idx = 0; idx < _fixedDatumIDList.size(); idx++) - { - if( ! ( _fixedDatumIDList[idx] == rhs._fixedDatumIDList[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumIDList.size(); idx++) - { - if( ! ( _variableDatumIDList[idx] == rhs._variableDatumIDList[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DatumSpecification::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _numberOfFixedDatums - marshalSize = marshalSize + 4; // _numberOfVariableDatums - - for(unsigned long long idx=0; idx < _fixedDatumIDList.size(); idx++) - { - FixedDatum listElement = _fixedDatumIDList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumIDList.size(); idx++) - { - VariableDatum listElement = _variableDatumIDList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DatumSpecification.h b/src/dis7/DatumSpecification.h deleted file mode 100644 index 8209073e..00000000 --- a/src/dis7/DatumSpecification.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// List of fixed and variable datum records. Section 6.2.19 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DatumSpecification -{ -protected: - /** Number of fixed datums */ - unsigned int _numberOfFixedDatums; - - /** Number of variable datums */ - unsigned int _numberOfVariableDatums; - - /** variable length list fixed datums */ - std::vector _fixedDatumIDList; - - /** variable length list variable datums */ - std::vector _variableDatumIDList; - - - public: - DatumSpecification(); - virtual ~DatumSpecification(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfFixedDatums() const; - - unsigned int getNumberOfVariableDatums() const; - - std::vector& getFixedDatumIDList(); - const std::vector& getFixedDatumIDList() const; - void setFixedDatumIDList(const std::vector& pX); - - std::vector& getVariableDatumIDList(); - const std::vector& getVariableDatumIDList() const; - void setVariableDatumIDList(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DatumSpecification& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DeadReckoningParameters.cpp b/src/dis7/DeadReckoningParameters.cpp deleted file mode 100644 index f130b184..00000000 --- a/src/dis7/DeadReckoningParameters.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include - -using namespace DIS; - - -DeadReckoningParameters::DeadReckoningParameters(): - _deadReckoningAlgorithm(0), - _entityLinearAcceleration(), - _entityAngularVelocity() -{ - // Initialize fixed length array - for(int lengthparameters= 0; lengthparameters < 15; lengthparameters++) - { - _parameters[lengthparameters] = 0; - } - -} - -DeadReckoningParameters::~DeadReckoningParameters() -{ -} - -unsigned char DeadReckoningParameters::getDeadReckoningAlgorithm() const -{ - return _deadReckoningAlgorithm; -} - -void DeadReckoningParameters::setDeadReckoningAlgorithm(unsigned char pX) -{ - _deadReckoningAlgorithm = pX; -} - -unsigned char* DeadReckoningParameters::getParameters() -{ - return _parameters; -} - -const unsigned char* DeadReckoningParameters::getParameters() const -{ - return _parameters; -} - -void DeadReckoningParameters::setParameters(const unsigned char* x) -{ - for(int i = 0; i < 15; i++) - { - _parameters[i] = x[i]; - } -} - -Vector3Float& DeadReckoningParameters::getEntityLinearAcceleration() -{ - return _entityLinearAcceleration; -} - -const Vector3Float& DeadReckoningParameters::getEntityLinearAcceleration() const -{ - return _entityLinearAcceleration; -} - -void DeadReckoningParameters::setEntityLinearAcceleration(const Vector3Float &pX) -{ - _entityLinearAcceleration = pX; -} - -Vector3Float& DeadReckoningParameters::getEntityAngularVelocity() -{ - return _entityAngularVelocity; -} - -const Vector3Float& DeadReckoningParameters::getEntityAngularVelocity() const -{ - return _entityAngularVelocity; -} - -void DeadReckoningParameters::setEntityAngularVelocity(const Vector3Float &pX) -{ - _entityAngularVelocity = pX; -} - -void DeadReckoningParameters::marshal(DataStream& dataStream) const -{ - dataStream << _deadReckoningAlgorithm; - - for(size_t idx = 0; idx < 15; idx++) - { - dataStream << _parameters[idx]; - } - - _entityLinearAcceleration.marshal(dataStream); - _entityAngularVelocity.marshal(dataStream); -} - -void DeadReckoningParameters::unmarshal(DataStream& dataStream) -{ - dataStream >> _deadReckoningAlgorithm; - - for(size_t idx = 0; idx < 15; idx++) - { - dataStream >> _parameters[idx]; - } - - _entityLinearAcceleration.unmarshal(dataStream); - _entityAngularVelocity.unmarshal(dataStream); -} - - -bool DeadReckoningParameters::operator ==(const DeadReckoningParameters& rhs) const - { - bool ivarsEqual = true; - - if( ! (_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 15; idx++) - { - if(!(_parameters[idx] == rhs._parameters[idx]) ) ivarsEqual = false; - } - - if( ! (_entityLinearAcceleration == rhs._entityLinearAcceleration) ) ivarsEqual = false; - if( ! (_entityAngularVelocity == rhs._entityAngularVelocity) ) ivarsEqual = false; - - return ivarsEqual; - } - -int DeadReckoningParameters::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _deadReckoningAlgorithm - marshalSize = marshalSize + 15 * 1; // _parameters - marshalSize = marshalSize + _entityLinearAcceleration.getMarshalledSize(); // _entityLinearAcceleration - marshalSize = marshalSize + _entityAngularVelocity.getMarshalledSize(); // _entityAngularVelocity - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DeadReckoningParameters.h b/src/dis7/DeadReckoningParameters.h deleted file mode 100644 index fc7406ec..00000000 --- a/src/dis7/DeadReckoningParameters.h +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Not specified in the standard. This is used by the ESPDU - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DeadReckoningParameters -{ -protected: - /** Algorithm to use in computing dead reckoning. See EBV doc. */ - unsigned char _deadReckoningAlgorithm; - - /** Dead reckoning parameters. Contents depends on algorithm. */ - unsigned char _parameters[15]; - - /** Linear acceleration of the entity */ - Vector3Float _entityLinearAcceleration; - - /** Angular velocity of the entity */ - Vector3Float _entityAngularVelocity; - - - public: - DeadReckoningParameters(); - virtual ~DeadReckoningParameters(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getDeadReckoningAlgorithm() const; - void setDeadReckoningAlgorithm(unsigned char pX); - - unsigned char* getParameters(); - const unsigned char* getParameters() const; - void setParameters( const unsigned char* pX); - - Vector3Float& getEntityLinearAcceleration(); - const Vector3Float& getEntityLinearAcceleration() const; - void setEntityLinearAcceleration(const Vector3Float &pX); - - Vector3Float& getEntityAngularVelocity(); - const Vector3Float& getEntityAngularVelocity() const; - void setEntityAngularVelocity(const Vector3Float &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DeadReckoningParameters& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DesignatorPdu.cpp b/src/dis7/DesignatorPdu.cpp deleted file mode 100644 index 2fe547e6..00000000 --- a/src/dis7/DesignatorPdu.cpp +++ /dev/null @@ -1,278 +0,0 @@ -#include - -using namespace DIS; - - -DesignatorPdu::DesignatorPdu() : DistributedEmissionsFamilyPdu(), - _designatingEntityID(), - _codeName(0), - _designatedEntityID(), - _designatorCode(0), - _designatorPower(0.0), - _designatorWavelength(0.0), - _designatorSpotWrtDesignated(), - _designatorSpotLocation(), - _deadReckoningAlgorithm(0), - _padding1(0), - _padding2(0), - _entityLinearAcceleration() -{ - setPduType( 24 ); -} - -DesignatorPdu::~DesignatorPdu() -{ -} - -EntityID& DesignatorPdu::getDesignatingEntityID() -{ - return _designatingEntityID; -} - -const EntityID& DesignatorPdu::getDesignatingEntityID() const -{ - return _designatingEntityID; -} - -void DesignatorPdu::setDesignatingEntityID(const EntityID &pX) -{ - _designatingEntityID = pX; -} - -unsigned short DesignatorPdu::getCodeName() const -{ - return _codeName; -} - -void DesignatorPdu::setCodeName(unsigned short pX) -{ - _codeName = pX; -} - -EntityID& DesignatorPdu::getDesignatedEntityID() -{ - return _designatedEntityID; -} - -const EntityID& DesignatorPdu::getDesignatedEntityID() const -{ - return _designatedEntityID; -} - -void DesignatorPdu::setDesignatedEntityID(const EntityID &pX) -{ - _designatedEntityID = pX; -} - -unsigned short DesignatorPdu::getDesignatorCode() const -{ - return _designatorCode; -} - -void DesignatorPdu::setDesignatorCode(unsigned short pX) -{ - _designatorCode = pX; -} - -float DesignatorPdu::getDesignatorPower() const -{ - return _designatorPower; -} - -void DesignatorPdu::setDesignatorPower(float pX) -{ - _designatorPower = pX; -} - -float DesignatorPdu::getDesignatorWavelength() const -{ - return _designatorWavelength; -} - -void DesignatorPdu::setDesignatorWavelength(float pX) -{ - _designatorWavelength = pX; -} - -Vector3Float& DesignatorPdu::getDesignatorSpotWrtDesignated() -{ - return _designatorSpotWrtDesignated; -} - -const Vector3Float& DesignatorPdu::getDesignatorSpotWrtDesignated() const -{ - return _designatorSpotWrtDesignated; -} - -void DesignatorPdu::setDesignatorSpotWrtDesignated(const Vector3Float &pX) -{ - _designatorSpotWrtDesignated = pX; -} - -Vector3Double& DesignatorPdu::getDesignatorSpotLocation() -{ - return _designatorSpotLocation; -} - -const Vector3Double& DesignatorPdu::getDesignatorSpotLocation() const -{ - return _designatorSpotLocation; -} - -void DesignatorPdu::setDesignatorSpotLocation(const Vector3Double &pX) -{ - _designatorSpotLocation = pX; -} - -char DesignatorPdu::getDeadReckoningAlgorithm() const -{ - return _deadReckoningAlgorithm; -} - -void DesignatorPdu::setDeadReckoningAlgorithm(char pX) -{ - _deadReckoningAlgorithm = pX; -} - -unsigned short DesignatorPdu::getPadding1() const -{ - return _padding1; -} - -void DesignatorPdu::setPadding1(unsigned short pX) -{ - _padding1 = pX; -} - -char DesignatorPdu::getPadding2() const -{ - return _padding2; -} - -void DesignatorPdu::setPadding2(char pX) -{ - _padding2 = pX; -} - -Vector3Float& DesignatorPdu::getEntityLinearAcceleration() -{ - return _entityLinearAcceleration; -} - -const Vector3Float& DesignatorPdu::getEntityLinearAcceleration() const -{ - return _entityLinearAcceleration; -} - -void DesignatorPdu::setEntityLinearAcceleration(const Vector3Float &pX) -{ - _entityLinearAcceleration = pX; -} - -void DesignatorPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _designatingEntityID.marshal(dataStream); - dataStream << _codeName; - _designatedEntityID.marshal(dataStream); - dataStream << _designatorCode; - dataStream << _designatorPower; - dataStream << _designatorWavelength; - _designatorSpotWrtDesignated.marshal(dataStream); - _designatorSpotLocation.marshal(dataStream); - dataStream << _deadReckoningAlgorithm; - dataStream << _padding1; - dataStream << _padding2; - _entityLinearAcceleration.marshal(dataStream); -} - -void DesignatorPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _designatingEntityID.unmarshal(dataStream); - dataStream >> _codeName; - _designatedEntityID.unmarshal(dataStream); - dataStream >> _designatorCode; - dataStream >> _designatorPower; - dataStream >> _designatorWavelength; - _designatorSpotWrtDesignated.unmarshal(dataStream); - _designatorSpotLocation.unmarshal(dataStream); - dataStream >> _deadReckoningAlgorithm; - dataStream >> _padding1; - dataStream >> _padding2; - _entityLinearAcceleration.unmarshal(dataStream); -} - - -bool DesignatorPdu::operator ==(const DesignatorPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_designatingEntityID == rhs._designatingEntityID) ) ivarsEqual = false; - if( ! (_codeName == rhs._codeName) ) ivarsEqual = false; - if( ! (_designatedEntityID == rhs._designatedEntityID) ) ivarsEqual = false; - if( ! (_designatorCode == rhs._designatorCode) ) ivarsEqual = false; - if( ! (_designatorPower == rhs._designatorPower) ) ivarsEqual = false; - if( ! (_designatorWavelength == rhs._designatorWavelength) ) ivarsEqual = false; - if( ! (_designatorSpotWrtDesignated == rhs._designatorSpotWrtDesignated) ) ivarsEqual = false; - if( ! (_designatorSpotLocation == rhs._designatorSpotLocation) ) ivarsEqual = false; - if( ! (_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_entityLinearAcceleration == rhs._entityLinearAcceleration) ) ivarsEqual = false; - - return ivarsEqual; - } - -int DesignatorPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _designatingEntityID.getMarshalledSize(); // _designatingEntityID - marshalSize = marshalSize + 2; // _codeName - marshalSize = marshalSize + _designatedEntityID.getMarshalledSize(); // _designatedEntityID - marshalSize = marshalSize + 2; // _designatorCode - marshalSize = marshalSize + 4; // _designatorPower - marshalSize = marshalSize + 4; // _designatorWavelength - marshalSize = marshalSize + _designatorSpotWrtDesignated.getMarshalledSize(); // _designatorSpotWrtDesignated - marshalSize = marshalSize + _designatorSpotLocation.getMarshalledSize(); // _designatorSpotLocation - marshalSize = marshalSize + 1; // _deadReckoningAlgorithm - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - marshalSize = marshalSize + _entityLinearAcceleration.getMarshalledSize(); // _entityLinearAcceleration - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DesignatorPdu.h b/src/dis7/DesignatorPdu.h deleted file mode 100644 index a64e9fff..00000000 --- a/src/dis7/DesignatorPdu.h +++ /dev/null @@ -1,145 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7.2. Handles designating operations. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DesignatorPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** ID of the entity designating */ - EntityID _designatingEntityID; - - /** This field shall specify a unique emitter database number assigned to differentiate between otherwise similar or identical emitter beams within an emitter system. */ - unsigned short _codeName; - - /** ID of the entity being designated */ - EntityID _designatedEntityID; - - /** This field shall identify the designator code being used by the designating entity */ - unsigned short _designatorCode; - - /** This field shall identify the designator output power in watts */ - float _designatorPower; - - /** This field shall identify the designator wavelength in units of microns */ - float _designatorWavelength; - - /** designtor spot wrt the designated entity */ - Vector3Float _designatorSpotWrtDesignated; - - /** designtor spot wrt the designated entity */ - Vector3Double _designatorSpotLocation; - - /** Dead reckoning algorithm */ - char _deadReckoningAlgorithm; - - /** padding */ - unsigned short _padding1; - - /** padding */ - char _padding2; - - /** linear accelleration of entity */ - Vector3Float _entityLinearAcceleration; - - - public: - DesignatorPdu(); - virtual ~DesignatorPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getDesignatingEntityID(); - const EntityID& getDesignatingEntityID() const; - void setDesignatingEntityID(const EntityID &pX); - - unsigned short getCodeName() const; - void setCodeName(unsigned short pX); - - EntityID& getDesignatedEntityID(); - const EntityID& getDesignatedEntityID() const; - void setDesignatedEntityID(const EntityID &pX); - - unsigned short getDesignatorCode() const; - void setDesignatorCode(unsigned short pX); - - float getDesignatorPower() const; - void setDesignatorPower(float pX); - - float getDesignatorWavelength() const; - void setDesignatorWavelength(float pX); - - Vector3Float& getDesignatorSpotWrtDesignated(); - const Vector3Float& getDesignatorSpotWrtDesignated() const; - void setDesignatorSpotWrtDesignated(const Vector3Float &pX); - - Vector3Double& getDesignatorSpotLocation(); - const Vector3Double& getDesignatorSpotLocation() const; - void setDesignatorSpotLocation(const Vector3Double &pX); - - char getDeadReckoningAlgorithm() const; - void setDeadReckoningAlgorithm(char pX); - - unsigned short getPadding1() const; - void setPadding1(unsigned short pX); - - char getPadding2() const; - void setPadding2(char pX); - - Vector3Float& getEntityLinearAcceleration(); - const Vector3Float& getEntityLinearAcceleration() const; - void setEntityLinearAcceleration(const Vector3Float &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DesignatorPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DetonationPdu.cpp b/src/dis7/DetonationPdu.cpp deleted file mode 100644 index e1386dc9..00000000 --- a/src/dis7/DetonationPdu.cpp +++ /dev/null @@ -1,276 +0,0 @@ -#include - -using namespace DIS; - - -DetonationPdu::DetonationPdu() : WarfareFamilyPdu(), - _explodingEntityID(), - _eventID(), - _velocity(), - _locationInWorldCoordinates(), - _descriptor(), - _locationOfEntityCoordinates(), - _detonationResult(0), - _numberOfVariableParameters(0), - _pad(0) -{ - setPduType( 3 ); -} - -DetonationPdu::~DetonationPdu() -{ - _variableParameters.clear(); -} - -EntityID& DetonationPdu::getExplodingEntityID() -{ - return _explodingEntityID; -} - -const EntityID& DetonationPdu::getExplodingEntityID() const -{ - return _explodingEntityID; -} - -void DetonationPdu::setExplodingEntityID(const EntityID &pX) -{ - _explodingEntityID = pX; -} - -EventIdentifier& DetonationPdu::getEventID() -{ - return _eventID; -} - -const EventIdentifier& DetonationPdu::getEventID() const -{ - return _eventID; -} - -void DetonationPdu::setEventID(const EventIdentifier &pX) -{ - _eventID = pX; -} - -Vector3Float& DetonationPdu::getVelocity() -{ - return _velocity; -} - -const Vector3Float& DetonationPdu::getVelocity() const -{ - return _velocity; -} - -void DetonationPdu::setVelocity(const Vector3Float &pX) -{ - _velocity = pX; -} - -Vector3Double& DetonationPdu::getLocationInWorldCoordinates() -{ - return _locationInWorldCoordinates; -} - -const Vector3Double& DetonationPdu::getLocationInWorldCoordinates() const -{ - return _locationInWorldCoordinates; -} - -void DetonationPdu::setLocationInWorldCoordinates(const Vector3Double &pX) -{ - _locationInWorldCoordinates = pX; -} - -MunitionDescriptor& DetonationPdu::getDescriptor() -{ - return _descriptor; -} - -const MunitionDescriptor& DetonationPdu::getDescriptor() const -{ - return _descriptor; -} - -void DetonationPdu::setDescriptor(const MunitionDescriptor &pX) -{ - _descriptor = pX; -} - -Vector3Float& DetonationPdu::getLocationOfEntityCoordinates() -{ - return _locationOfEntityCoordinates; -} - -const Vector3Float& DetonationPdu::getLocationOfEntityCoordinates() const -{ - return _locationOfEntityCoordinates; -} - -void DetonationPdu::setLocationOfEntityCoordinates(const Vector3Float &pX) -{ - _locationOfEntityCoordinates = pX; -} - -unsigned char DetonationPdu::getDetonationResult() const -{ - return _detonationResult; -} - -void DetonationPdu::setDetonationResult(unsigned char pX) -{ - _detonationResult = pX; -} - -unsigned char DetonationPdu::getNumberOfVariableParameters() const -{ - return _variableParameters.size(); -} - -unsigned short DetonationPdu::getPad() const -{ - return _pad; -} - -void DetonationPdu::setPad(unsigned short pX) -{ - _pad = pX; -} - -std::vector& DetonationPdu::getVariableParameters() -{ - return _variableParameters; -} - -const std::vector& DetonationPdu::getVariableParameters() const -{ - return _variableParameters; -} - -void DetonationPdu::setVariableParameters(const std::vector& pX) -{ - _variableParameters = pX; -} - -void DetonationPdu::marshal(DataStream& dataStream) const -{ - WarfareFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _explodingEntityID.marshal(dataStream); - _eventID.marshal(dataStream); - _velocity.marshal(dataStream); - _locationInWorldCoordinates.marshal(dataStream); - _descriptor.marshal(dataStream); - _locationOfEntityCoordinates.marshal(dataStream); - dataStream << _detonationResult; - dataStream << ( unsigned char )_variableParameters.size(); - dataStream << _pad; - - for(size_t idx = 0; idx < _variableParameters.size(); idx++) - { - VariableParameter x = _variableParameters[idx]; - x.marshal(dataStream); - } - -} - -void DetonationPdu::unmarshal(DataStream& dataStream) -{ - WarfareFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _explodingEntityID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - _velocity.unmarshal(dataStream); - _locationInWorldCoordinates.unmarshal(dataStream); - _descriptor.unmarshal(dataStream); - _locationOfEntityCoordinates.unmarshal(dataStream); - dataStream >> _detonationResult; - dataStream >> _numberOfVariableParameters; - dataStream >> _pad; - - _variableParameters.clear(); - for(size_t idx = 0; idx < _numberOfVariableParameters; idx++) - { - VariableParameter x; - x.unmarshal(dataStream); - _variableParameters.push_back(x); - } -} - - -bool DetonationPdu::operator ==(const DetonationPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = WarfareFamilyPdu::operator==(rhs); - - if( ! (_explodingEntityID == rhs._explodingEntityID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_velocity == rhs._velocity) ) ivarsEqual = false; - if( ! (_locationInWorldCoordinates == rhs._locationInWorldCoordinates) ) ivarsEqual = false; - if( ! (_descriptor == rhs._descriptor) ) ivarsEqual = false; - if( ! (_locationOfEntityCoordinates == rhs._locationOfEntityCoordinates) ) ivarsEqual = false; - if( ! (_detonationResult == rhs._detonationResult) ) ivarsEqual = false; - if( ! (_pad == rhs._pad) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _variableParameters.size(); idx++) - { - if( ! ( _variableParameters[idx] == rhs._variableParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DetonationPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = WarfareFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _explodingEntityID.getMarshalledSize(); // _explodingEntityID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity - marshalSize = marshalSize + _locationInWorldCoordinates.getMarshalledSize(); // _locationInWorldCoordinates - marshalSize = marshalSize + _descriptor.getMarshalledSize(); // _descriptor - marshalSize = marshalSize + _locationOfEntityCoordinates.getMarshalledSize(); // _locationOfEntityCoordinates - marshalSize = marshalSize + 1; // _detonationResult - marshalSize = marshalSize + 1; // _numberOfVariableParameters - marshalSize = marshalSize + 2; // _pad - - for(unsigned long long idx=0; idx < _variableParameters.size(); idx++) - { - VariableParameter listElement = _variableParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DetonationPdu.h b/src/dis7/DetonationPdu.h deleted file mode 100644 index 0572b7b9..00000000 --- a/src/dis7/DetonationPdu.h +++ /dev/null @@ -1,137 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Detonation or impact of munitions, as well as, non-munition explosions, the burst or initial bloom of chaff, and the ignition of a flare shall be indicated. Section 7.3.3 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DetonationPdu : public WarfareFamilyPdu -{ -protected: - /** ID of the expendable entity, Section 7.3.3 */ - EntityID _explodingEntityID; - - /** ID of event, Section 7.3.3 */ - EventIdentifier _eventID; - - /** velocity of the munition immediately before detonation/impact, Section 7.3.3 */ - Vector3Float _velocity; - - /** location of the munition detonation, the expendable detonation, Section 7.3.3 */ - Vector3Double _locationInWorldCoordinates; - - /** Describes the detonation represented, Section 7.3.3 */ - MunitionDescriptor _descriptor; - - /** Velocity of the ammunition, Section 7.3.3 */ - Vector3Float _locationOfEntityCoordinates; - - /** result of the detonation, Section 7.3.3 */ - unsigned char _detonationResult; - - /** How many articulation parameters we have, Section 7.3.3 */ - unsigned char _numberOfVariableParameters; - - /** padding */ - unsigned short _pad; - - /** specify the parameter values for each Variable Parameter record, Section 7.3.3 */ - std::vector _variableParameters; - - - public: - DetonationPdu(); - virtual ~DetonationPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getExplodingEntityID(); - const EntityID& getExplodingEntityID() const; - void setExplodingEntityID(const EntityID &pX); - - EventIdentifier& getEventID(); - const EventIdentifier& getEventID() const; - void setEventID(const EventIdentifier &pX); - - Vector3Float& getVelocity(); - const Vector3Float& getVelocity() const; - void setVelocity(const Vector3Float &pX); - - Vector3Double& getLocationInWorldCoordinates(); - const Vector3Double& getLocationInWorldCoordinates() const; - void setLocationInWorldCoordinates(const Vector3Double &pX); - - MunitionDescriptor& getDescriptor(); - const MunitionDescriptor& getDescriptor() const; - void setDescriptor(const MunitionDescriptor &pX); - - Vector3Float& getLocationOfEntityCoordinates(); - const Vector3Float& getLocationOfEntityCoordinates() const; - void setLocationOfEntityCoordinates(const Vector3Float &pX); - - unsigned char getDetonationResult() const; - void setDetonationResult(unsigned char pX); - - unsigned char getNumberOfVariableParameters() const; - - unsigned short getPad() const; - void setPad(unsigned short pX); - - std::vector& getVariableParameters(); - const std::vector& getVariableParameters() const; - void setVariableParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DetonationPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyAreaAimpoint.cpp b/src/dis7/DirectedEnergyAreaAimpoint.cpp deleted file mode 100644 index e5a8e499..00000000 --- a/src/dis7/DirectedEnergyAreaAimpoint.cpp +++ /dev/null @@ -1,218 +0,0 @@ -#include - -using namespace DIS; - - -DirectedEnergyAreaAimpoint::DirectedEnergyAreaAimpoint(): - _recordType(4001), - _recordLength(0), - _padding(0), - _beamAntennaPatternRecordCount(0), - _directedEnergyTargetEnergyDepositionRecordCount(0) -{ -} - -DirectedEnergyAreaAimpoint::~DirectedEnergyAreaAimpoint() -{ - _beamAntennaParameterList.clear(); - _directedEnergyTargetEnergyDepositionRecordList.clear(); -} - -unsigned int DirectedEnergyAreaAimpoint::getRecordType() const -{ - return _recordType; -} - -void DirectedEnergyAreaAimpoint::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short DirectedEnergyAreaAimpoint::getRecordLength() const -{ - return _recordLength; -} - -void DirectedEnergyAreaAimpoint::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned short DirectedEnergyAreaAimpoint::getPadding() const -{ - return _padding; -} - -void DirectedEnergyAreaAimpoint::setPadding(unsigned short pX) -{ - _padding = pX; -} - -unsigned short DirectedEnergyAreaAimpoint::getBeamAntennaPatternRecordCount() const -{ - return _beamAntennaParameterList.size(); -} - -unsigned short DirectedEnergyAreaAimpoint::getDirectedEnergyTargetEnergyDepositionRecordCount() const -{ - return _directedEnergyTargetEnergyDepositionRecordList.size(); -} - -std::vector& DirectedEnergyAreaAimpoint::getBeamAntennaParameterList() -{ - return _beamAntennaParameterList; -} - -const std::vector& DirectedEnergyAreaAimpoint::getBeamAntennaParameterList() const -{ - return _beamAntennaParameterList; -} - -void DirectedEnergyAreaAimpoint::setBeamAntennaParameterList(const std::vector& pX) -{ - _beamAntennaParameterList = pX; -} - -std::vector& DirectedEnergyAreaAimpoint::getDirectedEnergyTargetEnergyDepositionRecordList() -{ - return _directedEnergyTargetEnergyDepositionRecordList; -} - -const std::vector& DirectedEnergyAreaAimpoint::getDirectedEnergyTargetEnergyDepositionRecordList() const -{ - return _directedEnergyTargetEnergyDepositionRecordList; -} - -void DirectedEnergyAreaAimpoint::setDirectedEnergyTargetEnergyDepositionRecordList(const std::vector& pX) -{ - _directedEnergyTargetEnergyDepositionRecordList = pX; -} - -void DirectedEnergyAreaAimpoint::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _padding; - dataStream << ( unsigned short )_beamAntennaParameterList.size(); - dataStream << ( unsigned short )_directedEnergyTargetEnergyDepositionRecordList.size(); - - for(size_t idx = 0; idx < _beamAntennaParameterList.size(); idx++) - { - BeamAntennaPattern x = _beamAntennaParameterList[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _directedEnergyTargetEnergyDepositionRecordList.size(); idx++) - { - DirectedEnergyTargetEnergyDeposition x = _directedEnergyTargetEnergyDepositionRecordList[idx]; - x.marshal(dataStream); - } - -} - -void DirectedEnergyAreaAimpoint::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _padding; - dataStream >> _beamAntennaPatternRecordCount; - dataStream >> _directedEnergyTargetEnergyDepositionRecordCount; - - _beamAntennaParameterList.clear(); - for(size_t idx = 0; idx < _beamAntennaPatternRecordCount; idx++) - { - BeamAntennaPattern x; - x.unmarshal(dataStream); - _beamAntennaParameterList.push_back(x); - } - - _directedEnergyTargetEnergyDepositionRecordList.clear(); - for(size_t idx = 0; idx < _directedEnergyTargetEnergyDepositionRecordCount; idx++) - { - DirectedEnergyTargetEnergyDeposition x; - x.unmarshal(dataStream); - _directedEnergyTargetEnergyDepositionRecordList.push_back(x); - } -} - - -bool DirectedEnergyAreaAimpoint::operator ==(const DirectedEnergyAreaAimpoint& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _beamAntennaParameterList.size(); idx++) - { - if( ! ( _beamAntennaParameterList[idx] == rhs._beamAntennaParameterList[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _directedEnergyTargetEnergyDepositionRecordList.size(); idx++) - { - if( ! ( _directedEnergyTargetEnergyDepositionRecordList[idx] == rhs._directedEnergyTargetEnergyDepositionRecordList[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DirectedEnergyAreaAimpoint::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + 2; // _beamAntennaPatternRecordCount - marshalSize = marshalSize + 2; // _directedEnergyTargetEnergyDepositionRecordCount - - for(unsigned long long idx=0; idx < _beamAntennaParameterList.size(); idx++) - { - BeamAntennaPattern listElement = _beamAntennaParameterList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _directedEnergyTargetEnergyDepositionRecordList.size(); idx++) - { - DirectedEnergyTargetEnergyDeposition listElement = _directedEnergyTargetEnergyDepositionRecordList[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyAreaAimpoint.h b/src/dis7/DirectedEnergyAreaAimpoint.h deleted file mode 100644 index 2839c60a..00000000 --- a/src/dis7/DirectedEnergyAreaAimpoint.h +++ /dev/null @@ -1,107 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// DE Precision Aimpoint Record. NOT COMPLETE. Section 6.2.21.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DirectedEnergyAreaAimpoint -{ -protected: - /** Type of Record */ - unsigned int _recordType; - - /** Length of Record */ - unsigned short _recordLength; - - /** Padding */ - unsigned short _padding; - - /** Number of beam antenna pattern records */ - unsigned short _beamAntennaPatternRecordCount; - - /** Number of DE target energy depositon records */ - unsigned short _directedEnergyTargetEnergyDepositionRecordCount; - - /** list of beam antenna records. See 6.2.9.2 */ - std::vector _beamAntennaParameterList; - - /** list of DE target deposition records. See 6.2.21.4 */ - std::vector _directedEnergyTargetEnergyDepositionRecordList; - - - public: - DirectedEnergyAreaAimpoint(); - virtual ~DirectedEnergyAreaAimpoint(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - unsigned short getBeamAntennaPatternRecordCount() const; - - unsigned short getDirectedEnergyTargetEnergyDepositionRecordCount() const; - - std::vector& getBeamAntennaParameterList(); - const std::vector& getBeamAntennaParameterList() const; - void setBeamAntennaParameterList(const std::vector& pX); - - std::vector& getDirectedEnergyTargetEnergyDepositionRecordList(); - const std::vector& getDirectedEnergyTargetEnergyDepositionRecordList() const; - void setDirectedEnergyTargetEnergyDepositionRecordList(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DirectedEnergyAreaAimpoint& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyDamage.cpp b/src/dis7/DirectedEnergyDamage.cpp deleted file mode 100644 index be482ca3..00000000 --- a/src/dis7/DirectedEnergyDamage.cpp +++ /dev/null @@ -1,257 +0,0 @@ -#include - -using namespace DIS; - - -DirectedEnergyDamage::DirectedEnergyDamage(): - _recordType(4500), - _recordLength(40), - _padding(0), - _damageLocation(), - _damageDiameter(0.0), - _temperature(-273.15), - _componentIdentification(0), - _componentDamageStatus(0), - _componentVisualDamageStatus(0), - _componentVisualSmokeColor(0), - _fireEventID(), - _padding2(0) -{ -} - -DirectedEnergyDamage::~DirectedEnergyDamage() -{ -} - -unsigned int DirectedEnergyDamage::getRecordType() const -{ - return _recordType; -} - -void DirectedEnergyDamage::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short DirectedEnergyDamage::getRecordLength() const -{ - return _recordLength; -} - -void DirectedEnergyDamage::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned short DirectedEnergyDamage::getPadding() const -{ - return _padding; -} - -void DirectedEnergyDamage::setPadding(unsigned short pX) -{ - _padding = pX; -} - -Vector3Float& DirectedEnergyDamage::getDamageLocation() -{ - return _damageLocation; -} - -const Vector3Float& DirectedEnergyDamage::getDamageLocation() const -{ - return _damageLocation; -} - -void DirectedEnergyDamage::setDamageLocation(const Vector3Float &pX) -{ - _damageLocation = pX; -} - -float DirectedEnergyDamage::getDamageDiameter() const -{ - return _damageDiameter; -} - -void DirectedEnergyDamage::setDamageDiameter(float pX) -{ - _damageDiameter = pX; -} - -float DirectedEnergyDamage::getTemperature() const -{ - return _temperature; -} - -void DirectedEnergyDamage::setTemperature(float pX) -{ - _temperature = pX; -} - -unsigned char DirectedEnergyDamage::getComponentIdentification() const -{ - return _componentIdentification; -} - -void DirectedEnergyDamage::setComponentIdentification(unsigned char pX) -{ - _componentIdentification = pX; -} - -unsigned char DirectedEnergyDamage::getComponentDamageStatus() const -{ - return _componentDamageStatus; -} - -void DirectedEnergyDamage::setComponentDamageStatus(unsigned char pX) -{ - _componentDamageStatus = pX; -} - -unsigned char DirectedEnergyDamage::getComponentVisualDamageStatus() const -{ - return _componentVisualDamageStatus; -} - -void DirectedEnergyDamage::setComponentVisualDamageStatus(unsigned char pX) -{ - _componentVisualDamageStatus = pX; -} - -unsigned char DirectedEnergyDamage::getComponentVisualSmokeColor() const -{ - return _componentVisualSmokeColor; -} - -void DirectedEnergyDamage::setComponentVisualSmokeColor(unsigned char pX) -{ - _componentVisualSmokeColor = pX; -} - -EventIdentifier& DirectedEnergyDamage::getFireEventID() -{ - return _fireEventID; -} - -const EventIdentifier& DirectedEnergyDamage::getFireEventID() const -{ - return _fireEventID; -} - -void DirectedEnergyDamage::setFireEventID(const EventIdentifier &pX) -{ - _fireEventID = pX; -} - -unsigned short DirectedEnergyDamage::getPadding2() const -{ - return _padding2; -} - -void DirectedEnergyDamage::setPadding2(unsigned short pX) -{ - _padding2 = pX; -} - -void DirectedEnergyDamage::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _padding; - _damageLocation.marshal(dataStream); - dataStream << _damageDiameter; - dataStream << _temperature; - dataStream << _componentIdentification; - dataStream << _componentDamageStatus; - dataStream << _componentVisualDamageStatus; - dataStream << _componentVisualSmokeColor; - _fireEventID.marshal(dataStream); - dataStream << _padding2; -} - -void DirectedEnergyDamage::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _padding; - _damageLocation.unmarshal(dataStream); - dataStream >> _damageDiameter; - dataStream >> _temperature; - dataStream >> _componentIdentification; - dataStream >> _componentDamageStatus; - dataStream >> _componentVisualDamageStatus; - dataStream >> _componentVisualSmokeColor; - _fireEventID.unmarshal(dataStream); - dataStream >> _padding2; -} - - -bool DirectedEnergyDamage::operator ==(const DirectedEnergyDamage& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_damageLocation == rhs._damageLocation) ) ivarsEqual = false; - if( ! (_damageDiameter == rhs._damageDiameter) ) ivarsEqual = false; - if( ! (_temperature == rhs._temperature) ) ivarsEqual = false; - if( ! (_componentIdentification == rhs._componentIdentification) ) ivarsEqual = false; - if( ! (_componentDamageStatus == rhs._componentDamageStatus) ) ivarsEqual = false; - if( ! (_componentVisualDamageStatus == rhs._componentVisualDamageStatus) ) ivarsEqual = false; - if( ! (_componentVisualSmokeColor == rhs._componentVisualSmokeColor) ) ivarsEqual = false; - if( ! (_fireEventID == rhs._fireEventID) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - return ivarsEqual; - } - -int DirectedEnergyDamage::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + _damageLocation.getMarshalledSize(); // _damageLocation - marshalSize = marshalSize + 4; // _damageDiameter - marshalSize = marshalSize + 4; // _temperature - marshalSize = marshalSize + 1; // _componentIdentification - marshalSize = marshalSize + 1; // _componentDamageStatus - marshalSize = marshalSize + 1; // _componentVisualDamageStatus - marshalSize = marshalSize + 1; // _componentVisualSmokeColor - marshalSize = marshalSize + _fireEventID.getMarshalledSize(); // _fireEventID - marshalSize = marshalSize + 2; // _padding2 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyDamage.h b/src/dis7/DirectedEnergyDamage.h deleted file mode 100644 index 5276a1a0..00000000 --- a/src/dis7/DirectedEnergyDamage.h +++ /dev/null @@ -1,138 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Damage sustained by an entity due to directed energy. Location of the damage based on a relative x,y,z location from the center of the entity. Section 6.2.17.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DirectedEnergyDamage -{ -protected: - /** DE Record Type. */ - unsigned int _recordType; - - /** DE Record Length (bytes). */ - unsigned short _recordLength; - - /** padding. */ - unsigned short _padding; - - /** location of damage, relative to center of entity */ - Vector3Float _damageLocation; - - /** Size of damaged area, in meters. */ - float _damageDiameter; - - /** average temp of the damaged area, in degrees celsius. If firing entitty does not model this, use a value of -273.15 */ - float _temperature; - - /** enumeration */ - unsigned char _componentIdentification; - - /** enumeration */ - unsigned char _componentDamageStatus; - - /** enumeration */ - unsigned char _componentVisualDamageStatus; - - /** enumeration */ - unsigned char _componentVisualSmokeColor; - - /** For any component damage resulting this field shall be set to the fire event ID from that PDU. */ - EventIdentifier _fireEventID; - - /** padding */ - unsigned short _padding2; - - - public: - DirectedEnergyDamage(); - virtual ~DirectedEnergyDamage(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - Vector3Float& getDamageLocation(); - const Vector3Float& getDamageLocation() const; - void setDamageLocation(const Vector3Float &pX); - - float getDamageDiameter() const; - void setDamageDiameter(float pX); - - float getTemperature() const; - void setTemperature(float pX); - - unsigned char getComponentIdentification() const; - void setComponentIdentification(unsigned char pX); - - unsigned char getComponentDamageStatus() const; - void setComponentDamageStatus(unsigned char pX); - - unsigned char getComponentVisualDamageStatus() const; - void setComponentVisualDamageStatus(unsigned char pX); - - unsigned char getComponentVisualSmokeColor() const; - void setComponentVisualSmokeColor(unsigned char pX); - - EventIdentifier& getFireEventID(); - const EventIdentifier& getFireEventID() const; - void setFireEventID(const EventIdentifier &pX); - - unsigned short getPadding2() const; - void setPadding2(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DirectedEnergyDamage& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyFirePdu.cpp b/src/dis7/DirectedEnergyFirePdu.cpp deleted file mode 100644 index 76f4aa06..00000000 --- a/src/dis7/DirectedEnergyFirePdu.cpp +++ /dev/null @@ -1,351 +0,0 @@ -#include - -using namespace DIS; - - -DirectedEnergyFirePdu::DirectedEnergyFirePdu() : WarfareFamilyPdu(), - _munitionType(), - _shotStartTime(), - _commulativeShotTime(0.0), - _ApertureEmitterLocation(), - _apertureDiameter(0.0), - _wavelength(0.0), - _peakIrradiance(0.0), - _pulseRepetitionFrequency(0.0), - _pulseWidth(0), - _flags(0), - _pulseShape(0), - _padding1(0), - _padding2(0), - _padding3(0), - _numberOfDERecords(0) -{ - setPduType( 68 ); -} - -DirectedEnergyFirePdu::~DirectedEnergyFirePdu() -{ - _dERecords.clear(); -} - -EntityType& DirectedEnergyFirePdu::getMunitionType() -{ - return _munitionType; -} - -const EntityType& DirectedEnergyFirePdu::getMunitionType() const -{ - return _munitionType; -} - -void DirectedEnergyFirePdu::setMunitionType(const EntityType &pX) -{ - _munitionType = pX; -} - -ClockTime& DirectedEnergyFirePdu::getShotStartTime() -{ - return _shotStartTime; -} - -const ClockTime& DirectedEnergyFirePdu::getShotStartTime() const -{ - return _shotStartTime; -} - -void DirectedEnergyFirePdu::setShotStartTime(const ClockTime &pX) -{ - _shotStartTime = pX; -} - -float DirectedEnergyFirePdu::getCommulativeShotTime() const -{ - return _commulativeShotTime; -} - -void DirectedEnergyFirePdu::setCommulativeShotTime(float pX) -{ - _commulativeShotTime = pX; -} - -Vector3Float& DirectedEnergyFirePdu::getApertureEmitterLocation() -{ - return _ApertureEmitterLocation; -} - -const Vector3Float& DirectedEnergyFirePdu::getApertureEmitterLocation() const -{ - return _ApertureEmitterLocation; -} - -void DirectedEnergyFirePdu::setApertureEmitterLocation(const Vector3Float &pX) -{ - _ApertureEmitterLocation = pX; -} - -float DirectedEnergyFirePdu::getApertureDiameter() const -{ - return _apertureDiameter; -} - -void DirectedEnergyFirePdu::setApertureDiameter(float pX) -{ - _apertureDiameter = pX; -} - -float DirectedEnergyFirePdu::getWavelength() const -{ - return _wavelength; -} - -void DirectedEnergyFirePdu::setWavelength(float pX) -{ - _wavelength = pX; -} - -float DirectedEnergyFirePdu::getPeakIrradiance() const -{ - return _peakIrradiance; -} - -void DirectedEnergyFirePdu::setPeakIrradiance(float pX) -{ - _peakIrradiance = pX; -} - -float DirectedEnergyFirePdu::getPulseRepetitionFrequency() const -{ - return _pulseRepetitionFrequency; -} - -void DirectedEnergyFirePdu::setPulseRepetitionFrequency(float pX) -{ - _pulseRepetitionFrequency = pX; -} - -int DirectedEnergyFirePdu::getPulseWidth() const -{ - return _pulseWidth; -} - -void DirectedEnergyFirePdu::setPulseWidth(int pX) -{ - _pulseWidth = pX; -} - -int DirectedEnergyFirePdu::getFlags() const -{ - return _flags; -} - -void DirectedEnergyFirePdu::setFlags(int pX) -{ - _flags = pX; -} - -char DirectedEnergyFirePdu::getPulseShape() const -{ - return _pulseShape; -} - -void DirectedEnergyFirePdu::setPulseShape(char pX) -{ - _pulseShape = pX; -} - -unsigned char DirectedEnergyFirePdu::getPadding1() const -{ - return _padding1; -} - -void DirectedEnergyFirePdu::setPadding1(unsigned char pX) -{ - _padding1 = pX; -} - -unsigned int DirectedEnergyFirePdu::getPadding2() const -{ - return _padding2; -} - -void DirectedEnergyFirePdu::setPadding2(unsigned int pX) -{ - _padding2 = pX; -} - -unsigned short DirectedEnergyFirePdu::getPadding3() const -{ - return _padding3; -} - -void DirectedEnergyFirePdu::setPadding3(unsigned short pX) -{ - _padding3 = pX; -} - -unsigned short DirectedEnergyFirePdu::getNumberOfDERecords() const -{ - return _dERecords.size(); -} - -std::vector& DirectedEnergyFirePdu::getDERecords() -{ - return _dERecords; -} - -const std::vector& DirectedEnergyFirePdu::getDERecords() const -{ - return _dERecords; -} - -void DirectedEnergyFirePdu::setDERecords(const std::vector& pX) -{ - _dERecords = pX; -} - -void DirectedEnergyFirePdu::marshal(DataStream& dataStream) const -{ - WarfareFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _munitionType.marshal(dataStream); - _shotStartTime.marshal(dataStream); - dataStream << _commulativeShotTime; - _ApertureEmitterLocation.marshal(dataStream); - dataStream << _apertureDiameter; - dataStream << _wavelength; - dataStream << _peakIrradiance; - dataStream << _pulseRepetitionFrequency; - dataStream << _pulseWidth; - dataStream << _flags; - dataStream << _pulseShape; - dataStream << _padding1; - dataStream << _padding2; - dataStream << _padding3; - dataStream << ( unsigned short )_dERecords.size(); - - for(size_t idx = 0; idx < _dERecords.size(); idx++) - { - StandardVariableSpecification x = _dERecords[idx]; - x.marshal(dataStream); - } - -} - -void DirectedEnergyFirePdu::unmarshal(DataStream& dataStream) -{ - WarfareFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _munitionType.unmarshal(dataStream); - _shotStartTime.unmarshal(dataStream); - dataStream >> _commulativeShotTime; - _ApertureEmitterLocation.unmarshal(dataStream); - dataStream >> _apertureDiameter; - dataStream >> _wavelength; - dataStream >> _peakIrradiance; - dataStream >> _pulseRepetitionFrequency; - dataStream >> _pulseWidth; - dataStream >> _flags; - dataStream >> _pulseShape; - dataStream >> _padding1; - dataStream >> _padding2; - dataStream >> _padding3; - dataStream >> _numberOfDERecords; - - _dERecords.clear(); - for(size_t idx = 0; idx < _numberOfDERecords; idx++) - { - StandardVariableSpecification x; - x.unmarshal(dataStream); - _dERecords.push_back(x); - } -} - - -bool DirectedEnergyFirePdu::operator ==(const DirectedEnergyFirePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = WarfareFamilyPdu::operator==(rhs); - - if( ! (_munitionType == rhs._munitionType) ) ivarsEqual = false; - if( ! (_shotStartTime == rhs._shotStartTime) ) ivarsEqual = false; - if( ! (_commulativeShotTime == rhs._commulativeShotTime) ) ivarsEqual = false; - if( ! (_ApertureEmitterLocation == rhs._ApertureEmitterLocation) ) ivarsEqual = false; - if( ! (_apertureDiameter == rhs._apertureDiameter) ) ivarsEqual = false; - if( ! (_wavelength == rhs._wavelength) ) ivarsEqual = false; - if( ! (_peakIrradiance == rhs._peakIrradiance) ) ivarsEqual = false; - if( ! (_pulseRepetitionFrequency == rhs._pulseRepetitionFrequency) ) ivarsEqual = false; - if( ! (_pulseWidth == rhs._pulseWidth) ) ivarsEqual = false; - if( ! (_flags == rhs._flags) ) ivarsEqual = false; - if( ! (_pulseShape == rhs._pulseShape) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_padding3 == rhs._padding3) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _dERecords.size(); idx++) - { - if( ! ( _dERecords[idx] == rhs._dERecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int DirectedEnergyFirePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = WarfareFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _munitionType.getMarshalledSize(); // _munitionType - marshalSize = marshalSize + _shotStartTime.getMarshalledSize(); // _shotStartTime - marshalSize = marshalSize + 4; // _commulativeShotTime - marshalSize = marshalSize + _ApertureEmitterLocation.getMarshalledSize(); // _ApertureEmitterLocation - marshalSize = marshalSize + 4; // _apertureDiameter - marshalSize = marshalSize + 4; // _wavelength - marshalSize = marshalSize + 4; // _peakIrradiance - marshalSize = marshalSize + 4; // _pulseRepetitionFrequency - marshalSize = marshalSize + 4; // _pulseWidth - marshalSize = marshalSize + 4; // _flags - marshalSize = marshalSize + 1; // _pulseShape - marshalSize = marshalSize + 1; // _padding1 - marshalSize = marshalSize + 4; // _padding2 - marshalSize = marshalSize + 2; // _padding3 - marshalSize = marshalSize + 2; // _numberOfDERecords - - for(unsigned long long idx=0; idx < _dERecords.size(); idx++) - { - StandardVariableSpecification listElement = _dERecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyFirePdu.h b/src/dis7/DirectedEnergyFirePdu.h deleted file mode 100644 index 4f75e74c..00000000 --- a/src/dis7/DirectedEnergyFirePdu.h +++ /dev/null @@ -1,167 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Firing of a directed energy weapon shall be communicated by issuing a Directed Energy Fire PDU Section 7.3.4 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DirectedEnergyFirePdu : public WarfareFamilyPdu -{ -protected: - /** Field shall identify the munition type enumeration for the DE weapon beam, Section 7.3.4 */ - EntityType _munitionType; - - /** Field shall indicate the simulation time at start of the shot, Section 7.3.4 */ - ClockTime _shotStartTime; - - /** Field shall indicate the current cumulative duration of the shot, Section 7.3.4 */ - float _commulativeShotTime; - - /** Field shall identify the location of the DE weapon aperture/emitter, Section 7.3.4 */ - Vector3Float _ApertureEmitterLocation; - - /** Field shall identify the beam diameter at the aperture/emitter, Section 7.3.4 */ - float _apertureDiameter; - - /** Field shall identify the emissions wavelength in units of meters, Section 7.3.4 */ - float _wavelength; - - /** Field shall identify the current peak irradiance of emissions in units of Watts per square meter, Section 7.3.4 */ - float _peakIrradiance; - - /** field shall identify the current pulse repetition frequency in units of cycles per second (Hertz), Section 7.3.4 */ - float _pulseRepetitionFrequency; - - /** field shall identify the pulse width emissions in units of seconds, Section 7.3.4 */ - int _pulseWidth; - - /** 16bit Boolean field shall contain various flags to indicate status information needed to process a DE, Section 7.3.4 */ - int _flags; - - /** Field shall identify the pulse shape and shall be represented as an 8-bit enumeration, Section 7.3.4 */ - char _pulseShape; - - /** padding, Section 7.3.4 */ - unsigned char _padding1; - - /** padding, Section 7.3.4 */ - unsigned int _padding2; - - /** padding, Section 7.3.4 */ - unsigned short _padding3; - - /** Field shall specify the number of DE records, Section 7.3.4 */ - unsigned short _numberOfDERecords; - - /** Fields shall contain one or more DE records, records shall conform to the variable record format (Section6.2.82), Section 7.3.4 */ - std::vector _dERecords; - - - public: - DirectedEnergyFirePdu(); - virtual ~DirectedEnergyFirePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getMunitionType(); - const EntityType& getMunitionType() const; - void setMunitionType(const EntityType &pX); - - ClockTime& getShotStartTime(); - const ClockTime& getShotStartTime() const; - void setShotStartTime(const ClockTime &pX); - - float getCommulativeShotTime() const; - void setCommulativeShotTime(float pX); - - Vector3Float& getApertureEmitterLocation(); - const Vector3Float& getApertureEmitterLocation() const; - void setApertureEmitterLocation(const Vector3Float &pX); - - float getApertureDiameter() const; - void setApertureDiameter(float pX); - - float getWavelength() const; - void setWavelength(float pX); - - float getPeakIrradiance() const; - void setPeakIrradiance(float pX); - - float getPulseRepetitionFrequency() const; - void setPulseRepetitionFrequency(float pX); - - int getPulseWidth() const; - void setPulseWidth(int pX); - - int getFlags() const; - void setFlags(int pX); - - char getPulseShape() const; - void setPulseShape(char pX); - - unsigned char getPadding1() const; - void setPadding1(unsigned char pX); - - unsigned int getPadding2() const; - void setPadding2(unsigned int pX); - - unsigned short getPadding3() const; - void setPadding3(unsigned short pX); - - unsigned short getNumberOfDERecords() const; - - std::vector& getDERecords(); - const std::vector& getDERecords() const; - void setDERecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DirectedEnergyFirePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyPrecisionAimpoint.cpp b/src/dis7/DirectedEnergyPrecisionAimpoint.cpp deleted file mode 100644 index 3afd5f3c..00000000 --- a/src/dis7/DirectedEnergyPrecisionAimpoint.cpp +++ /dev/null @@ -1,287 +0,0 @@ -#include - -using namespace DIS; - - -DirectedEnergyPrecisionAimpoint::DirectedEnergyPrecisionAimpoint(): - _recordType(4000), - _recordLength(88), - _padding(0), - _targetSpotLocation(), - _targetSpotEntityLocation(), - _targetSpotVelocity(), - _targetSpotAcceleration(), - _targetEntityID(), - _targetComponentID(0), - _SpotShape(0), - _BeamSpotXSecSemiMajorAxis(0), - _BeamSpotCrossSectionSemiMinorAxis(0), - _BeamSpotCrossSectionOrientAngle(0) -{ -} - -DirectedEnergyPrecisionAimpoint::~DirectedEnergyPrecisionAimpoint() -{ -} - -unsigned int DirectedEnergyPrecisionAimpoint::getRecordType() const -{ - return _recordType; -} - -void DirectedEnergyPrecisionAimpoint::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short DirectedEnergyPrecisionAimpoint::getRecordLength() const -{ - return _recordLength; -} - -void DirectedEnergyPrecisionAimpoint::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned short DirectedEnergyPrecisionAimpoint::getPadding() const -{ - return _padding; -} - -void DirectedEnergyPrecisionAimpoint::setPadding(unsigned short pX) -{ - _padding = pX; -} - -Vector3Double& DirectedEnergyPrecisionAimpoint::getTargetSpotLocation() -{ - return _targetSpotLocation; -} - -const Vector3Double& DirectedEnergyPrecisionAimpoint::getTargetSpotLocation() const -{ - return _targetSpotLocation; -} - -void DirectedEnergyPrecisionAimpoint::setTargetSpotLocation(const Vector3Double &pX) -{ - _targetSpotLocation = pX; -} - -Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotEntityLocation() -{ - return _targetSpotEntityLocation; -} - -const Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotEntityLocation() const -{ - return _targetSpotEntityLocation; -} - -void DirectedEnergyPrecisionAimpoint::setTargetSpotEntityLocation(const Vector3Float &pX) -{ - _targetSpotEntityLocation = pX; -} - -Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotVelocity() -{ - return _targetSpotVelocity; -} - -const Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotVelocity() const -{ - return _targetSpotVelocity; -} - -void DirectedEnergyPrecisionAimpoint::setTargetSpotVelocity(const Vector3Float &pX) -{ - _targetSpotVelocity = pX; -} - -Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotAcceleration() -{ - return _targetSpotAcceleration; -} - -const Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotAcceleration() const -{ - return _targetSpotAcceleration; -} - -void DirectedEnergyPrecisionAimpoint::setTargetSpotAcceleration(const Vector3Float &pX) -{ - _targetSpotAcceleration = pX; -} - -EntityID& DirectedEnergyPrecisionAimpoint::getTargetEntityID() -{ - return _targetEntityID; -} - -const EntityID& DirectedEnergyPrecisionAimpoint::getTargetEntityID() const -{ - return _targetEntityID; -} - -void DirectedEnergyPrecisionAimpoint::setTargetEntityID(const EntityID &pX) -{ - _targetEntityID = pX; -} - -unsigned char DirectedEnergyPrecisionAimpoint::getTargetComponentID() const -{ - return _targetComponentID; -} - -void DirectedEnergyPrecisionAimpoint::setTargetComponentID(unsigned char pX) -{ - _targetComponentID = pX; -} - -unsigned char DirectedEnergyPrecisionAimpoint::getSpotShape() const -{ - return _SpotShape; -} - -void DirectedEnergyPrecisionAimpoint::setSpotShape(unsigned char pX) -{ - _SpotShape = pX; -} - -float DirectedEnergyPrecisionAimpoint::getBeamSpotXSecSemiMajorAxis() const -{ - return _BeamSpotXSecSemiMajorAxis; -} - -void DirectedEnergyPrecisionAimpoint::setBeamSpotXSecSemiMajorAxis(float pX) -{ - _BeamSpotXSecSemiMajorAxis = pX; -} - -float DirectedEnergyPrecisionAimpoint::getBeamSpotCrossSectionSemiMinorAxis() const -{ - return _BeamSpotCrossSectionSemiMinorAxis; -} - -void DirectedEnergyPrecisionAimpoint::setBeamSpotCrossSectionSemiMinorAxis(float pX) -{ - _BeamSpotCrossSectionSemiMinorAxis = pX; -} - -float DirectedEnergyPrecisionAimpoint::getBeamSpotCrossSectionOrientAngle() const -{ - return _BeamSpotCrossSectionOrientAngle; -} - -void DirectedEnergyPrecisionAimpoint::setBeamSpotCrossSectionOrientAngle(float pX) -{ - _BeamSpotCrossSectionOrientAngle = pX; -} - -void DirectedEnergyPrecisionAimpoint::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _padding; - _targetSpotLocation.marshal(dataStream); - _targetSpotEntityLocation.marshal(dataStream); - _targetSpotVelocity.marshal(dataStream); - _targetSpotAcceleration.marshal(dataStream); - _targetEntityID.marshal(dataStream); - dataStream << _targetComponentID; - dataStream << _SpotShape; - dataStream << _BeamSpotXSecSemiMajorAxis; - dataStream << _BeamSpotCrossSectionSemiMinorAxis; - dataStream << _BeamSpotCrossSectionOrientAngle; -} - -void DirectedEnergyPrecisionAimpoint::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _padding; - _targetSpotLocation.unmarshal(dataStream); - _targetSpotEntityLocation.unmarshal(dataStream); - _targetSpotVelocity.unmarshal(dataStream); - _targetSpotAcceleration.unmarshal(dataStream); - _targetEntityID.unmarshal(dataStream); - dataStream >> _targetComponentID; - dataStream >> _SpotShape; - dataStream >> _BeamSpotXSecSemiMajorAxis; - dataStream >> _BeamSpotCrossSectionSemiMinorAxis; - dataStream >> _BeamSpotCrossSectionOrientAngle; -} - - -bool DirectedEnergyPrecisionAimpoint::operator ==(const DirectedEnergyPrecisionAimpoint& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_targetSpotLocation == rhs._targetSpotLocation) ) ivarsEqual = false; - if( ! (_targetSpotEntityLocation == rhs._targetSpotEntityLocation) ) ivarsEqual = false; - if( ! (_targetSpotVelocity == rhs._targetSpotVelocity) ) ivarsEqual = false; - if( ! (_targetSpotAcceleration == rhs._targetSpotAcceleration) ) ivarsEqual = false; - if( ! (_targetEntityID == rhs._targetEntityID) ) ivarsEqual = false; - if( ! (_targetComponentID == rhs._targetComponentID) ) ivarsEqual = false; - if( ! (_SpotShape == rhs._SpotShape) ) ivarsEqual = false; - if( ! (_BeamSpotXSecSemiMajorAxis == rhs._BeamSpotXSecSemiMajorAxis) ) ivarsEqual = false; - if( ! (_BeamSpotCrossSectionSemiMinorAxis == rhs._BeamSpotCrossSectionSemiMinorAxis) ) ivarsEqual = false; - if( ! (_BeamSpotCrossSectionOrientAngle == rhs._BeamSpotCrossSectionOrientAngle) ) ivarsEqual = false; - - return ivarsEqual; - } - -int DirectedEnergyPrecisionAimpoint::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + _targetSpotLocation.getMarshalledSize(); // _targetSpotLocation - marshalSize = marshalSize + _targetSpotEntityLocation.getMarshalledSize(); // _targetSpotEntityLocation - marshalSize = marshalSize + _targetSpotVelocity.getMarshalledSize(); // _targetSpotVelocity - marshalSize = marshalSize + _targetSpotAcceleration.getMarshalledSize(); // _targetSpotAcceleration - marshalSize = marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID - marshalSize = marshalSize + 1; // _targetComponentID - marshalSize = marshalSize + 1; // _SpotShape - marshalSize = marshalSize + 4; // _BeamSpotXSecSemiMajorAxis - marshalSize = marshalSize + 4; // _BeamSpotCrossSectionSemiMinorAxis - marshalSize = marshalSize + 4; // _BeamSpotCrossSectionOrientAngle - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyPrecisionAimpoint.h b/src/dis7/DirectedEnergyPrecisionAimpoint.h deleted file mode 100644 index 9ce4860a..00000000 --- a/src/dis7/DirectedEnergyPrecisionAimpoint.h +++ /dev/null @@ -1,150 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// DE Precision Aimpoint Record. Section 6.2.21.3 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DirectedEnergyPrecisionAimpoint -{ -protected: - /** Type of Record */ - unsigned int _recordType; - - /** Length of Record */ - unsigned short _recordLength; - - /** Padding */ - unsigned short _padding; - - /** Position of Target Spot in World Coordinates. */ - Vector3Double _targetSpotLocation; - - /** Position (meters) of Target Spot relative to Entity Position. */ - Vector3Float _targetSpotEntityLocation; - - /** Velocity (meters/sec) of Target Spot. */ - Vector3Float _targetSpotVelocity; - - /** Acceleration (meters/sec/sec) of Target Spot. */ - Vector3Float _targetSpotAcceleration; - - /** Unique ID of the target entity. */ - EntityID _targetEntityID; - - /** Target Component ID ENUM, same as in DamageDescriptionRecord. */ - unsigned char _targetComponentID; - - /** Spot Shape ENUM. */ - unsigned char _SpotShape; - - /** Beam Spot Cross Section Semi-Major Axis. */ - float _BeamSpotXSecSemiMajorAxis; - - /** Beam Spot Cross Section Semi-Major Axis. */ - float _BeamSpotCrossSectionSemiMinorAxis; - - /** Beam Spot Cross Section Orientation Angle. */ - float _BeamSpotCrossSectionOrientAngle; - - - public: - DirectedEnergyPrecisionAimpoint(); - virtual ~DirectedEnergyPrecisionAimpoint(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - Vector3Double& getTargetSpotLocation(); - const Vector3Double& getTargetSpotLocation() const; - void setTargetSpotLocation(const Vector3Double &pX); - - Vector3Float& getTargetSpotEntityLocation(); - const Vector3Float& getTargetSpotEntityLocation() const; - void setTargetSpotEntityLocation(const Vector3Float &pX); - - Vector3Float& getTargetSpotVelocity(); - const Vector3Float& getTargetSpotVelocity() const; - void setTargetSpotVelocity(const Vector3Float &pX); - - Vector3Float& getTargetSpotAcceleration(); - const Vector3Float& getTargetSpotAcceleration() const; - void setTargetSpotAcceleration(const Vector3Float &pX); - - EntityID& getTargetEntityID(); - const EntityID& getTargetEntityID() const; - void setTargetEntityID(const EntityID &pX); - - unsigned char getTargetComponentID() const; - void setTargetComponentID(unsigned char pX); - - unsigned char getSpotShape() const; - void setSpotShape(unsigned char pX); - - float getBeamSpotXSecSemiMajorAxis() const; - void setBeamSpotXSecSemiMajorAxis(float pX); - - float getBeamSpotCrossSectionSemiMinorAxis() const; - void setBeamSpotCrossSectionSemiMinorAxis(float pX); - - float getBeamSpotCrossSectionOrientAngle() const; - void setBeamSpotCrossSectionOrientAngle(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DirectedEnergyPrecisionAimpoint& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyTargetEnergyDeposition.cpp b/src/dis7/DirectedEnergyTargetEnergyDeposition.cpp deleted file mode 100644 index c7eda706..00000000 --- a/src/dis7/DirectedEnergyTargetEnergyDeposition.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include - -using namespace DIS; - - -DirectedEnergyTargetEnergyDeposition::DirectedEnergyTargetEnergyDeposition(): - _targetEntityID(), - _padding(0), - _peakIrradiance(0.0) -{ -} - -DirectedEnergyTargetEnergyDeposition::~DirectedEnergyTargetEnergyDeposition() -{ -} - -EntityID& DirectedEnergyTargetEnergyDeposition::getTargetEntityID() -{ - return _targetEntityID; -} - -const EntityID& DirectedEnergyTargetEnergyDeposition::getTargetEntityID() const -{ - return _targetEntityID; -} - -void DirectedEnergyTargetEnergyDeposition::setTargetEntityID(const EntityID &pX) -{ - _targetEntityID = pX; -} - -unsigned short DirectedEnergyTargetEnergyDeposition::getPadding() const -{ - return _padding; -} - -void DirectedEnergyTargetEnergyDeposition::setPadding(unsigned short pX) -{ - _padding = pX; -} - -float DirectedEnergyTargetEnergyDeposition::getPeakIrradiance() const -{ - return _peakIrradiance; -} - -void DirectedEnergyTargetEnergyDeposition::setPeakIrradiance(float pX) -{ - _peakIrradiance = pX; -} - -void DirectedEnergyTargetEnergyDeposition::marshal(DataStream& dataStream) const -{ - _targetEntityID.marshal(dataStream); - dataStream << _padding; - dataStream << _peakIrradiance; -} - -void DirectedEnergyTargetEnergyDeposition::unmarshal(DataStream& dataStream) -{ - _targetEntityID.unmarshal(dataStream); - dataStream >> _padding; - dataStream >> _peakIrradiance; -} - - -bool DirectedEnergyTargetEnergyDeposition::operator ==(const DirectedEnergyTargetEnergyDeposition& rhs) const - { - bool ivarsEqual = true; - - if( ! (_targetEntityID == rhs._targetEntityID) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_peakIrradiance == rhs._peakIrradiance) ) ivarsEqual = false; - - return ivarsEqual; - } - -int DirectedEnergyTargetEnergyDeposition::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + 4; // _peakIrradiance - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DirectedEnergyTargetEnergyDeposition.h b/src/dis7/DirectedEnergyTargetEnergyDeposition.h deleted file mode 100644 index b2b91ccf..00000000 --- a/src/dis7/DirectedEnergyTargetEnergyDeposition.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// DE energy depostion properties for a target entity. Section 6.2.21.4 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DirectedEnergyTargetEnergyDeposition -{ -protected: - /** Unique ID of the target entity. */ - EntityID _targetEntityID; - - /** padding */ - unsigned short _padding; - - /** Peak irrandiance */ - float _peakIrradiance; - - - public: - DirectedEnergyTargetEnergyDeposition(); - virtual ~DirectedEnergyTargetEnergyDeposition(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getTargetEntityID(); - const EntityID& getTargetEntityID() const; - void setTargetEntityID(const EntityID &pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - float getPeakIrradiance() const; - void setPeakIrradiance(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DirectedEnergyTargetEnergyDeposition& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DistributedEmissionsFamilyPdu.cpp b/src/dis7/DistributedEmissionsFamilyPdu.cpp deleted file mode 100644 index 10b27295..00000000 --- a/src/dis7/DistributedEmissionsFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -DistributedEmissionsFamilyPdu::DistributedEmissionsFamilyPdu() : Pdu() - -{ - setProtocolFamily( 6 ); -} - -DistributedEmissionsFamilyPdu::~DistributedEmissionsFamilyPdu() -{ -} - -void DistributedEmissionsFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void DistributedEmissionsFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool DistributedEmissionsFamilyPdu::operator ==(const DistributedEmissionsFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int DistributedEmissionsFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/DistributedEmissionsFamilyPdu.h b/src/dis7/DistributedEmissionsFamilyPdu.h deleted file mode 100644 index a0c784ae..00000000 --- a/src/dis7/DistributedEmissionsFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7. Electromagnetic Emissions. Abstract superclass for distirubted emissions PDU - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT DistributedEmissionsFamilyPdu : public Pdu -{ -protected: - - public: - DistributedEmissionsFamilyPdu(); - virtual ~DistributedEmissionsFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const DistributedEmissionsFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EEFundamentalParameterData.cpp b/src/dis7/EEFundamentalParameterData.cpp deleted file mode 100644 index 93a822d2..00000000 --- a/src/dis7/EEFundamentalParameterData.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -EEFundamentalParameterData::EEFundamentalParameterData(): - _frequency(0.0), - _frequencyRange(0.0), - _effectiveRadiatedPower(0.0), - _pulseRepetitionFrequency(0.0), - _pulseWidth(0.0) -{ -} - -EEFundamentalParameterData::~EEFundamentalParameterData() -{ -} - -float EEFundamentalParameterData::getFrequency() const -{ - return _frequency; -} - -void EEFundamentalParameterData::setFrequency(float pX) -{ - _frequency = pX; -} - -float EEFundamentalParameterData::getFrequencyRange() const -{ - return _frequencyRange; -} - -void EEFundamentalParameterData::setFrequencyRange(float pX) -{ - _frequencyRange = pX; -} - -float EEFundamentalParameterData::getEffectiveRadiatedPower() const -{ - return _effectiveRadiatedPower; -} - -void EEFundamentalParameterData::setEffectiveRadiatedPower(float pX) -{ - _effectiveRadiatedPower = pX; -} - -float EEFundamentalParameterData::getPulseRepetitionFrequency() const -{ - return _pulseRepetitionFrequency; -} - -void EEFundamentalParameterData::setPulseRepetitionFrequency(float pX) -{ - _pulseRepetitionFrequency = pX; -} - -float EEFundamentalParameterData::getPulseWidth() const -{ - return _pulseWidth; -} - -void EEFundamentalParameterData::setPulseWidth(float pX) -{ - _pulseWidth = pX; -} - -void EEFundamentalParameterData::marshal(DataStream& dataStream) const -{ - dataStream << _frequency; - dataStream << _frequencyRange; - dataStream << _effectiveRadiatedPower; - dataStream << _pulseRepetitionFrequency; - dataStream << _pulseWidth; -} - -void EEFundamentalParameterData::unmarshal(DataStream& dataStream) -{ - dataStream >> _frequency; - dataStream >> _frequencyRange; - dataStream >> _effectiveRadiatedPower; - dataStream >> _pulseRepetitionFrequency; - dataStream >> _pulseWidth; -} - - -bool EEFundamentalParameterData::operator ==(const EEFundamentalParameterData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_frequency == rhs._frequency) ) ivarsEqual = false; - if( ! (_frequencyRange == rhs._frequencyRange) ) ivarsEqual = false; - if( ! (_effectiveRadiatedPower == rhs._effectiveRadiatedPower) ) ivarsEqual = false; - if( ! (_pulseRepetitionFrequency == rhs._pulseRepetitionFrequency) ) ivarsEqual = false; - if( ! (_pulseWidth == rhs._pulseWidth) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EEFundamentalParameterData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _frequency - marshalSize = marshalSize + 4; // _frequencyRange - marshalSize = marshalSize + 4; // _effectiveRadiatedPower - marshalSize = marshalSize + 4; // _pulseRepetitionFrequency - marshalSize = marshalSize + 4; // _pulseWidth - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EEFundamentalParameterData.h b/src/dis7/EEFundamentalParameterData.h deleted file mode 100644 index 07194123..00000000 --- a/src/dis7/EEFundamentalParameterData.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Contains electromagnetic emmission regeneration parameters that are variable throught a scenario. Section 6.2.22. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EEFundamentalParameterData -{ -protected: - /** center frequency of the emission in hertz. */ - float _frequency; - - /** Bandwidth of the frequencies corresponding to the fequency field. */ - float _frequencyRange; - - /** Effective radiated power for the emission in DdBm. For a radar noise jammer, indicates the peak of the transmitted power. */ - float _effectiveRadiatedPower; - - /** Average repetition frequency of the emission in hertz. */ - float _pulseRepetitionFrequency; - - /** Average pulse width of the emission in microseconds. */ - float _pulseWidth; - - - public: - EEFundamentalParameterData(); - virtual ~EEFundamentalParameterData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getFrequency() const; - void setFrequency(float pX); - - float getFrequencyRange() const; - void setFrequencyRange(float pX); - - float getEffectiveRadiatedPower() const; - void setEffectiveRadiatedPower(float pX); - - float getPulseRepetitionFrequency() const; - void setPulseRepetitionFrequency(float pX); - - float getPulseWidth() const; - void setPulseWidth(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EEFundamentalParameterData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EightByteChunk.cpp b/src/dis7/EightByteChunk.cpp deleted file mode 100644 index e90afd36..00000000 --- a/src/dis7/EightByteChunk.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -using namespace DIS; - - -EightByteChunk::EightByteChunk() -{ - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 8; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - -} - -EightByteChunk::~EightByteChunk() -{ -} - -char* EightByteChunk::getOtherParameters() -{ - return _otherParameters; -} - -const char* EightByteChunk::getOtherParameters() const -{ - return _otherParameters; -} - -void EightByteChunk::setOtherParameters(const char* x) -{ - for(int i = 0; i < 8; i++) - { - _otherParameters[i] = x[i]; - } -} - -void EightByteChunk::marshal(DataStream& dataStream) const -{ - - for(size_t idx = 0; idx < 8; idx++) - { - dataStream << _otherParameters[idx]; - } - -} - -void EightByteChunk::unmarshal(DataStream& dataStream) -{ - - for(size_t idx = 0; idx < 8; idx++) - { - dataStream >> _otherParameters[idx]; - } - -} - - -bool EightByteChunk::operator ==(const EightByteChunk& rhs) const - { - bool ivarsEqual = true; - - - for(unsigned char idx = 0; idx < 8; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EightByteChunk::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 8 * 1; // _otherParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EightByteChunk.h b/src/dis7/EightByteChunk.h deleted file mode 100644 index 946c752d..00000000 --- a/src/dis7/EightByteChunk.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 64 bit piece of data - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EightByteChunk -{ -protected: - /** Eight bytes of arbitrary data */ - char _otherParameters[8]; - - - public: - EightByteChunk(); - virtual ~EightByteChunk(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EightByteChunk& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ElectromagneticEmissionBeamData.cpp b/src/dis7/ElectromagneticEmissionBeamData.cpp deleted file mode 100644 index 53ef9232..00000000 --- a/src/dis7/ElectromagneticEmissionBeamData.cpp +++ /dev/null @@ -1,268 +0,0 @@ -#include - -using namespace DIS; - - -ElectromagneticEmissionBeamData::ElectromagneticEmissionBeamData(): - _beamDataLength(0), - _beamIDNumber(0), - _beamParameterIndex(0), - _fundamentalParameterData(), - _beamData(), - _beamFunction(0), - _numberOfTrackJamTargets(0), - _highDensityTrackJam(0), - _beamStatus(0), - _jammingTechnique() -{ -} - -ElectromagneticEmissionBeamData::~ElectromagneticEmissionBeamData() -{ - _trackJamTargets.clear(); -} - -unsigned char ElectromagneticEmissionBeamData::getBeamDataLength() const -{ - return _beamDataLength; -} - -void ElectromagneticEmissionBeamData::setBeamDataLength(unsigned char pX) -{ - _beamDataLength = pX; -} - -unsigned char ElectromagneticEmissionBeamData::getBeamIDNumber() const -{ - return _beamIDNumber; -} - -void ElectromagneticEmissionBeamData::setBeamIDNumber(unsigned char pX) -{ - _beamIDNumber = pX; -} - -unsigned short ElectromagneticEmissionBeamData::getBeamParameterIndex() const -{ - return _beamParameterIndex; -} - -void ElectromagneticEmissionBeamData::setBeamParameterIndex(unsigned short pX) -{ - _beamParameterIndex = pX; -} - -EEFundamentalParameterData& ElectromagneticEmissionBeamData::getFundamentalParameterData() -{ - return _fundamentalParameterData; -} - -const EEFundamentalParameterData& ElectromagneticEmissionBeamData::getFundamentalParameterData() const -{ - return _fundamentalParameterData; -} - -void ElectromagneticEmissionBeamData::setFundamentalParameterData(const EEFundamentalParameterData &pX) -{ - _fundamentalParameterData = pX; -} - -BeamData & DIS::ElectromagneticEmissionBeamData::getBeamData() -{ - return _beamData; -} - -const BeamData & DIS::ElectromagneticEmissionBeamData::getBeamData() const -{ - return _beamData; -} - -void DIS::ElectromagneticEmissionBeamData::setBeamData(const BeamData & pX) -{ - _beamData = pX; -} - -unsigned char ElectromagneticEmissionBeamData::getBeamFunction() const -{ - return _beamFunction; -} - -void ElectromagneticEmissionBeamData::setBeamFunction(unsigned char pX) -{ - _beamFunction = pX; -} - -unsigned char ElectromagneticEmissionBeamData::getNumberOfTrackJamTargets() const -{ - return _trackJamTargets.size(); -} - -unsigned char ElectromagneticEmissionBeamData::getHighDensityTrackJam() const -{ - return _highDensityTrackJam; -} - -void ElectromagneticEmissionBeamData::setHighDensityTrackJam(unsigned char pX) -{ - _highDensityTrackJam = pX; -} - -unsigned char ElectromagneticEmissionBeamData::getBeamStatus() const -{ - return _beamStatus; -} - -void ElectromagneticEmissionBeamData::setBeamStatus(unsigned char pX) -{ - _beamStatus = pX; -} - -JammingTechnique& ElectromagneticEmissionBeamData::getJammingTechnique() -{ - return _jammingTechnique; -} - -const JammingTechnique& ElectromagneticEmissionBeamData::getJammingTechnique() const -{ - return _jammingTechnique; -} - -void ElectromagneticEmissionBeamData::setJammingTechnique(const JammingTechnique& pX) -{ - _jammingTechnique = pX; -} - -std::vector& ElectromagneticEmissionBeamData::getTrackJamTargets() -{ - return _trackJamTargets; -} - -const std::vector& ElectromagneticEmissionBeamData::getTrackJamTargets() const -{ - return _trackJamTargets; -} - -void ElectromagneticEmissionBeamData::setTrackJamTargets(const std::vector& pX) -{ - _trackJamTargets = pX; -} - -void ElectromagneticEmissionBeamData::marshal(DataStream& dataStream) const -{ - dataStream << _beamDataLength; - dataStream << _beamIDNumber; - dataStream << _beamParameterIndex; - _fundamentalParameterData.marshal(dataStream); - _beamData.marshal(dataStream); - dataStream << _beamFunction; - dataStream << ( unsigned char )_trackJamTargets.size(); - dataStream << _highDensityTrackJam; - dataStream << _beamStatus; - _jammingTechnique.marshal(dataStream); - - for(size_t idx = 0; idx < _trackJamTargets.size(); idx++) - { - TrackJamData x = _trackJamTargets[idx]; - x.marshal(dataStream); - } - -} - -void ElectromagneticEmissionBeamData::unmarshal(DataStream& dataStream) -{ - dataStream >> _beamDataLength; - dataStream >> _beamIDNumber; - dataStream >> _beamParameterIndex; - _fundamentalParameterData.unmarshal(dataStream); - _beamData.unmarshal(dataStream); - dataStream >> _beamFunction; - dataStream >> _numberOfTrackJamTargets; - dataStream >> _highDensityTrackJam; - dataStream >> _beamStatus; - _jammingTechnique.unmarshal(dataStream); - - _trackJamTargets.clear(); - for(size_t idx = 0; idx < _numberOfTrackJamTargets; idx++) - { - TrackJamData x; - x.unmarshal(dataStream); - _trackJamTargets.push_back(x); - } -} - -bool ElectromagneticEmissionBeamData::operator ==(const ElectromagneticEmissionBeamData& rhs) const -{ - bool ivarsEqual = true; - - if( ! (_beamDataLength == rhs._beamDataLength) ) ivarsEqual = false; - if( ! (_beamIDNumber == rhs._beamIDNumber) ) ivarsEqual = false; - if( ! (_beamParameterIndex == rhs._beamParameterIndex) ) ivarsEqual = false; - if( ! (_fundamentalParameterData == rhs._fundamentalParameterData) ) ivarsEqual = false; - if (! (_beamData == rhs._beamData)) ivarsEqual = false; - if( ! (_beamFunction == rhs._beamFunction) ) ivarsEqual = false; - if( ! (_highDensityTrackJam == rhs._highDensityTrackJam) ) ivarsEqual = false; - if( ! (_beamStatus == rhs._beamStatus) ) ivarsEqual = false; - if( ! (_jammingTechnique == rhs._jammingTechnique) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _trackJamTargets.size(); idx++) - { - if( ! ( _trackJamTargets[idx] == rhs._trackJamTargets[idx]) ) ivarsEqual = false; - } - - return ivarsEqual; -} - -int ElectromagneticEmissionBeamData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _beamDataLength - marshalSize = marshalSize + 1; // _beamIDNumber - marshalSize = marshalSize + 2; // _beamParameterIndex - marshalSize = marshalSize + _fundamentalParameterData.getMarshalledSize(); // _fundamentalParameterData - marshalSize = marshalSize + _beamData.getMarshalledSize(); // _beamData - marshalSize = marshalSize + 1; // _beamFunction - marshalSize = marshalSize + 1; // _numberOfTrackJamTargets - marshalSize = marshalSize + 1; // _highDensityTrackJam - marshalSize = marshalSize + 1; // _beamStatus - marshalSize = marshalSize + _jammingTechnique.getMarshalledSize(); // _jammingTechnique - - for(unsigned long long idx=0; idx < _trackJamTargets.size(); idx++) - { - TrackJamData listElement = _trackJamTargets[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ElectromagneticEmissionBeamData.h b/src/dis7/ElectromagneticEmissionBeamData.h deleted file mode 100644 index 7bb56b01..00000000 --- a/src/dis7/ElectromagneticEmissionBeamData.h +++ /dev/null @@ -1,134 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Description of one electronic emission beam - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ElectromagneticEmissionBeamData -{ -protected: - /** This field shall specify the length of this beams data in 32 bit words */ - unsigned char _beamDataLength; - - /** This field shall specify a unique emitter database number assigned to differentiate between otherwise similar or identical emitter beams within an emitter system. */ - unsigned char _beamIDNumber; - - /** This field shall specify a Beam Parameter Index number that shall be used by receiving entities in conjunction with the Emitter Name field to provide a pointer to the stored database parameters required to regenerate the beam. */ - unsigned short _beamParameterIndex; - - /** Fundamental parameter data such as frequency range, erp, pulse width, etc. */ - EEFundamentalParameterData _fundamentalParameterData; - - /** Beam data contains Azimuth, Elevation, Sweep variables */ - BeamData _beamData; - - /** beam function of a particular beam */ - unsigned char _beamFunction; - - /** Number of track/jam targets */ - unsigned char _numberOfTrackJamTargets; - - /** wheher or not the receiving simulation apps can assume all the targets in the scan pattern are being tracked/jammed */ - unsigned char _highDensityTrackJam; - - unsigned char _beamStatus; - - /** Contains Jamming Mode Sequence */ - JammingTechnique _jammingTechnique; - - /** variable length list of track/jam targets */ - std::vector _trackJamTargets; - - public: - ElectromagneticEmissionBeamData(); - virtual ~ElectromagneticEmissionBeamData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getBeamDataLength() const; - void setBeamDataLength(unsigned char pX); - - unsigned char getBeamIDNumber() const; - void setBeamIDNumber(unsigned char pX); - - unsigned short getBeamParameterIndex() const; - void setBeamParameterIndex(unsigned short pX); - - EEFundamentalParameterData& getFundamentalParameterData(); - const EEFundamentalParameterData& getFundamentalParameterData() const; - void setFundamentalParameterData(const EEFundamentalParameterData &pX); - - BeamData& getBeamData(); - const BeamData& getBeamData() const; - void setBeamData(const BeamData &pX); - - unsigned char getBeamFunction() const; - void setBeamFunction(unsigned char pX); - - unsigned char getNumberOfTrackJamTargets() const; - - unsigned char getHighDensityTrackJam() const; - void setHighDensityTrackJam(unsigned char pX); - - unsigned char getBeamStatus() const; - void setBeamStatus(unsigned char pX); - - JammingTechnique& getJammingTechnique(); - const JammingTechnique& getJammingTechnique() const; - void setJammingTechnique(const JammingTechnique& pX); - - std::vector& getTrackJamTargets(); - const std::vector& getTrackJamTargets() const; - void setTrackJamTargets(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ElectromagneticEmissionBeamData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ElectromagneticEmissionSystemData.cpp b/src/dis7/ElectromagneticEmissionSystemData.cpp deleted file mode 100644 index dedc8831..00000000 --- a/src/dis7/ElectromagneticEmissionSystemData.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include - -using namespace DIS; - - -ElectromagneticEmissionSystemData::ElectromagneticEmissionSystemData(): - _systemDataLength(0), - _emissionsPadding2(0), - _numberOfBeams(0), - _emitterSystem(), - _location() -{ -} - -ElectromagneticEmissionSystemData::~ElectromagneticEmissionSystemData() -{ - _beamDataRecords.clear(); -} - -unsigned char ElectromagneticEmissionSystemData::getSystemDataLength() const -{ - return _systemDataLength; -} - -void ElectromagneticEmissionSystemData::setSystemDataLength(unsigned char pX) -{ - _systemDataLength = pX; -} - -unsigned char ElectromagneticEmissionSystemData::getNumberOfBeams() const -{ - return _beamDataRecords.size(); -} - -EmitterSystem& ElectromagneticEmissionSystemData::getEmitterSystem() -{ - return _emitterSystem; -} - -const EmitterSystem& ElectromagneticEmissionSystemData::getEmitterSystem() const -{ - return _emitterSystem; -} - -void ElectromagneticEmissionSystemData::setEmitterSystem(const EmitterSystem &pX) -{ - _emitterSystem = pX; -} - -Vector3Float& ElectromagneticEmissionSystemData::getLocation() -{ - return _location; -} - -const Vector3Float& ElectromagneticEmissionSystemData::getLocation() const -{ - return _location; -} - -void ElectromagneticEmissionSystemData::setLocation(const Vector3Float &pX) -{ - _location = pX; -} - -std::vector& DIS::ElectromagneticEmissionSystemData::getBeamDataRecords() -{ - return _beamDataRecords; -} - -const std::vector& DIS::ElectromagneticEmissionSystemData::getBeamDataRecords() const -{ - return _beamDataRecords; -} - -void DIS::ElectromagneticEmissionSystemData::setBeamDataRecords(const std::vector& pX) -{ - _beamDataRecords = pX; -} - -void ElectromagneticEmissionSystemData::marshal(DataStream& dataStream) const -{ - dataStream << _systemDataLength; - dataStream << ( unsigned char )_beamDataRecords.size(); - dataStream << _emissionsPadding2; - _emitterSystem.marshal(dataStream); - _location.marshal(dataStream); - - for(size_t idx = 0; idx < _beamDataRecords.size(); idx++) - { - ElectromagneticEmissionBeamData x = _beamDataRecords[idx]; - x.marshal(dataStream); - } -} - -void ElectromagneticEmissionSystemData::unmarshal(DataStream& dataStream) -{ - dataStream >> _systemDataLength; - dataStream >> _numberOfBeams; - dataStream >> _emissionsPadding2; - _emitterSystem.unmarshal(dataStream); - _location.unmarshal(dataStream); - - _beamDataRecords.clear(); - for(size_t idx = 0; idx < _numberOfBeams; idx++) - { - ElectromagneticEmissionBeamData x; - x.unmarshal(dataStream); - _beamDataRecords.push_back(x); - } -} - -bool ElectromagneticEmissionSystemData::operator ==(const ElectromagneticEmissionSystemData& rhs) const -{ - bool ivarsEqual = true; - - if( !(_systemDataLength == rhs._systemDataLength)) ivarsEqual = false; - if( !(_numberOfBeams == rhs._numberOfBeams) ) ivarsEqual = false; - if( !(_emissionsPadding2 == rhs._emissionsPadding2)) ivarsEqual = false; - if( !(_emitterSystem == rhs._emitterSystem) ) ivarsEqual = false; - if( !(_location == rhs._location) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _beamDataRecords.size(); idx++) - { - if( ! ( _beamDataRecords[idx] == rhs._beamDataRecords[idx]) ) ivarsEqual = false; - } - return ivarsEqual; -} - -int ElectromagneticEmissionSystemData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize += 1; // _systemDataLength - marshalSize += 1; // _numberOfBeams - marshalSize += 2; // _eimssionsPadding2 - marshalSize += _emitterSystem.getMarshalledSize(); //_emitterSystem - marshalSize += _location.getMarshalledSize(); //_location - - for(unsigned long long idx=0; idx < _beamDataRecords.size(); idx++) - { - ElectromagneticEmissionBeamData listElement = _beamDataRecords[idx]; - marshalSize += listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ElectromagneticEmissionSystemData.h b/src/dis7/ElectromagneticEmissionSystemData.h deleted file mode 100644 index 26e4696d..00000000 --- a/src/dis7/ElectromagneticEmissionSystemData.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Contains electromagnetic emmission system -// https://www.sisostds.org/DesktopModules/Bring2mind/DMX/API/Entries/Download?Command=Core_Download&EntryId=36292&PortalId=0&TabId=105 -// Page 23 -// -// DIS Data Dictionary representation -// http://faculty.nps.edu/brutzman/vrtp/mil/navy/nps/disEnumerations/JdbeHtmlFiles/pdu/b9.htm -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author semihkurt - -class OPENDIS7_EXPORT ElectromagneticEmissionSystemData -{ -protected: - /** this field shall specify the length of this emitter system's data in 32-bit words. */ - unsigned char _systemDataLength; - - /** the number of beams being described in the current PDU for the emitter system being described. */ - unsigned char _numberOfBeams; - - /* padding. */ - unsigned short _emissionsPadding2; - - /** information about a particular emitter system and shall be represented by an Emitter System record (see 6.2.23). */ - EmitterSystem _emitterSystem; - - /** the location of the antenna beam source with respect to the emitting entity's coordinate system. This location shall be the origin of the emitter coordinate system that shall have the same orientation as the entity coordinate system. This field shall be represented by an Entity Coordinate Vector record see 6.2.95 */ - Vector3Float _location; - - /** Electromagnetic emmissions systems */ - std::vector _beamDataRecords; - - public: - ElectromagneticEmissionSystemData(); - virtual ~ElectromagneticEmissionSystemData(); - - unsigned char getSystemDataLength() const; - void setSystemDataLength(unsigned char pX); - - unsigned char getNumberOfBeams() const; - - unsigned short getEmissionsPadding2() const; - void setEmissionsPadding2(unsigned short pX); - - EmitterSystem& getEmitterSystem(); - const EmitterSystem& getEmitterSystem() const; - void setEmitterSystem(const EmitterSystem &pX); - - Vector3Float& getLocation(); - const Vector3Float& getLocation() const; - void setLocation(const Vector3Float &pX); - - std::vector& getBeamDataRecords(); - const std::vector& getBeamDataRecords() const; - void setBeamDataRecords(const std::vector& pX); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - -virtual int getMarshalledSize() const; - - bool operator ==(const ElectromagneticEmissionSystemData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ElectromagneticEmissionsPdu.cpp b/src/dis7/ElectromagneticEmissionsPdu.cpp deleted file mode 100644 index e52e253c..00000000 --- a/src/dis7/ElectromagneticEmissionsPdu.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include - -using namespace DIS; - - -ElectromagneticEmissionsPdu::ElectromagneticEmissionsPdu() : DistributedEmissionsFamilyPdu(), - _emittingEntityID(), - _eventID(), - _stateUpdateIndicator(0), - _numberOfSystems(0), - _paddingForEmissionsPdu(0) -{ - setPduType( 23 ); - setPaddingForEmissionsPdu( 0 ); -} - -ElectromagneticEmissionsPdu::~ElectromagneticEmissionsPdu() -{ - _systems.clear(); -} - -EntityID& ElectromagneticEmissionsPdu::getEmittingEntityID() -{ - return _emittingEntityID; -} - -const EntityID& ElectromagneticEmissionsPdu::getEmittingEntityID() const -{ - return _emittingEntityID; -} - -void ElectromagneticEmissionsPdu::setEmittingEntityID(const EntityID &pX) -{ - _emittingEntityID = pX; -} - -EventIdentifier& ElectromagneticEmissionsPdu::getEventID() -{ - return _eventID; -} - -const EventIdentifier& ElectromagneticEmissionsPdu::getEventID() const -{ - return _eventID; -} - -void ElectromagneticEmissionsPdu::setEventID(const EventIdentifier &pX) -{ - _eventID = pX; -} - -unsigned char ElectromagneticEmissionsPdu::getStateUpdateIndicator() const -{ - return _stateUpdateIndicator; -} - -void ElectromagneticEmissionsPdu::setStateUpdateIndicator(unsigned char pX) -{ - _stateUpdateIndicator = pX; -} - -unsigned char ElectromagneticEmissionsPdu::getNumberOfSystems() const -{ - return _systems.size(); -} - -unsigned short ElectromagneticEmissionsPdu::getPaddingForEmissionsPdu() const -{ - return _paddingForEmissionsPdu; -} - -void ElectromagneticEmissionsPdu::setPaddingForEmissionsPdu(unsigned short pX) -{ - _paddingForEmissionsPdu = pX; -} - -std::vector& ElectromagneticEmissionsPdu::getSystems() -{ - return _systems; -} - -const std::vector& ElectromagneticEmissionsPdu::getSystems() const -{ - return _systems; -} - -void ElectromagneticEmissionsPdu::setSystems(const std::vector& pX) -{ - _systems = pX; -} - -void ElectromagneticEmissionsPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _emittingEntityID.marshal(dataStream); - _eventID.marshal(dataStream); - dataStream << _stateUpdateIndicator; - dataStream << ( unsigned char )_systems.size(); - dataStream << _paddingForEmissionsPdu; - - for(size_t idx = 0; idx < _systems.size(); idx++) - { - ElectromagneticEmissionSystemData x = _systems[idx]; - x.marshal(dataStream); - } - -} - -void ElectromagneticEmissionsPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _emittingEntityID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - dataStream >> _stateUpdateIndicator; - dataStream >> _numberOfSystems; - dataStream >> _paddingForEmissionsPdu; - - _systems.clear(); - for(size_t idx = 0; idx < _numberOfSystems; idx++) - { - ElectromagneticEmissionSystemData x; - x.unmarshal(dataStream); - _systems.push_back(x); - } -} - - -bool ElectromagneticEmissionsPdu::operator ==(const ElectromagneticEmissionsPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_emittingEntityID == rhs._emittingEntityID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_stateUpdateIndicator == rhs._stateUpdateIndicator) ) ivarsEqual = false; - if( ! (_paddingForEmissionsPdu == rhs._paddingForEmissionsPdu) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _systems.size(); idx++) - { - if( ! ( _systems[idx] == rhs._systems[idx]) ) ivarsEqual = false; - } - - return ivarsEqual; - } - -int ElectromagneticEmissionsPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + 1; // _stateUpdateIndicator - marshalSize = marshalSize + 1; // _numberOfSystems - marshalSize = marshalSize + 2; // _paddingForEmissionsPdu - - for(unsigned long long idx=0; idx < _systems.size(); idx++) - { - ElectromagneticEmissionSystemData listElement = _systems[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ElectromagneticEmissionsPdu.h b/src/dis7/ElectromagneticEmissionsPdu.h deleted file mode 100644 index 72cde8d6..00000000 --- a/src/dis7/ElectromagneticEmissionsPdu.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.7.1. Information about active electronic warfare (EW) emissions and active EW countermeasures shall be communicated using an Electromagnetic Emission PDU. NOT COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ElectromagneticEmissionsPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** ID of the entity emitting */ - EntityID _emittingEntityID; - - /** ID of event */ - EventIdentifier _eventID; - - /** This field shall be used to indicate if the data in the PDU represents a state update or just data that has changed since issuance of the last Electromagnetic Emission PDU [relative to the identified entity and emission system(s)]. */ - unsigned char _stateUpdateIndicator; - - /** This field shall specify the number of emission systems being described in the current PDU. */ - unsigned char _numberOfSystems; - - /** padding */ - unsigned short _paddingForEmissionsPdu; - - std::vector _systems; - - public: - ElectromagneticEmissionsPdu(); - virtual ~ElectromagneticEmissionsPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEmittingEntityID(); - const EntityID& getEmittingEntityID() const; - void setEmittingEntityID(const EntityID &pX); - - EventIdentifier& getEventID(); - const EventIdentifier& getEventID() const; - void setEventID(const EventIdentifier &pX); - - unsigned char getStateUpdateIndicator() const; - void setStateUpdateIndicator(unsigned char pX); - - unsigned char getNumberOfSystems() const; - - unsigned short getPaddingForEmissionsPdu() const; - void setPaddingForEmissionsPdu(unsigned short pX); - - std::vector& getSystems(); - const std::vector& getSystems() const; - void setSystems(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ElectromagneticEmissionsPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EmitterSystem.cpp b/src/dis7/EmitterSystem.cpp deleted file mode 100644 index 44152556..00000000 --- a/src/dis7/EmitterSystem.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -EmitterSystem::EmitterSystem(): - _emitterName(0), - _function(0), - _emitterIdNumber(0) -{ -} - -EmitterSystem::~EmitterSystem() -{ -} - -unsigned short EmitterSystem::getEmitterName() const -{ - return _emitterName; -} - -void EmitterSystem::setEmitterName(unsigned short pX) -{ - _emitterName = pX; -} - -unsigned char EmitterSystem::getFunction() const -{ - return _function; -} - -void EmitterSystem::setFunction(unsigned char pX) -{ - _function = pX; -} - -unsigned char EmitterSystem::getEmitterIdNumber() const -{ - return _emitterIdNumber; -} - -void EmitterSystem::setEmitterIdNumber(unsigned char pX) -{ - _emitterIdNumber = pX; -} - -void EmitterSystem::marshal(DataStream& dataStream) const -{ - dataStream << _emitterName; - dataStream << _function; - dataStream << _emitterIdNumber; -} - -void EmitterSystem::unmarshal(DataStream& dataStream) -{ - dataStream >> _emitterName; - dataStream >> _function; - dataStream >> _emitterIdNumber; -} - - -bool EmitterSystem::operator ==(const EmitterSystem& rhs) const - { - bool ivarsEqual = true; - - if( ! (_emitterName == rhs._emitterName) ) ivarsEqual = false; - if( ! (_function == rhs._function) ) ivarsEqual = false; - if( ! (_emitterIdNumber == rhs._emitterIdNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EmitterSystem::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _emitterName - marshalSize = marshalSize + 1; // _function - marshalSize = marshalSize + 1; // _emitterIdNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EmitterSystem.h b/src/dis7/EmitterSystem.h deleted file mode 100644 index 38f00431..00000000 --- a/src/dis7/EmitterSystem.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// This field shall specify information about a particular emitter system. Section 6.2.23. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EmitterSystem -{ -protected: - /** Name of the emitter, 16 bit enumeration */ - unsigned short _emitterName; - - /** function of the emitter, 8 bit enumeration */ - unsigned char _function; - - /** emitter ID, 8 bit enumeration */ - unsigned char _emitterIdNumber; - - - public: - EmitterSystem(); - virtual ~EmitterSystem(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getEmitterName() const; - void setEmitterName(unsigned short pX); - - unsigned char getFunction() const; - void setFunction(unsigned char pX); - - unsigned char getEmitterIdNumber() const; - void setEmitterIdNumber(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EmitterSystem& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EngineFuel.cpp b/src/dis7/EngineFuel.cpp deleted file mode 100644 index 18f0df7f..00000000 --- a/src/dis7/EngineFuel.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -EngineFuel::EngineFuel(): - _fuelQuantity(0), - _fuelMeasurementUnits(0), - _fuelType(0), - _fuelLocation(0), - _padding(0) -{ -} - -EngineFuel::~EngineFuel() -{ -} - -unsigned int EngineFuel::getFuelQuantity() const -{ - return _fuelQuantity; -} - -void EngineFuel::setFuelQuantity(unsigned int pX) -{ - _fuelQuantity = pX; -} - -unsigned char EngineFuel::getFuelMeasurementUnits() const -{ - return _fuelMeasurementUnits; -} - -void EngineFuel::setFuelMeasurementUnits(unsigned char pX) -{ - _fuelMeasurementUnits = pX; -} - -unsigned char EngineFuel::getFuelType() const -{ - return _fuelType; -} - -void EngineFuel::setFuelType(unsigned char pX) -{ - _fuelType = pX; -} - -unsigned char EngineFuel::getFuelLocation() const -{ - return _fuelLocation; -} - -void EngineFuel::setFuelLocation(unsigned char pX) -{ - _fuelLocation = pX; -} - -unsigned char EngineFuel::getPadding() const -{ - return _padding; -} - -void EngineFuel::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void EngineFuel::marshal(DataStream& dataStream) const -{ - dataStream << _fuelQuantity; - dataStream << _fuelMeasurementUnits; - dataStream << _fuelType; - dataStream << _fuelLocation; - dataStream << _padding; -} - -void EngineFuel::unmarshal(DataStream& dataStream) -{ - dataStream >> _fuelQuantity; - dataStream >> _fuelMeasurementUnits; - dataStream >> _fuelType; - dataStream >> _fuelLocation; - dataStream >> _padding; -} - - -bool EngineFuel::operator ==(const EngineFuel& rhs) const - { - bool ivarsEqual = true; - - if( ! (_fuelQuantity == rhs._fuelQuantity) ) ivarsEqual = false; - if( ! (_fuelMeasurementUnits == rhs._fuelMeasurementUnits) ) ivarsEqual = false; - if( ! (_fuelType == rhs._fuelType) ) ivarsEqual = false; - if( ! (_fuelLocation == rhs._fuelLocation) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EngineFuel::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _fuelQuantity - marshalSize = marshalSize + 1; // _fuelMeasurementUnits - marshalSize = marshalSize + 1; // _fuelType - marshalSize = marshalSize + 1; // _fuelLocation - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EngineFuel.h b/src/dis7/EngineFuel.h deleted file mode 100644 index d4f13651..00000000 --- a/src/dis7/EngineFuel.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Information about an entity's engine fuel. Section 6.2.24. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EngineFuel -{ -protected: - /** Fuel quantity, units specified by next field */ - unsigned int _fuelQuantity; - - /** Units in which the fuel is measured */ - unsigned char _fuelMeasurementUnits; - - /** Type of fuel */ - unsigned char _fuelType; - - /** Location of fuel as related to entity. See section 14 of EBV document */ - unsigned char _fuelLocation; - - /** padding */ - unsigned char _padding; - - - public: - EngineFuel(); - virtual ~EngineFuel(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getFuelQuantity() const; - void setFuelQuantity(unsigned int pX); - - unsigned char getFuelMeasurementUnits() const; - void setFuelMeasurementUnits(unsigned char pX); - - unsigned char getFuelType() const; - void setFuelType(unsigned char pX); - - unsigned char getFuelLocation() const; - void setFuelLocation(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EngineFuel& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EngineFuelReload.cpp b/src/dis7/EngineFuelReload.cpp deleted file mode 100644 index d31a74cf..00000000 --- a/src/dis7/EngineFuelReload.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -EngineFuelReload::EngineFuelReload(): - _standardQuantity(0), - _maximumQuantity(0), - _standardQuantityReloadTime(0), - _maximumQuantityReloadTime(0), - _fuelMeasurmentUnits(0), - _fuelLocation(0), - _padding(0) -{ -} - -EngineFuelReload::~EngineFuelReload() -{ -} - -unsigned int EngineFuelReload::getStandardQuantity() const -{ - return _standardQuantity; -} - -void EngineFuelReload::setStandardQuantity(unsigned int pX) -{ - _standardQuantity = pX; -} - -unsigned int EngineFuelReload::getMaximumQuantity() const -{ - return _maximumQuantity; -} - -void EngineFuelReload::setMaximumQuantity(unsigned int pX) -{ - _maximumQuantity = pX; -} - -unsigned int EngineFuelReload::getStandardQuantityReloadTime() const -{ - return _standardQuantityReloadTime; -} - -void EngineFuelReload::setStandardQuantityReloadTime(unsigned int pX) -{ - _standardQuantityReloadTime = pX; -} - -unsigned int EngineFuelReload::getMaximumQuantityReloadTime() const -{ - return _maximumQuantityReloadTime; -} - -void EngineFuelReload::setMaximumQuantityReloadTime(unsigned int pX) -{ - _maximumQuantityReloadTime = pX; -} - -unsigned char EngineFuelReload::getFuelMeasurmentUnits() const -{ - return _fuelMeasurmentUnits; -} - -void EngineFuelReload::setFuelMeasurmentUnits(unsigned char pX) -{ - _fuelMeasurmentUnits = pX; -} - -unsigned char EngineFuelReload::getFuelLocation() const -{ - return _fuelLocation; -} - -void EngineFuelReload::setFuelLocation(unsigned char pX) -{ - _fuelLocation = pX; -} - -unsigned char EngineFuelReload::getPadding() const -{ - return _padding; -} - -void EngineFuelReload::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void EngineFuelReload::marshal(DataStream& dataStream) const -{ - dataStream << _standardQuantity; - dataStream << _maximumQuantity; - dataStream << _standardQuantityReloadTime; - dataStream << _maximumQuantityReloadTime; - dataStream << _fuelMeasurmentUnits; - dataStream << _fuelLocation; - dataStream << _padding; -} - -void EngineFuelReload::unmarshal(DataStream& dataStream) -{ - dataStream >> _standardQuantity; - dataStream >> _maximumQuantity; - dataStream >> _standardQuantityReloadTime; - dataStream >> _maximumQuantityReloadTime; - dataStream >> _fuelMeasurmentUnits; - dataStream >> _fuelLocation; - dataStream >> _padding; -} - - -bool EngineFuelReload::operator ==(const EngineFuelReload& rhs) const - { - bool ivarsEqual = true; - - if( ! (_standardQuantity == rhs._standardQuantity) ) ivarsEqual = false; - if( ! (_maximumQuantity == rhs._maximumQuantity) ) ivarsEqual = false; - if( ! (_standardQuantityReloadTime == rhs._standardQuantityReloadTime) ) ivarsEqual = false; - if( ! (_maximumQuantityReloadTime == rhs._maximumQuantityReloadTime) ) ivarsEqual = false; - if( ! (_fuelMeasurmentUnits == rhs._fuelMeasurmentUnits) ) ivarsEqual = false; - if( ! (_fuelLocation == rhs._fuelLocation) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EngineFuelReload::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _standardQuantity - marshalSize = marshalSize + 4; // _maximumQuantity - marshalSize = marshalSize + 4; // _standardQuantityReloadTime - marshalSize = marshalSize + 4; // _maximumQuantityReloadTime - marshalSize = marshalSize + 1; // _fuelMeasurmentUnits - marshalSize = marshalSize + 1; // _fuelLocation - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EngineFuelReload.h b/src/dis7/EngineFuelReload.h deleted file mode 100644 index f843a1fd..00000000 --- a/src/dis7/EngineFuelReload.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// For each type or location of engine fuell, this record specifies the type, location, fuel measurement units, and reload quantity and maximum quantity. Section 6.2.25. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EngineFuelReload -{ -protected: - /** standard quantity of fuel loaded */ - unsigned int _standardQuantity; - - /** maximum quantity of fuel loaded */ - unsigned int _maximumQuantity; - - /** seconds normally required to to reload standard qty */ - unsigned int _standardQuantityReloadTime; - - /** seconds normally required to to reload maximum qty */ - unsigned int _maximumQuantityReloadTime; - - /** Units of measure */ - unsigned char _fuelMeasurmentUnits; - - /** fuel location as related to the entity */ - unsigned char _fuelLocation; - - /** padding */ - unsigned char _padding; - - - public: - EngineFuelReload(); - virtual ~EngineFuelReload(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getStandardQuantity() const; - void setStandardQuantity(unsigned int pX); - - unsigned int getMaximumQuantity() const; - void setMaximumQuantity(unsigned int pX); - - unsigned int getStandardQuantityReloadTime() const; - void setStandardQuantityReloadTime(unsigned int pX); - - unsigned int getMaximumQuantityReloadTime() const; - void setMaximumQuantityReloadTime(unsigned int pX); - - unsigned char getFuelMeasurmentUnits() const; - void setFuelMeasurmentUnits(unsigned char pX); - - unsigned char getFuelLocation() const; - void setFuelLocation(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EngineFuelReload& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityAssociation.cpp b/src/dis7/EntityAssociation.cpp deleted file mode 100644 index b4dbd8f1..00000000 --- a/src/dis7/EntityAssociation.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include - -using namespace DIS; - - -EntityAssociation::EntityAssociation(): - _recordType(2), - _changeIndicator(0), - _associationStatus(0), - _associationType(0), - _entityID(), - _owsSttionLocation(0), - _physicalConnectionType(0), - _groupMemberType(0), - _groupNumber(0) -{ -} - -EntityAssociation::~EntityAssociation() -{ -} - -unsigned char EntityAssociation::getRecordType() const -{ - return _recordType; -} - -void EntityAssociation::setRecordType(unsigned char pX) -{ - _recordType = pX; -} - -unsigned char EntityAssociation::getChangeIndicator() const -{ - return _changeIndicator; -} - -void EntityAssociation::setChangeIndicator(unsigned char pX) -{ - _changeIndicator = pX; -} - -unsigned char EntityAssociation::getAssociationStatus() const -{ - return _associationStatus; -} - -void EntityAssociation::setAssociationStatus(unsigned char pX) -{ - _associationStatus = pX; -} - -unsigned char EntityAssociation::getAssociationType() const -{ - return _associationType; -} - -void EntityAssociation::setAssociationType(unsigned char pX) -{ - _associationType = pX; -} - -EntityID& EntityAssociation::getEntityID() -{ - return _entityID; -} - -const EntityID& EntityAssociation::getEntityID() const -{ - return _entityID; -} - -void EntityAssociation::setEntityID(const EntityID &pX) -{ - _entityID = pX; -} - -unsigned short EntityAssociation::getOwsSttionLocation() const -{ - return _owsSttionLocation; -} - -void EntityAssociation::setOwsSttionLocation(unsigned short pX) -{ - _owsSttionLocation = pX; -} - -unsigned short EntityAssociation::getPhysicalConnectionType() const -{ - return _physicalConnectionType; -} - -void EntityAssociation::setPhysicalConnectionType(unsigned short pX) -{ - _physicalConnectionType = pX; -} - -unsigned char EntityAssociation::getGroupMemberType() const -{ - return _groupMemberType; -} - -void EntityAssociation::setGroupMemberType(unsigned char pX) -{ - _groupMemberType = pX; -} - -unsigned short EntityAssociation::getGroupNumber() const -{ - return _groupNumber; -} - -void EntityAssociation::setGroupNumber(unsigned short pX) -{ - _groupNumber = pX; -} - -void EntityAssociation::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _changeIndicator; - dataStream << _associationStatus; - dataStream << _associationType; - _entityID.marshal(dataStream); - dataStream << _owsSttionLocation; - dataStream << _physicalConnectionType; - dataStream << _groupMemberType; - dataStream << _groupNumber; -} - -void EntityAssociation::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _changeIndicator; - dataStream >> _associationStatus; - dataStream >> _associationType; - _entityID.unmarshal(dataStream); - dataStream >> _owsSttionLocation; - dataStream >> _physicalConnectionType; - dataStream >> _groupMemberType; - dataStream >> _groupNumber; -} - - -bool EntityAssociation::operator ==(const EntityAssociation& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_changeIndicator == rhs._changeIndicator) ) ivarsEqual = false; - if( ! (_associationStatus == rhs._associationStatus) ) ivarsEqual = false; - if( ! (_associationType == rhs._associationType) ) ivarsEqual = false; - if( ! (_entityID == rhs._entityID) ) ivarsEqual = false; - if( ! (_owsSttionLocation == rhs._owsSttionLocation) ) ivarsEqual = false; - if( ! (_physicalConnectionType == rhs._physicalConnectionType) ) ivarsEqual = false; - if( ! (_groupMemberType == rhs._groupMemberType) ) ivarsEqual = false; - if( ! (_groupNumber == rhs._groupNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EntityAssociation::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _recordType - marshalSize = marshalSize + 1; // _changeIndicator - marshalSize = marshalSize + 1; // _associationStatus - marshalSize = marshalSize + 1; // _associationType - marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID - marshalSize = marshalSize + 2; // _owsSttionLocation - marshalSize = marshalSize + 2; // _physicalConnectionType - marshalSize = marshalSize + 1; // _groupMemberType - marshalSize = marshalSize + 2; // _groupNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityAssociation.h b/src/dis7/EntityAssociation.h deleted file mode 100644 index 8d5772d0..00000000 --- a/src/dis7/EntityAssociation.h +++ /dev/null @@ -1,118 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Association or disassociation of two entities. Section 6.2.93.4 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityAssociation -{ -protected: - /** the identification of the Variable Parameter record. Enumeration from EBV */ - unsigned char _recordType; - - /** Indicates if this VP has changed since last issuance */ - unsigned char _changeIndicator; - - /** Indicates association status between two entities; 8 bit enum */ - unsigned char _associationStatus; - - /** Type of association; 8 bit enum */ - unsigned char _associationType; - - /** Object ID of entity associated with this entity */ - EntityID _entityID; - - /** Station location on one's own entity. EBV doc. */ - unsigned short _owsSttionLocation; - - /** Type of physical connection. EBV doc */ - unsigned short _physicalConnectionType; - - /** Type of member the entity is within th egroup */ - unsigned char _groupMemberType; - - /** Group if any to which the entity belongs */ - unsigned short _groupNumber; - - - public: - EntityAssociation(); - virtual ~EntityAssociation(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRecordType() const; - void setRecordType(unsigned char pX); - - unsigned char getChangeIndicator() const; - void setChangeIndicator(unsigned char pX); - - unsigned char getAssociationStatus() const; - void setAssociationStatus(unsigned char pX); - - unsigned char getAssociationType() const; - void setAssociationType(unsigned char pX); - - EntityID& getEntityID(); - const EntityID& getEntityID() const; - void setEntityID(const EntityID &pX); - - unsigned short getOwsSttionLocation() const; - void setOwsSttionLocation(unsigned short pX); - - unsigned short getPhysicalConnectionType() const; - void setPhysicalConnectionType(unsigned short pX); - - unsigned char getGroupMemberType() const; - void setGroupMemberType(unsigned char pX); - - unsigned short getGroupNumber() const; - void setGroupNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityAssociation& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityDamageStatusPdu.cpp b/src/dis7/EntityDamageStatusPdu.cpp deleted file mode 100644 index e6e88ddb..00000000 --- a/src/dis7/EntityDamageStatusPdu.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include - -using namespace DIS; - - -EntityDamageStatusPdu::EntityDamageStatusPdu() : WarfareFamilyPdu(), - _damagedEntityID(), - _padding1(0), - _padding2(0), - _numberOfDamageDescription(0) -{ - setPduType( 69 ); -} - -EntityDamageStatusPdu::~EntityDamageStatusPdu() -{ - _damageDescriptionRecords.clear(); -} - -EntityID& EntityDamageStatusPdu::getDamagedEntityID() -{ - return _damagedEntityID; -} - -const EntityID& EntityDamageStatusPdu::getDamagedEntityID() const -{ - return _damagedEntityID; -} - -void EntityDamageStatusPdu::setDamagedEntityID(const EntityID &pX) -{ - _damagedEntityID = pX; -} - -unsigned short EntityDamageStatusPdu::getPadding1() const -{ - return _padding1; -} - -void EntityDamageStatusPdu::setPadding1(unsigned short pX) -{ - _padding1 = pX; -} - -unsigned short EntityDamageStatusPdu::getPadding2() const -{ - return _padding2; -} - -void EntityDamageStatusPdu::setPadding2(unsigned short pX) -{ - _padding2 = pX; -} - -unsigned short EntityDamageStatusPdu::getNumberOfDamageDescription() const -{ - return _damageDescriptionRecords.size(); -} - -std::vector& EntityDamageStatusPdu::getDamageDescriptionRecords() -{ - return _damageDescriptionRecords; -} - -const std::vector& EntityDamageStatusPdu::getDamageDescriptionRecords() const -{ - return _damageDescriptionRecords; -} - -void EntityDamageStatusPdu::setDamageDescriptionRecords(const std::vector& pX) -{ - _damageDescriptionRecords = pX; -} - -void EntityDamageStatusPdu::marshal(DataStream& dataStream) const -{ - WarfareFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _damagedEntityID.marshal(dataStream); - dataStream << _padding1; - dataStream << _padding2; - dataStream << ( unsigned short )_damageDescriptionRecords.size(); - - for(size_t idx = 0; idx < _damageDescriptionRecords.size(); idx++) - { - DirectedEnergyDamage x = _damageDescriptionRecords[idx]; - x.marshal(dataStream); - } - -} - -void EntityDamageStatusPdu::unmarshal(DataStream& dataStream) -{ - WarfareFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _damagedEntityID.unmarshal(dataStream); - dataStream >> _padding1; - dataStream >> _padding2; - dataStream >> _numberOfDamageDescription; - - _damageDescriptionRecords.clear(); - for(size_t idx = 0; idx < _numberOfDamageDescription; idx++) - { - DirectedEnergyDamage x; - x.unmarshal(dataStream); - _damageDescriptionRecords.push_back(x); - } -} - - -bool EntityDamageStatusPdu::operator ==(const EntityDamageStatusPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = WarfareFamilyPdu::operator==(rhs); - - if( ! (_damagedEntityID == rhs._damagedEntityID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _damageDescriptionRecords.size(); idx++) - { - if( ! ( _damageDescriptionRecords[idx] == rhs._damageDescriptionRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EntityDamageStatusPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = WarfareFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _damagedEntityID.getMarshalledSize(); // _damagedEntityID - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 2; // _padding2 - marshalSize = marshalSize + 2; // _numberOfDamageDescription - - for(unsigned long long idx=0; idx < _damageDescriptionRecords.size(); idx++) - { - DirectedEnergyDamage listElement = _damageDescriptionRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityDamageStatusPdu.h b/src/dis7/EntityDamageStatusPdu.h deleted file mode 100644 index 566e7452..00000000 --- a/src/dis7/EntityDamageStatusPdu.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// shall be used to communicate detailed damage information sustained by an entity regardless of the source of the damage Section 7.3.5 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityDamageStatusPdu : public WarfareFamilyPdu -{ -protected: - /** Field shall identify the damaged entity (see 6.2.28), Section 7.3.4 COMPLETE */ - EntityID _damagedEntityID; - - /** Padding. */ - unsigned short _padding1; - - /** Padding. */ - unsigned short _padding2; - - /** field shall specify the number of Damage Description records, Section 7.3.5 */ - unsigned short _numberOfDamageDescription; - - /** Fields shall contain one or more Damage Description records (see 6.2.17) and may contain other Standard Variable records, Section 7.3.5 */ - std::vector _damageDescriptionRecords; - - - public: - EntityDamageStatusPdu(); - virtual ~EntityDamageStatusPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getDamagedEntityID(); - const EntityID& getDamagedEntityID() const; - void setDamagedEntityID(const EntityID &pX); - - unsigned short getPadding1() const; - void setPadding1(unsigned short pX); - - unsigned short getPadding2() const; - void setPadding2(unsigned short pX); - - unsigned short getNumberOfDamageDescription() const; - - std::vector& getDamageDescriptionRecords(); - const std::vector& getDamageDescriptionRecords() const; - void setDamageDescriptionRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityDamageStatusPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityID.cpp b/src/dis7/EntityID.cpp deleted file mode 100644 index c5fbb14f..00000000 --- a/src/dis7/EntityID.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -EntityID::EntityID(): - _simulationAddress(), - _entityNumber(0) -{ -} - -EntityID::~EntityID() -{ -} - -SimulationAddress& EntityID::getSimulationAddress() -{ - return _simulationAddress; -} - -const SimulationAddress& EntityID::getSimulationAddress() const -{ - return _simulationAddress; -} - -void EntityID::setSimulationAddress(const SimulationAddress &pX) -{ - _simulationAddress = pX; -} - -unsigned short EntityID::getEntityNumber() const -{ - return _entityNumber; -} - -void EntityID::setEntityNumber(unsigned short pX) -{ - _entityNumber = pX; -} - -void EntityID::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _entityNumber; -} - -void EntityID::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _entityNumber; -} - - -bool EntityID::operator ==(const EntityID& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_entityNumber == rhs._entityNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EntityID::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _entityNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityID.h b/src/dis7/EntityID.h deleted file mode 100644 index 9b73c15c..00000000 --- a/src/dis7/EntityID.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Entity Identifier. Unique ID for entities in the world. Consists of an simulation address and a entity number. Section 6.2.28. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityID -{ -protected: - /** Site and application IDs */ - SimulationAddress _simulationAddress; - - /** Entity number */ - unsigned short _entityNumber; - - - public: - EntityID(); - virtual ~EntityID(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getSimulationAddress(); - const SimulationAddress& getSimulationAddress() const; - void setSimulationAddress(const SimulationAddress &pX); - - unsigned short getEntityNumber() const; - void setEntityNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityID& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityInformationFamilyPdu.cpp b/src/dis7/EntityInformationFamilyPdu.cpp deleted file mode 100644 index 024e9cf7..00000000 --- a/src/dis7/EntityInformationFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -EntityInformationFamilyPdu::EntityInformationFamilyPdu() : Pdu() - -{ - setProtocolFamily( 1 ); -} - -EntityInformationFamilyPdu::~EntityInformationFamilyPdu() -{ -} - -void EntityInformationFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void EntityInformationFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool EntityInformationFamilyPdu::operator ==(const EntityInformationFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int EntityInformationFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityInformationFamilyPdu.h b/src/dis7/EntityInformationFamilyPdu.h deleted file mode 100644 index b4f8db58..00000000 --- a/src/dis7/EntityInformationFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.3. Common superclass for EntityState, Collision, collision-elastic, and entity state update PDUs. This should be abstract. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityInformationFamilyPdu : public Pdu -{ -protected: - - public: - EntityInformationFamilyPdu(); - virtual ~EntityInformationFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityInformationFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityManagementFamilyPdu.cpp b/src/dis7/EntityManagementFamilyPdu.cpp deleted file mode 100644 index e53cbc01..00000000 --- a/src/dis7/EntityManagementFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -EntityManagementFamilyPdu::EntityManagementFamilyPdu() : Pdu() - -{ - setProtocolFamily( 7 ); -} - -EntityManagementFamilyPdu::~EntityManagementFamilyPdu() -{ -} - -void EntityManagementFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void EntityManagementFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool EntityManagementFamilyPdu::operator ==(const EntityManagementFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int EntityManagementFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityManagementFamilyPdu.h b/src/dis7/EntityManagementFamilyPdu.h deleted file mode 100644 index 506bf032..00000000 --- a/src/dis7/EntityManagementFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Managment of grouping of PDUs, and more. Section 7.8 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityManagementFamilyPdu : public Pdu -{ -protected: - - public: - EntityManagementFamilyPdu(); - virtual ~EntityManagementFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityManagementFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityMarking.cpp b/src/dis7/EntityMarking.cpp deleted file mode 100644 index f820314a..00000000 --- a/src/dis7/EntityMarking.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include - -#include - -using namespace DIS; - - -EntityMarking::EntityMarking(): - _characterSet(0) -{ - // Initialize fixed length array - for(int lengthcharacters= 0; lengthcharacters < 11; lengthcharacters++) - { - _characters[lengthcharacters] = 0; - } - -} - -EntityMarking::~EntityMarking() -{ -} - -unsigned char EntityMarking::getCharacterSet() const -{ - return _characterSet; -} - -void EntityMarking::setCharacterSet(unsigned char pX) -{ - _characterSet = pX; -} - -char* EntityMarking::getCharacters() -{ - return _characters; -} - -const char* EntityMarking::getCharacters() const -{ - return _characters; -} - -void EntityMarking::setCharacters(const char* x) -{ - for(int i = 0; i < 11; i++) - { - _characters[i] = x[i]; - } -} - -// An alternate method to set the value if this could be a string. This is not strictly comnpliant with the DIS standard. -void EntityMarking::setByStringCharacters(const char* x) -{ - std::strncpy(_characters, x, 11-1); - _characters[11 -1] = '\0'; -} - -void EntityMarking::marshal(DataStream& dataStream) const -{ - dataStream << _characterSet; - - for(size_t idx = 0; idx < 11; idx++) - { - dataStream << _characters[idx]; - } - -} - -void EntityMarking::unmarshal(DataStream& dataStream) -{ - dataStream >> _characterSet; - - for(size_t idx = 0; idx < 11; idx++) - { - dataStream >> _characters[idx]; - } - -} - - -bool EntityMarking::operator ==(const EntityMarking& rhs) const - { - bool ivarsEqual = true; - - if( ! (_characterSet == rhs._characterSet) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 11; idx++) - { - if(!(_characters[idx] == rhs._characters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EntityMarking::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _characterSet - marshalSize = marshalSize + 11 * 1; // _characters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityMarking.h b/src/dis7/EntityMarking.h deleted file mode 100644 index 62b1a397..00000000 --- a/src/dis7/EntityMarking.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Specifies the character set used inthe first byte, followed by 11 characters of text data. Section 6.29 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityMarking -{ -protected: - /** The character set */ - unsigned char _characterSet; - - /** The characters */ - char _characters[11]; - - - public: - EntityMarking(); - virtual ~EntityMarking(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getCharacterSet() const; - void setCharacterSet(unsigned char pX); - - char* getCharacters(); - const char* getCharacters() const; - void setCharacters( const char* pX); - void setByStringCharacters(const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityMarking& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityStatePdu.cpp b/src/dis7/EntityStatePdu.cpp deleted file mode 100644 index 827ce5f7..00000000 --- a/src/dis7/EntityStatePdu.cpp +++ /dev/null @@ -1,331 +0,0 @@ -#include - -using namespace DIS; - - -EntityStatePdu::EntityStatePdu() : EntityInformationFamilyPdu(), - _entityID(), - _forceId(0), - _numberOfVariableParameters(0), - _entityType(), - _alternativeEntityType(), - _entityLinearVelocity(), - _entityLocation(), - _entityOrientation(), - _entityAppearance(0), - _deadReckoningParameters(), - _marking(), - _capabilities(0) -{ - setPduType( 1 ); -} - -EntityStatePdu::~EntityStatePdu() -{ - _variableParameters.clear(); -} - -EntityID& EntityStatePdu::getEntityID() -{ - return _entityID; -} - -const EntityID& EntityStatePdu::getEntityID() const -{ - return _entityID; -} - -void EntityStatePdu::setEntityID(const EntityID &pX) -{ - _entityID = pX; -} - -unsigned char EntityStatePdu::getForceId() const -{ - return _forceId; -} - -void EntityStatePdu::setForceId(unsigned char pX) -{ - _forceId = pX; -} - -unsigned char EntityStatePdu::getNumberOfVariableParameters() const -{ - return _variableParameters.size(); -} - -EntityType& EntityStatePdu::getEntityType() -{ - return _entityType; -} - -const EntityType& EntityStatePdu::getEntityType() const -{ - return _entityType; -} - -void EntityStatePdu::setEntityType(const EntityType &pX) -{ - _entityType = pX; -} - -EntityType& EntityStatePdu::getAlternativeEntityType() -{ - return _alternativeEntityType; -} - -const EntityType& EntityStatePdu::getAlternativeEntityType() const -{ - return _alternativeEntityType; -} - -void EntityStatePdu::setAlternativeEntityType(const EntityType &pX) -{ - _alternativeEntityType = pX; -} - -Vector3Float& EntityStatePdu::getEntityLinearVelocity() -{ - return _entityLinearVelocity; -} - -const Vector3Float& EntityStatePdu::getEntityLinearVelocity() const -{ - return _entityLinearVelocity; -} - -void EntityStatePdu::setEntityLinearVelocity(const Vector3Float &pX) -{ - _entityLinearVelocity = pX; -} - -Vector3Double& EntityStatePdu::getEntityLocation() -{ - return _entityLocation; -} - -const Vector3Double& EntityStatePdu::getEntityLocation() const -{ - return _entityLocation; -} - -void EntityStatePdu::setEntityLocation(const Vector3Double &pX) -{ - _entityLocation = pX; -} - -EulerAngles& EntityStatePdu::getEntityOrientation() -{ - return _entityOrientation; -} - -const EulerAngles& EntityStatePdu::getEntityOrientation() const -{ - return _entityOrientation; -} - -void EntityStatePdu::setEntityOrientation(const EulerAngles &pX) -{ - _entityOrientation = pX; -} - -unsigned int EntityStatePdu::getEntityAppearance() const -{ - return _entityAppearance; -} - -void EntityStatePdu::setEntityAppearance(unsigned int pX) -{ - _entityAppearance = pX; -} - -DeadReckoningParameters& EntityStatePdu::getDeadReckoningParameters() -{ - return _deadReckoningParameters; -} - -const DeadReckoningParameters& EntityStatePdu::getDeadReckoningParameters() const -{ - return _deadReckoningParameters; -} - -void EntityStatePdu::setDeadReckoningParameters(const DeadReckoningParameters &pX) -{ - _deadReckoningParameters = pX; -} - -EntityMarking& EntityStatePdu::getMarking() -{ - return _marking; -} - -const EntityMarking& EntityStatePdu::getMarking() const -{ - return _marking; -} - -void EntityStatePdu::setMarking(const EntityMarking &pX) -{ - _marking = pX; -} - -unsigned int EntityStatePdu::getCapabilities() const -{ - return _capabilities; -} - -void EntityStatePdu::setCapabilities(unsigned int pX) -{ - _capabilities = pX; -} - -std::vector& EntityStatePdu::getVariableParameters() -{ - return _variableParameters; -} - -const std::vector& EntityStatePdu::getVariableParameters() const -{ - return _variableParameters; -} - -void EntityStatePdu::setVariableParameters(const std::vector& pX) -{ - _variableParameters = pX; -} - -void EntityStatePdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _entityID.marshal(dataStream); - dataStream << _forceId; - dataStream << ( unsigned char )_variableParameters.size(); - _entityType.marshal(dataStream); - _alternativeEntityType.marshal(dataStream); - _entityLinearVelocity.marshal(dataStream); - _entityLocation.marshal(dataStream); - _entityOrientation.marshal(dataStream); - dataStream << _entityAppearance; - _deadReckoningParameters.marshal(dataStream); - _marking.marshal(dataStream); - dataStream << _capabilities; - - for(size_t idx = 0; idx < _variableParameters.size(); idx++) - { - VariableParameter x = _variableParameters[idx]; - x.marshal(dataStream); - } - -} - -void EntityStatePdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _entityID.unmarshal(dataStream); - dataStream >> _forceId; - dataStream >> _numberOfVariableParameters; - _entityType.unmarshal(dataStream); - _alternativeEntityType.unmarshal(dataStream); - _entityLinearVelocity.unmarshal(dataStream); - _entityLocation.unmarshal(dataStream); - _entityOrientation.unmarshal(dataStream); - dataStream >> _entityAppearance; - _deadReckoningParameters.unmarshal(dataStream); - _marking.unmarshal(dataStream); - dataStream >> _capabilities; - - _variableParameters.clear(); - for(size_t idx = 0; idx < _numberOfVariableParameters; idx++) - { - VariableParameter x; - x.unmarshal(dataStream); - _variableParameters.push_back(x); - } -} - - -bool EntityStatePdu::operator ==(const EntityStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_entityID == rhs._entityID) ) ivarsEqual = false; - if( ! (_forceId == rhs._forceId) ) ivarsEqual = false; - if( ! (_entityType == rhs._entityType) ) ivarsEqual = false; - if( ! (_alternativeEntityType == rhs._alternativeEntityType) ) ivarsEqual = false; - if( ! (_entityLinearVelocity == rhs._entityLinearVelocity) ) ivarsEqual = false; - if( ! (_entityLocation == rhs._entityLocation) ) ivarsEqual = false; - if( ! (_entityOrientation == rhs._entityOrientation) ) ivarsEqual = false; - if( ! (_entityAppearance == rhs._entityAppearance) ) ivarsEqual = false; - if( ! (_deadReckoningParameters == rhs._deadReckoningParameters) ) ivarsEqual = false; - if( ! (_marking == rhs._marking) ) ivarsEqual = false; - if( ! (_capabilities == rhs._capabilities) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _variableParameters.size(); idx++) - { - if( ! ( _variableParameters[idx] == rhs._variableParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EntityStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID - marshalSize = marshalSize + 1; // _forceId - marshalSize = marshalSize + 1; // _numberOfVariableParameters - marshalSize = marshalSize + _entityType.getMarshalledSize(); // _entityType - marshalSize = marshalSize + _alternativeEntityType.getMarshalledSize(); // _alternativeEntityType - marshalSize = marshalSize + _entityLinearVelocity.getMarshalledSize(); // _entityLinearVelocity - marshalSize = marshalSize + _entityLocation.getMarshalledSize(); // _entityLocation - marshalSize = marshalSize + _entityOrientation.getMarshalledSize(); // _entityOrientation - marshalSize = marshalSize + 4; // _entityAppearance - marshalSize = marshalSize + _deadReckoningParameters.getMarshalledSize(); // _deadReckoningParameters - marshalSize = marshalSize + _marking.getMarshalledSize(); // _marking - marshalSize = marshalSize + 4; // _capabilities - - for(unsigned long long idx=0; idx < _variableParameters.size(); idx++) - { - VariableParameter listElement = _variableParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityStatePdu.h b/src/dis7/EntityStatePdu.h deleted file mode 100644 index bc32267d..00000000 --- a/src/dis7/EntityStatePdu.h +++ /dev/null @@ -1,158 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Represents the postion and state of one entity in the world. Section 7.2.2. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityStatePdu : public EntityInformationFamilyPdu -{ -protected: - /** Unique ID for an entity that is tied to this state information */ - EntityID _entityID; - - /** What force this entity is affiliated with, eg red, blue, neutral, etc */ - unsigned char _forceId; - - /** How many variable parameters are in the variable length list. In earlier versions of DIS these were known as articulation parameters */ - unsigned char _numberOfVariableParameters; - - /** Describes the type of entity in the world */ - EntityType _entityType; - - EntityType _alternativeEntityType; - - /** Describes the speed of the entity in the world */ - Vector3Float _entityLinearVelocity; - - /** describes the location of the entity in the world */ - Vector3Double _entityLocation; - - /** describes the orientation of the entity, in euler angles */ - EulerAngles _entityOrientation; - - /** a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. */ - unsigned int _entityAppearance; - - /** parameters used for dead reckoning */ - DeadReckoningParameters _deadReckoningParameters; - - /** characters that can be used for debugging, or to draw unique strings on the side of entities in the world */ - EntityMarking _marking; - - /** a series of bit flags */ - unsigned int _capabilities; - - /** variable length list of variable parameters. In earlier DIS versions this was articulation parameters. */ - std::vector _variableParameters; - - - public: - EntityStatePdu(); - virtual ~EntityStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityID(); - const EntityID& getEntityID() const; - void setEntityID(const EntityID &pX); - - unsigned char getForceId() const; - void setForceId(unsigned char pX); - - unsigned char getNumberOfVariableParameters() const; - - EntityType& getEntityType(); - const EntityType& getEntityType() const; - void setEntityType(const EntityType &pX); - - EntityType& getAlternativeEntityType(); - const EntityType& getAlternativeEntityType() const; - void setAlternativeEntityType(const EntityType &pX); - - Vector3Float& getEntityLinearVelocity(); - const Vector3Float& getEntityLinearVelocity() const; - void setEntityLinearVelocity(const Vector3Float &pX); - - Vector3Double& getEntityLocation(); - const Vector3Double& getEntityLocation() const; - void setEntityLocation(const Vector3Double &pX); - - EulerAngles& getEntityOrientation(); - const EulerAngles& getEntityOrientation() const; - void setEntityOrientation(const EulerAngles &pX); - - unsigned int getEntityAppearance() const; - void setEntityAppearance(unsigned int pX); - - DeadReckoningParameters& getDeadReckoningParameters(); - const DeadReckoningParameters& getDeadReckoningParameters() const; - void setDeadReckoningParameters(const DeadReckoningParameters &pX); - - EntityMarking& getMarking(); - const EntityMarking& getMarking() const; - void setMarking(const EntityMarking &pX); - - unsigned int getCapabilities() const; - void setCapabilities(unsigned int pX); - - std::vector& getVariableParameters(); - const std::vector& getVariableParameters() const; - void setVariableParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityStateUpdatePdu.cpp b/src/dis7/EntityStateUpdatePdu.cpp deleted file mode 100644 index 5be5b598..00000000 --- a/src/dis7/EntityStateUpdatePdu.cpp +++ /dev/null @@ -1,237 +0,0 @@ -#include - -using namespace DIS; - - -EntityStateUpdatePdu::EntityStateUpdatePdu() : EntityInformationFamilyPdu(), - _entityID(), - _padding1(0), - _numberOfVariableParameters(0), - _entityLinearVelocity(), - _entityLocation(), - _entityOrientation(), - _entityAppearance(0) -{ - setPduType( 67 ); - setProtocolFamily( 1 ); -} - -EntityStateUpdatePdu::~EntityStateUpdatePdu() -{ - _variableParameters.clear(); -} - -EntityID& EntityStateUpdatePdu::getEntityID() -{ - return _entityID; -} - -const EntityID& EntityStateUpdatePdu::getEntityID() const -{ - return _entityID; -} - -void EntityStateUpdatePdu::setEntityID(const EntityID &pX) -{ - _entityID = pX; -} - -char EntityStateUpdatePdu::getPadding1() const -{ - return _padding1; -} - -void EntityStateUpdatePdu::setPadding1(char pX) -{ - _padding1 = pX; -} - -unsigned char EntityStateUpdatePdu::getNumberOfVariableParameters() const -{ - return _variableParameters.size(); -} - -Vector3Float& EntityStateUpdatePdu::getEntityLinearVelocity() -{ - return _entityLinearVelocity; -} - -const Vector3Float& EntityStateUpdatePdu::getEntityLinearVelocity() const -{ - return _entityLinearVelocity; -} - -void EntityStateUpdatePdu::setEntityLinearVelocity(const Vector3Float &pX) -{ - _entityLinearVelocity = pX; -} - -Vector3Double& EntityStateUpdatePdu::getEntityLocation() -{ - return _entityLocation; -} - -const Vector3Double& EntityStateUpdatePdu::getEntityLocation() const -{ - return _entityLocation; -} - -void EntityStateUpdatePdu::setEntityLocation(const Vector3Double &pX) -{ - _entityLocation = pX; -} - -EulerAngles& EntityStateUpdatePdu::getEntityOrientation() -{ - return _entityOrientation; -} - -const EulerAngles& EntityStateUpdatePdu::getEntityOrientation() const -{ - return _entityOrientation; -} - -void EntityStateUpdatePdu::setEntityOrientation(const EulerAngles &pX) -{ - _entityOrientation = pX; -} - -unsigned int EntityStateUpdatePdu::getEntityAppearance() const -{ - return _entityAppearance; -} - -void EntityStateUpdatePdu::setEntityAppearance(unsigned int pX) -{ - _entityAppearance = pX; -} - -std::vector& EntityStateUpdatePdu::getVariableParameters() -{ - return _variableParameters; -} - -const std::vector& EntityStateUpdatePdu::getVariableParameters() const -{ - return _variableParameters; -} - -void EntityStateUpdatePdu::setVariableParameters(const std::vector& pX) -{ - _variableParameters = pX; -} - -void EntityStateUpdatePdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _entityID.marshal(dataStream); - dataStream << _padding1; - dataStream << ( unsigned char )_variableParameters.size(); - _entityLinearVelocity.marshal(dataStream); - _entityLocation.marshal(dataStream); - _entityOrientation.marshal(dataStream); - dataStream << _entityAppearance; - - for(size_t idx = 0; idx < _variableParameters.size(); idx++) - { - VariableParameter x = _variableParameters[idx]; - x.marshal(dataStream); - } - -} - -void EntityStateUpdatePdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _entityID.unmarshal(dataStream); - dataStream >> _padding1; - dataStream >> _numberOfVariableParameters; - _entityLinearVelocity.unmarshal(dataStream); - _entityLocation.unmarshal(dataStream); - _entityOrientation.unmarshal(dataStream); - dataStream >> _entityAppearance; - - _variableParameters.clear(); - for(size_t idx = 0; idx < _numberOfVariableParameters; idx++) - { - VariableParameter x; - x.unmarshal(dataStream); - _variableParameters.push_back(x); - } -} - - -bool EntityStateUpdatePdu::operator ==(const EntityStateUpdatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_entityID == rhs._entityID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_entityLinearVelocity == rhs._entityLinearVelocity) ) ivarsEqual = false; - if( ! (_entityLocation == rhs._entityLocation) ) ivarsEqual = false; - if( ! (_entityOrientation == rhs._entityOrientation) ) ivarsEqual = false; - if( ! (_entityAppearance == rhs._entityAppearance) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _variableParameters.size(); idx++) - { - if( ! ( _variableParameters[idx] == rhs._variableParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EntityStateUpdatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID - marshalSize = marshalSize + 1; // _padding1 - marshalSize = marshalSize + 1; // _numberOfVariableParameters - marshalSize = marshalSize + _entityLinearVelocity.getMarshalledSize(); // _entityLinearVelocity - marshalSize = marshalSize + _entityLocation.getMarshalledSize(); // _entityLocation - marshalSize = marshalSize + _entityOrientation.getMarshalledSize(); // _entityOrientation - marshalSize = marshalSize + 4; // _entityAppearance - - for(unsigned long long idx=0; idx < _variableParameters.size(); idx++) - { - VariableParameter listElement = _variableParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityStateUpdatePdu.h b/src/dis7/EntityStateUpdatePdu.h deleted file mode 100644 index 4e1922e7..00000000 --- a/src/dis7/EntityStateUpdatePdu.h +++ /dev/null @@ -1,121 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Nonstatic information about a particular entity may be communicated by issuing an Entity State Update PDU. Section 7.2.5. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityStateUpdatePdu : public EntityInformationFamilyPdu -{ -protected: - /** This field shall identify the entity issuing the PDU, and shall be represented by an Entity Identifier record (see 6.2.28). */ - EntityID _entityID; - - /** Padding */ - char _padding1; - - /** This field shall specify the number of variable parameters present. This field shall be represented by an 8-bit unsigned integer (see Annex I). */ - unsigned char _numberOfVariableParameters; - - /** This field shall specify an entity’s linear velocity. The coordinate system for an entity’s linear velocity depends on the dead reckoning algorithm used. This field shall be represented by a Linear Velocity Vector record [see 6.2.95 item c)]). */ - Vector3Float _entityLinearVelocity; - - /** This field shall specify an entity’s physical location in the simulated world and shall be represented by a World Coordinates record (see 6.2.97). */ - Vector3Double _entityLocation; - - /** This field shall specify an entity’s orientation and shall be represented by an Euler Angles record (see 6.2.33). */ - EulerAngles _entityOrientation; - - /** This field shall specify the dynamic changes to the entity’s appearance attributes. This field shall be represented by an Entity Appearance record (see 6.2.26). */ - unsigned int _entityAppearance; - - /** This field shall specify the parameter values for each Variable Parameter record that is included (see 6.2.93 and Annex I). */ - std::vector _variableParameters; - - - public: - EntityStateUpdatePdu(); - virtual ~EntityStateUpdatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityID(); - const EntityID& getEntityID() const; - void setEntityID(const EntityID &pX); - - char getPadding1() const; - void setPadding1(char pX); - - unsigned char getNumberOfVariableParameters() const; - - Vector3Float& getEntityLinearVelocity(); - const Vector3Float& getEntityLinearVelocity() const; - void setEntityLinearVelocity(const Vector3Float &pX); - - Vector3Double& getEntityLocation(); - const Vector3Double& getEntityLocation() const; - void setEntityLocation(const Vector3Double &pX); - - EulerAngles& getEntityOrientation(); - const EulerAngles& getEntityOrientation() const; - void setEntityOrientation(const EulerAngles &pX); - - unsigned int getEntityAppearance() const; - void setEntityAppearance(unsigned int pX); - - std::vector& getVariableParameters(); - const std::vector& getVariableParameters() const; - void setVariableParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityStateUpdatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityType.cpp b/src/dis7/EntityType.cpp deleted file mode 100644 index 905b01fe..00000000 --- a/src/dis7/EntityType.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -EntityType::EntityType(): - _entityKind(0), - _domain(0), - _country(0), - _category(0), - _subcategory(0), - _specific(0), - _extra(0) -{ -} - -EntityType::~EntityType() -{ -} - -unsigned char EntityType::getEntityKind() const -{ - return _entityKind; -} - -void EntityType::setEntityKind(unsigned char pX) -{ - _entityKind = pX; -} - -unsigned char EntityType::getDomain() const -{ - return _domain; -} - -void EntityType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short EntityType::getCountry() const -{ - return _country; -} - -void EntityType::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char EntityType::getCategory() const -{ - return _category; -} - -void EntityType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char EntityType::getSubcategory() const -{ - return _subcategory; -} - -void EntityType::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char EntityType::getSpecific() const -{ - return _specific; -} - -void EntityType::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -unsigned char EntityType::getExtra() const -{ - return _extra; -} - -void EntityType::setExtra(unsigned char pX) -{ - _extra = pX; -} - -void EntityType::marshal(DataStream& dataStream) const -{ - dataStream << _entityKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; - dataStream << _extra; -} - -void EntityType::unmarshal(DataStream& dataStream) -{ - dataStream >> _entityKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; - dataStream >> _extra; -} - - -bool EntityType::operator ==(const EntityType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityKind == rhs._entityKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - if( ! (_extra == rhs._extra) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EntityType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _entityKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - marshalSize = marshalSize + 1; // _extra - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityType.h b/src/dis7/EntityType.h deleted file mode 100644 index 629a210b..00000000 --- a/src/dis7/EntityType.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Identifies the type of entity, including kind of entity, domain (surface, subsurface, air, etc) country, category, etc. Section 6.2.30 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityType -{ -protected: - /** Kind of entity */ - unsigned char _entityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - /** specific info based on subcategory field. Renamed from specific because that is a reserved word in SQL. */ - unsigned char _specific; - - unsigned char _extra; - - - public: - EntityType(); - virtual ~EntityType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getEntityKind() const; - void setEntityKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - unsigned char getExtra() const; - void setExtra(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityTypeVP.cpp b/src/dis7/EntityTypeVP.cpp deleted file mode 100644 index 38d0c610..00000000 --- a/src/dis7/EntityTypeVP.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include - -using namespace DIS; - - -EntityTypeVP::EntityTypeVP(): - _recordType(3), - _changeIndicator(0), - _entityType(), - _padding(0), - _padding1(0) -{ -} - -EntityTypeVP::~EntityTypeVP() -{ -} - -unsigned char EntityTypeVP::getRecordType() const -{ - return _recordType; -} - -void EntityTypeVP::setRecordType(unsigned char pX) -{ - _recordType = pX; -} - -unsigned char EntityTypeVP::getChangeIndicator() const -{ - return _changeIndicator; -} - -void EntityTypeVP::setChangeIndicator(unsigned char pX) -{ - _changeIndicator = pX; -} - -EntityType& EntityTypeVP::getEntityType() -{ - return _entityType; -} - -const EntityType& EntityTypeVP::getEntityType() const -{ - return _entityType; -} - -void EntityTypeVP::setEntityType(const EntityType &pX) -{ - _entityType = pX; -} - -unsigned short EntityTypeVP::getPadding() const -{ - return _padding; -} - -void EntityTypeVP::setPadding(unsigned short pX) -{ - _padding = pX; -} - -unsigned int EntityTypeVP::getPadding1() const -{ - return _padding1; -} - -void EntityTypeVP::setPadding1(unsigned int pX) -{ - _padding1 = pX; -} - -void EntityTypeVP::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _changeIndicator; - _entityType.marshal(dataStream); - dataStream << _padding; - dataStream << _padding1; -} - -void EntityTypeVP::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _changeIndicator; - _entityType.unmarshal(dataStream); - dataStream >> _padding; - dataStream >> _padding1; -} - - -bool EntityTypeVP::operator ==(const EntityTypeVP& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_changeIndicator == rhs._changeIndicator) ) ivarsEqual = false; - if( ! (_entityType == rhs._entityType) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EntityTypeVP::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _recordType - marshalSize = marshalSize + 1; // _changeIndicator - marshalSize = marshalSize + _entityType.getMarshalledSize(); // _entityType - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + 4; // _padding1 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EntityTypeVP.h b/src/dis7/EntityTypeVP.h deleted file mode 100644 index 788d4956..00000000 --- a/src/dis7/EntityTypeVP.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Association or disassociation of two entities. Section 6.2.93.5 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EntityTypeVP -{ -protected: - /** the identification of the Variable Parameter record. Enumeration from EBV */ - unsigned char _recordType; - - /** Indicates if this VP has changed since last issuance */ - unsigned char _changeIndicator; - - /** */ - EntityType _entityType; - - /** padding */ - unsigned short _padding; - - /** padding */ - unsigned int _padding1; - - - public: - EntityTypeVP(); - virtual ~EntityTypeVP(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRecordType() const; - void setRecordType(unsigned char pX); - - unsigned char getChangeIndicator() const; - void setChangeIndicator(unsigned char pX); - - EntityType& getEntityType(); - const EntityType& getEntityType() const; - void setEntityType(const EntityType &pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - unsigned int getPadding1() const; - void setPadding1(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EntityTypeVP& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Environment.cpp b/src/dis7/Environment.cpp deleted file mode 100644 index 70d22af1..00000000 --- a/src/dis7/Environment.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -Environment::Environment(): - _environmentType(0), - _length(0), - _index(0), - _padding(0) -{ -} - -Environment::~Environment() -{ -} - -unsigned int Environment::getEnvironmentType() const -{ - return _environmentType; -} - -void Environment::setEnvironmentType(unsigned int pX) -{ - _environmentType = pX; -} - -unsigned short Environment::getLength() const -{ - return _length; -} - -void Environment::setLength(unsigned short pX) -{ - _length = pX; -} - -unsigned char Environment::getIndex() const -{ - return _index; -} - -void Environment::setIndex(unsigned char pX) -{ - _index = pX; -} - -unsigned char Environment::getPadding() const -{ - return _padding; -} - -void Environment::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void Environment::marshal(DataStream& dataStream) const -{ - dataStream << _environmentType; - dataStream << _length; - dataStream << _index; - dataStream << _padding; -} - -void Environment::unmarshal(DataStream& dataStream) -{ - dataStream >> _environmentType; - dataStream >> _length; - dataStream >> _index; - dataStream >> _padding; -} - - -bool Environment::operator ==(const Environment& rhs) const - { - bool ivarsEqual = true; - - if( ! (_environmentType == rhs._environmentType) ) ivarsEqual = false; - if( ! (_length == rhs._length) ) ivarsEqual = false; - if( ! (_index == rhs._index) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Environment::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _environmentType - marshalSize = marshalSize + 2; // _length - marshalSize = marshalSize + 1; // _index - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Environment.h b/src/dis7/Environment.h deleted file mode 100644 index a627daf8..00000000 --- a/src/dis7/Environment.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Incomplete environment record; requires hand coding to fix. Section 6.2.31.1 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Environment -{ -protected: - /** type */ - unsigned int _environmentType; - - /** length, in bits, of the record */ - unsigned short _length; - - /** identifies the sequntially numbered record index */ - unsigned char _index; - - /** padding */ - unsigned char _padding; - - - public: - Environment(); - virtual ~Environment(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getEnvironmentType() const; - void setEnvironmentType(unsigned int pX); - - unsigned short getLength() const; - void setLength(unsigned short pX); - - unsigned char getIndex() const; - void setIndex(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Environment& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EnvironmentGeneral.cpp b/src/dis7/EnvironmentGeneral.cpp deleted file mode 100644 index 6726ad7b..00000000 --- a/src/dis7/EnvironmentGeneral.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -EnvironmentGeneral::EnvironmentGeneral(): - _environmentType(0), - _length(0), - _index(0), - _padding1(0), - _geometry(0), - _padding2(0) -{ -} - -EnvironmentGeneral::~EnvironmentGeneral() -{ -} - -unsigned int EnvironmentGeneral::getEnvironmentType() const -{ - return _environmentType; -} - -void EnvironmentGeneral::setEnvironmentType(unsigned int pX) -{ - _environmentType = pX; -} - -unsigned char EnvironmentGeneral::getLength() const -{ - return _length; -} - -void EnvironmentGeneral::setLength(unsigned char pX) -{ - _length = pX; -} - -unsigned char EnvironmentGeneral::getIndex() const -{ - return _index; -} - -void EnvironmentGeneral::setIndex(unsigned char pX) -{ - _index = pX; -} - -unsigned char EnvironmentGeneral::getPadding1() const -{ - return _padding1; -} - -void EnvironmentGeneral::setPadding1(unsigned char pX) -{ - _padding1 = pX; -} - -unsigned char EnvironmentGeneral::getGeometry() const -{ - return _geometry; -} - -void EnvironmentGeneral::setGeometry(unsigned char pX) -{ - _geometry = pX; -} - -unsigned char EnvironmentGeneral::getPadding2() const -{ - return _padding2; -} - -void EnvironmentGeneral::setPadding2(unsigned char pX) -{ - _padding2 = pX; -} - -void EnvironmentGeneral::marshal(DataStream& dataStream) const -{ - dataStream << _environmentType; - dataStream << _length; - dataStream << _index; - dataStream << _padding1; - dataStream << _geometry; - dataStream << _padding2; -} - -void EnvironmentGeneral::unmarshal(DataStream& dataStream) -{ - dataStream >> _environmentType; - dataStream >> _length; - dataStream >> _index; - dataStream >> _padding1; - dataStream >> _geometry; - dataStream >> _padding2; -} - - -bool EnvironmentGeneral::operator ==(const EnvironmentGeneral& rhs) const - { - bool ivarsEqual = true; - - if( ! (_environmentType == rhs._environmentType) ) ivarsEqual = false; - if( ! (_length == rhs._length) ) ivarsEqual = false; - if( ! (_index == rhs._index) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_geometry == rhs._geometry) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EnvironmentGeneral::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _environmentType - marshalSize = marshalSize + 1; // _length - marshalSize = marshalSize + 1; // _index - marshalSize = marshalSize + 1; // _padding1 - marshalSize = marshalSize + 1; // _geometry - marshalSize = marshalSize + 1; // _padding2 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EnvironmentGeneral.h b/src/dis7/EnvironmentGeneral.h deleted file mode 100644 index e4883df5..00000000 --- a/src/dis7/EnvironmentGeneral.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Information about a geometry, a state associated with a geometry, a bounding volume, or an associated entity ID. NOTE: this class requires hand coding. 6.2.31 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EnvironmentGeneral -{ -protected: - /** Record type */ - unsigned int _environmentType; - - /** length, in bits */ - unsigned char _length; - - /** Identify the sequentially numbered record index */ - unsigned char _index; - - /** padding */ - unsigned char _padding1; - - /** Geometry or state record */ - unsigned char _geometry; - - /** padding to bring the total size up to a 64 bit boundry */ - unsigned char _padding2; - - - public: - EnvironmentGeneral(); - virtual ~EnvironmentGeneral(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getEnvironmentType() const; - void setEnvironmentType(unsigned int pX); - - unsigned char getLength() const; - void setLength(unsigned char pX); - - unsigned char getIndex() const; - void setIndex(unsigned char pX); - - unsigned char getPadding1() const; - void setPadding1(unsigned char pX); - - unsigned char getGeometry() const; - void setGeometry(unsigned char pX); - - unsigned char getPadding2() const; - void setPadding2(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EnvironmentGeneral& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EnvironmentType.cpp b/src/dis7/EnvironmentType.cpp deleted file mode 100644 index f5a1e3ab..00000000 --- a/src/dis7/EnvironmentType.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -EnvironmentType::EnvironmentType(): - _entityKind(0), - _domain(0), - _entityClass(0), - _category(0), - _subcategory(0), - _specific(0), - _extra(0) -{ -} - -EnvironmentType::~EnvironmentType() -{ -} - -unsigned char EnvironmentType::getEntityKind() const -{ - return _entityKind; -} - -void EnvironmentType::setEntityKind(unsigned char pX) -{ - _entityKind = pX; -} - -unsigned char EnvironmentType::getDomain() const -{ - return _domain; -} - -void EnvironmentType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short EnvironmentType::getEntityClass() const -{ - return _entityClass; -} - -void EnvironmentType::setEntityClass(unsigned short pX) -{ - _entityClass = pX; -} - -unsigned char EnvironmentType::getCategory() const -{ - return _category; -} - -void EnvironmentType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char EnvironmentType::getSubcategory() const -{ - return _subcategory; -} - -void EnvironmentType::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char EnvironmentType::getSpecific() const -{ - return _specific; -} - -void EnvironmentType::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -unsigned char EnvironmentType::getExtra() const -{ - return _extra; -} - -void EnvironmentType::setExtra(unsigned char pX) -{ - _extra = pX; -} - -void EnvironmentType::marshal(DataStream& dataStream) const -{ - dataStream << _entityKind; - dataStream << _domain; - dataStream << _entityClass; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; - dataStream << _extra; -} - -void EnvironmentType::unmarshal(DataStream& dataStream) -{ - dataStream >> _entityKind; - dataStream >> _domain; - dataStream >> _entityClass; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; - dataStream >> _extra; -} - - -bool EnvironmentType::operator ==(const EnvironmentType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityKind == rhs._entityKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_entityClass == rhs._entityClass) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - if( ! (_extra == rhs._extra) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EnvironmentType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _entityKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _entityClass - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - marshalSize = marshalSize + 1; // _extra - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EnvironmentType.h b/src/dis7/EnvironmentType.h deleted file mode 100644 index 20fc452a..00000000 --- a/src/dis7/EnvironmentType.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Description of environmental data in environmental process and gridded data PDUs. Section 6.2.32 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EnvironmentType -{ -protected: - /** Kind of entity */ - unsigned char _entityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** class of environmental entity */ - unsigned short _entityClass; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - /** specific info based on subcategory field */ - unsigned char _specific; - - unsigned char _extra; - - - public: - EnvironmentType(); - virtual ~EnvironmentType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getEntityKind() const; - void setEntityKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getEntityClass() const; - void setEntityClass(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - unsigned char getExtra() const; - void setExtra(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EnvironmentType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EulerAngles.cpp b/src/dis7/EulerAngles.cpp deleted file mode 100644 index 37713757..00000000 --- a/src/dis7/EulerAngles.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -EulerAngles::EulerAngles(): - _psi(0.0), - _theta(0.0), - _phi(0.0) -{ -} - -EulerAngles::~EulerAngles() -{ -} - -float EulerAngles::getPsi() const -{ - return _psi; -} - -void EulerAngles::setPsi(float pX) -{ - _psi = pX; -} - -float EulerAngles::getTheta() const -{ - return _theta; -} - -void EulerAngles::setTheta(float pX) -{ - _theta = pX; -} - -float EulerAngles::getPhi() const -{ - return _phi; -} - -void EulerAngles::setPhi(float pX) -{ - _phi = pX; -} - -void EulerAngles::marshal(DataStream& dataStream) const -{ - dataStream << _psi; - dataStream << _theta; - dataStream << _phi; -} - -void EulerAngles::unmarshal(DataStream& dataStream) -{ - dataStream >> _psi; - dataStream >> _theta; - dataStream >> _phi; -} - - -bool EulerAngles::operator ==(const EulerAngles& rhs) const - { - bool ivarsEqual = true; - - if( ! (_psi == rhs._psi) ) ivarsEqual = false; - if( ! (_theta == rhs._theta) ) ivarsEqual = false; - if( ! (_phi == rhs._phi) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EulerAngles::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _psi - marshalSize = marshalSize + 4; // _theta - marshalSize = marshalSize + 4; // _phi - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EulerAngles.h b/src/dis7/EulerAngles.h deleted file mode 100644 index c57a835e..00000000 --- a/src/dis7/EulerAngles.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Three floating point values representing an orientation, psi, theta, and phi, aka the euler angles, in radians. Section 6.2.33 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EulerAngles -{ -protected: - float _psi; - - float _theta; - - float _phi; - - - public: - EulerAngles(); - virtual ~EulerAngles(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getPsi() const; - void setPsi(float pX); - - float getTheta() const; - void setTheta(float pX); - - float getPhi() const; - void setPhi(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EulerAngles& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EventIdentifier.cpp b/src/dis7/EventIdentifier.cpp deleted file mode 100644 index ba807175..00000000 --- a/src/dis7/EventIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -EventIdentifier::EventIdentifier(): - _simulationAddress(), - _eventNumber(0) -{ -} - -EventIdentifier::~EventIdentifier() -{ -} - -SimulationAddress& EventIdentifier::getSimulationAddress() -{ - return _simulationAddress; -} - -const SimulationAddress& EventIdentifier::getSimulationAddress() const -{ - return _simulationAddress; -} - -void EventIdentifier::setSimulationAddress(const SimulationAddress &pX) -{ - _simulationAddress = pX; -} - -unsigned short EventIdentifier::getEventNumber() const -{ - return _eventNumber; -} - -void EventIdentifier::setEventNumber(unsigned short pX) -{ - _eventNumber = pX; -} - -void EventIdentifier::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _eventNumber; -} - -void EventIdentifier::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _eventNumber; -} - - -bool EventIdentifier::operator ==(const EventIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_eventNumber == rhs._eventNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EventIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _eventNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EventIdentifier.h b/src/dis7/EventIdentifier.h deleted file mode 100644 index 852d354f..00000000 --- a/src/dis7/EventIdentifier.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Identifies an event in the world. Use this format for every PDU EXCEPT the LiveEntityPdu. Section 6.2.34. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EventIdentifier -{ -protected: - /** Site and application IDs */ - SimulationAddress _simulationAddress; - - unsigned short _eventNumber; - - - public: - EventIdentifier(); - virtual ~EventIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getSimulationAddress(); - const SimulationAddress& getSimulationAddress() const; - void setSimulationAddress(const SimulationAddress &pX); - - unsigned short getEventNumber() const; - void setEventNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EventIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EventIdentifierLiveEntity.cpp b/src/dis7/EventIdentifierLiveEntity.cpp deleted file mode 100644 index b894d3c7..00000000 --- a/src/dis7/EventIdentifierLiveEntity.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -EventIdentifierLiveEntity::EventIdentifierLiveEntity(): - _siteNumber(0), - _applicationNumber(0), - _eventNumber(0) -{ -} - -EventIdentifierLiveEntity::~EventIdentifierLiveEntity() -{ -} - -unsigned char EventIdentifierLiveEntity::getSiteNumber() const -{ - return _siteNumber; -} - -void EventIdentifierLiveEntity::setSiteNumber(unsigned char pX) -{ - _siteNumber = pX; -} - -unsigned char EventIdentifierLiveEntity::getApplicationNumber() const -{ - return _applicationNumber; -} - -void EventIdentifierLiveEntity::setApplicationNumber(unsigned char pX) -{ - _applicationNumber = pX; -} - -unsigned short EventIdentifierLiveEntity::getEventNumber() const -{ - return _eventNumber; -} - -void EventIdentifierLiveEntity::setEventNumber(unsigned short pX) -{ - _eventNumber = pX; -} - -void EventIdentifierLiveEntity::marshal(DataStream& dataStream) const -{ - dataStream << _siteNumber; - dataStream << _applicationNumber; - dataStream << _eventNumber; -} - -void EventIdentifierLiveEntity::unmarshal(DataStream& dataStream) -{ - dataStream >> _siteNumber; - dataStream >> _applicationNumber; - dataStream >> _eventNumber; -} - - -bool EventIdentifierLiveEntity::operator ==(const EventIdentifierLiveEntity& rhs) const - { - bool ivarsEqual = true; - - if( ! (_siteNumber == rhs._siteNumber) ) ivarsEqual = false; - if( ! (_applicationNumber == rhs._applicationNumber) ) ivarsEqual = false; - if( ! (_eventNumber == rhs._eventNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int EventIdentifierLiveEntity::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _siteNumber - marshalSize = marshalSize + 1; // _applicationNumber - marshalSize = marshalSize + 2; // _eventNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EventIdentifierLiveEntity.h b/src/dis7/EventIdentifierLiveEntity.h deleted file mode 100644 index e7528b29..00000000 --- a/src/dis7/EventIdentifierLiveEntity.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Identifies an event in the world. Use this format for ONLY the LiveEntityPdu. Section 6.2.34. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EventIdentifierLiveEntity -{ -protected: - unsigned char _siteNumber; - - unsigned char _applicationNumber; - - unsigned short _eventNumber; - - - public: - EventIdentifierLiveEntity(); - virtual ~EventIdentifierLiveEntity(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getSiteNumber() const; - void setSiteNumber(unsigned char pX); - - unsigned char getApplicationNumber() const; - void setApplicationNumber(unsigned char pX); - - unsigned short getEventNumber() const; - void setEventNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EventIdentifierLiveEntity& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EventReportPdu.cpp b/src/dis7/EventReportPdu.cpp deleted file mode 100644 index 82befb02..00000000 --- a/src/dis7/EventReportPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -EventReportPdu::EventReportPdu() : SimulationManagementFamilyPdu(), - _eventType(0), - _padding1(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 21 ); -} - -EventReportPdu::~EventReportPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int EventReportPdu::getEventType() const -{ - return _eventType; -} - -void EventReportPdu::setEventType(unsigned int pX) -{ - _eventType = pX; -} - -unsigned int EventReportPdu::getPadding1() const -{ - return _padding1; -} - -void EventReportPdu::setPadding1(unsigned int pX) -{ - _padding1 = pX; -} - -unsigned int EventReportPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int EventReportPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& EventReportPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& EventReportPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void EventReportPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& EventReportPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& EventReportPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void EventReportPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void EventReportPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _eventType; - dataStream << _padding1; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void EventReportPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _eventType; - dataStream >> _padding1; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool EventReportPdu::operator ==(const EventReportPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_eventType == rhs._eventType) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EventReportPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _eventType - marshalSize = marshalSize + 4; // _padding1 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EventReportPdu.h b/src/dis7/EventReportPdu.h deleted file mode 100644 index ccbca353..00000000 --- a/src/dis7/EventReportPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Reports occurance of a significant event to the simulation manager. Section 7.5.12. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EventReportPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Type of event */ - unsigned int _eventType; - - /** padding */ - unsigned int _padding1; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - EventReportPdu(); - virtual ~EventReportPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getEventType() const; - void setEventType(unsigned int pX); - - unsigned int getPadding1() const; - void setPadding1(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EventReportPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EventReportReliablePdu.cpp b/src/dis7/EventReportReliablePdu.cpp deleted file mode 100644 index d637db8c..00000000 --- a/src/dis7/EventReportReliablePdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -EventReportReliablePdu::EventReportReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _eventType(0), - _pad1(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 61 ); -} - -EventReportReliablePdu::~EventReportReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned short EventReportReliablePdu::getEventType() const -{ - return _eventType; -} - -void EventReportReliablePdu::setEventType(unsigned short pX) -{ - _eventType = pX; -} - -unsigned int EventReportReliablePdu::getPad1() const -{ - return _pad1; -} - -void EventReportReliablePdu::setPad1(unsigned int pX) -{ - _pad1 = pX; -} - -unsigned int EventReportReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int EventReportReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& EventReportReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& EventReportReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void EventReportReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& EventReportReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& EventReportReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void EventReportReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void EventReportReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _eventType; - dataStream << _pad1; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void EventReportReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _eventType; - dataStream >> _pad1; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool EventReportReliablePdu::operator ==(const EventReportReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_eventType == rhs._eventType) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int EventReportReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _eventType - marshalSize = marshalSize + 4; // _pad1 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/EventReportReliablePdu.h b/src/dis7/EventReportReliablePdu.h deleted file mode 100644 index 43c632a9..00000000 --- a/src/dis7/EventReportReliablePdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.11: reports the occurance of a significatnt event to the simulation manager. Needs manual intervention to fix padding in variable datums. UNFINISHED. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT EventReportReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** Event type */ - unsigned short _eventType; - - /** padding */ - unsigned int _pad1; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - EventReportReliablePdu(); - virtual ~EventReportReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getEventType() const; - void setEventType(unsigned short pX); - - unsigned int getPad1() const; - void setPad1(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const EventReportReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Expendable.cpp b/src/dis7/Expendable.cpp deleted file mode 100644 index 015008c5..00000000 --- a/src/dis7/Expendable.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include - -using namespace DIS; - - -Expendable::Expendable(): - _expendable(), - _station(0), - _quantity(0), - _expendableStatus(0), - _padding(0) -{ -} - -Expendable::~Expendable() -{ -} - -EntityType& Expendable::getExpendable() -{ - return _expendable; -} - -const EntityType& Expendable::getExpendable() const -{ - return _expendable; -} - -void Expendable::setExpendable(const EntityType &pX) -{ - _expendable = pX; -} - -unsigned int Expendable::getStation() const -{ - return _station; -} - -void Expendable::setStation(unsigned int pX) -{ - _station = pX; -} - -unsigned short Expendable::getQuantity() const -{ - return _quantity; -} - -void Expendable::setQuantity(unsigned short pX) -{ - _quantity = pX; -} - -unsigned char Expendable::getExpendableStatus() const -{ - return _expendableStatus; -} - -void Expendable::setExpendableStatus(unsigned char pX) -{ - _expendableStatus = pX; -} - -unsigned char Expendable::getPadding() const -{ - return _padding; -} - -void Expendable::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void Expendable::marshal(DataStream& dataStream) const -{ - _expendable.marshal(dataStream); - dataStream << _station; - dataStream << _quantity; - dataStream << _expendableStatus; - dataStream << _padding; -} - -void Expendable::unmarshal(DataStream& dataStream) -{ - _expendable.unmarshal(dataStream); - dataStream >> _station; - dataStream >> _quantity; - dataStream >> _expendableStatus; - dataStream >> _padding; -} - - -bool Expendable::operator ==(const Expendable& rhs) const - { - bool ivarsEqual = true; - - if( ! (_expendable == rhs._expendable) ) ivarsEqual = false; - if( ! (_station == rhs._station) ) ivarsEqual = false; - if( ! (_quantity == rhs._quantity) ) ivarsEqual = false; - if( ! (_expendableStatus == rhs._expendableStatus) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Expendable::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _expendable.getMarshalledSize(); // _expendable - marshalSize = marshalSize + 4; // _station - marshalSize = marshalSize + 2; // _quantity - marshalSize = marshalSize + 1; // _expendableStatus - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Expendable.h b/src/dis7/Expendable.h deleted file mode 100644 index 9500aab2..00000000 --- a/src/dis7/Expendable.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// An entity's expendable (chaff, flares, etc) information. Section 6.2.36 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Expendable -{ -protected: - /** Type of expendable */ - EntityType _expendable; - - unsigned int _station; - - unsigned short _quantity; - - unsigned char _expendableStatus; - - unsigned char _padding; - - - public: - Expendable(); - virtual ~Expendable(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getExpendable(); - const EntityType& getExpendable() const; - void setExpendable(const EntityType &pX); - - unsigned int getStation() const; - void setStation(unsigned int pX); - - unsigned short getQuantity() const; - void setQuantity(unsigned short pX); - - unsigned char getExpendableStatus() const; - void setExpendableStatus(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Expendable& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ExpendableDescriptor.cpp b/src/dis7/ExpendableDescriptor.cpp deleted file mode 100644 index 5b1016fe..00000000 --- a/src/dis7/ExpendableDescriptor.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -ExpendableDescriptor::ExpendableDescriptor(): - _expendableType(), - _padding(0) -{ -} - -ExpendableDescriptor::~ExpendableDescriptor() -{ -} - -EntityType& ExpendableDescriptor::getExpendableType() -{ - return _expendableType; -} - -const EntityType& ExpendableDescriptor::getExpendableType() const -{ - return _expendableType; -} - -void ExpendableDescriptor::setExpendableType(const EntityType &pX) -{ - _expendableType = pX; -} - -long long ExpendableDescriptor::getPadding() const -{ - return _padding; -} - -void ExpendableDescriptor::setPadding(long long pX) -{ - _padding = pX; -} - -void ExpendableDescriptor::marshal(DataStream& dataStream) const -{ - _expendableType.marshal(dataStream); - dataStream << _padding; -} - -void ExpendableDescriptor::unmarshal(DataStream& dataStream) -{ - _expendableType.unmarshal(dataStream); - dataStream >> _padding; -} - - -bool ExpendableDescriptor::operator ==(const ExpendableDescriptor& rhs) const - { - bool ivarsEqual = true; - - if( ! (_expendableType == rhs._expendableType) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ExpendableDescriptor::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _expendableType.getMarshalledSize(); // _expendableType - marshalSize = marshalSize + 8; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ExpendableDescriptor.h b/src/dis7/ExpendableDescriptor.h deleted file mode 100644 index 33673309..00000000 --- a/src/dis7/ExpendableDescriptor.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Burst of chaff or expendible device. Section 6.2.20.4 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ExpendableDescriptor -{ -protected: - /** Type of the object that exploded */ - EntityType _expendableType; - - /** Padding */ - long long _padding; - - - public: - ExpendableDescriptor(); - virtual ~ExpendableDescriptor(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getExpendableType(); - const EntityType& getExpendableType() const; - void setExpendableType(const EntityType &pX); - - long long getPadding() const; - void setPadding(long long pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ExpendableDescriptor& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ExpendableReload.cpp b/src/dis7/ExpendableReload.cpp deleted file mode 100644 index ec4f2c8b..00000000 --- a/src/dis7/ExpendableReload.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include - -using namespace DIS; - - -ExpendableReload::ExpendableReload(): - _expendable(), - _station(0), - _standardQuantity(0), - _maximumQuantity(0), - _standardQuantityReloadTime(0), - _maximumQuantityReloadTime(0) -{ -} - -ExpendableReload::~ExpendableReload() -{ -} - -EntityType& ExpendableReload::getExpendable() -{ - return _expendable; -} - -const EntityType& ExpendableReload::getExpendable() const -{ - return _expendable; -} - -void ExpendableReload::setExpendable(const EntityType &pX) -{ - _expendable = pX; -} - -unsigned int ExpendableReload::getStation() const -{ - return _station; -} - -void ExpendableReload::setStation(unsigned int pX) -{ - _station = pX; -} - -unsigned short ExpendableReload::getStandardQuantity() const -{ - return _standardQuantity; -} - -void ExpendableReload::setStandardQuantity(unsigned short pX) -{ - _standardQuantity = pX; -} - -unsigned short ExpendableReload::getMaximumQuantity() const -{ - return _maximumQuantity; -} - -void ExpendableReload::setMaximumQuantity(unsigned short pX) -{ - _maximumQuantity = pX; -} - -unsigned int ExpendableReload::getStandardQuantityReloadTime() const -{ - return _standardQuantityReloadTime; -} - -void ExpendableReload::setStandardQuantityReloadTime(unsigned int pX) -{ - _standardQuantityReloadTime = pX; -} - -unsigned int ExpendableReload::getMaximumQuantityReloadTime() const -{ - return _maximumQuantityReloadTime; -} - -void ExpendableReload::setMaximumQuantityReloadTime(unsigned int pX) -{ - _maximumQuantityReloadTime = pX; -} - -void ExpendableReload::marshal(DataStream& dataStream) const -{ - _expendable.marshal(dataStream); - dataStream << _station; - dataStream << _standardQuantity; - dataStream << _maximumQuantity; - dataStream << _standardQuantityReloadTime; - dataStream << _maximumQuantityReloadTime; -} - -void ExpendableReload::unmarshal(DataStream& dataStream) -{ - _expendable.unmarshal(dataStream); - dataStream >> _station; - dataStream >> _standardQuantity; - dataStream >> _maximumQuantity; - dataStream >> _standardQuantityReloadTime; - dataStream >> _maximumQuantityReloadTime; -} - - -bool ExpendableReload::operator ==(const ExpendableReload& rhs) const - { - bool ivarsEqual = true; - - if( ! (_expendable == rhs._expendable) ) ivarsEqual = false; - if( ! (_station == rhs._station) ) ivarsEqual = false; - if( ! (_standardQuantity == rhs._standardQuantity) ) ivarsEqual = false; - if( ! (_maximumQuantity == rhs._maximumQuantity) ) ivarsEqual = false; - if( ! (_standardQuantityReloadTime == rhs._standardQuantityReloadTime) ) ivarsEqual = false; - if( ! (_maximumQuantityReloadTime == rhs._maximumQuantityReloadTime) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ExpendableReload::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _expendable.getMarshalledSize(); // _expendable - marshalSize = marshalSize + 4; // _station - marshalSize = marshalSize + 2; // _standardQuantity - marshalSize = marshalSize + 2; // _maximumQuantity - marshalSize = marshalSize + 4; // _standardQuantityReloadTime - marshalSize = marshalSize + 4; // _maximumQuantityReloadTime - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ExpendableReload.h b/src/dis7/ExpendableReload.h deleted file mode 100644 index 42bf0cc8..00000000 --- a/src/dis7/ExpendableReload.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// An entity's expendable (chaff, flares, etc) information. Section 6.2.37 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ExpendableReload -{ -protected: - /** Type of expendable */ - EntityType _expendable; - - unsigned int _station; - - unsigned short _standardQuantity; - - unsigned short _maximumQuantity; - - unsigned int _standardQuantityReloadTime; - - unsigned int _maximumQuantityReloadTime; - - - public: - ExpendableReload(); - virtual ~ExpendableReload(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getExpendable(); - const EntityType& getExpendable() const; - void setExpendable(const EntityType &pX); - - unsigned int getStation() const; - void setStation(unsigned int pX); - - unsigned short getStandardQuantity() const; - void setStandardQuantity(unsigned short pX); - - unsigned short getMaximumQuantity() const; - void setMaximumQuantity(unsigned short pX); - - unsigned int getStandardQuantityReloadTime() const; - void setStandardQuantityReloadTime(unsigned int pX); - - unsigned int getMaximumQuantityReloadTime() const; - void setMaximumQuantityReloadTime(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ExpendableReload& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ExplosionDescriptor.cpp b/src/dis7/ExplosionDescriptor.cpp deleted file mode 100644 index f06d9320..00000000 --- a/src/dis7/ExplosionDescriptor.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include - -using namespace DIS; - - -ExplosionDescriptor::ExplosionDescriptor(): - _explodingObject(), - _explosiveMaterial(0), - _padding(0), - _explosiveForce(0.0) -{ -} - -ExplosionDescriptor::~ExplosionDescriptor() -{ -} - -EntityType& ExplosionDescriptor::getExplodingObject() -{ - return _explodingObject; -} - -const EntityType& ExplosionDescriptor::getExplodingObject() const -{ - return _explodingObject; -} - -void ExplosionDescriptor::setExplodingObject(const EntityType &pX) -{ - _explodingObject = pX; -} - -unsigned short ExplosionDescriptor::getExplosiveMaterial() const -{ - return _explosiveMaterial; -} - -void ExplosionDescriptor::setExplosiveMaterial(unsigned short pX) -{ - _explosiveMaterial = pX; -} - -unsigned short ExplosionDescriptor::getPadding() const -{ - return _padding; -} - -void ExplosionDescriptor::setPadding(unsigned short pX) -{ - _padding = pX; -} - -float ExplosionDescriptor::getExplosiveForce() const -{ - return _explosiveForce; -} - -void ExplosionDescriptor::setExplosiveForce(float pX) -{ - _explosiveForce = pX; -} - -void ExplosionDescriptor::marshal(DataStream& dataStream) const -{ - _explodingObject.marshal(dataStream); - dataStream << _explosiveMaterial; - dataStream << _padding; - dataStream << _explosiveForce; -} - -void ExplosionDescriptor::unmarshal(DataStream& dataStream) -{ - _explodingObject.unmarshal(dataStream); - dataStream >> _explosiveMaterial; - dataStream >> _padding; - dataStream >> _explosiveForce; -} - - -bool ExplosionDescriptor::operator ==(const ExplosionDescriptor& rhs) const - { - bool ivarsEqual = true; - - if( ! (_explodingObject == rhs._explodingObject) ) ivarsEqual = false; - if( ! (_explosiveMaterial == rhs._explosiveMaterial) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_explosiveForce == rhs._explosiveForce) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ExplosionDescriptor::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _explodingObject.getMarshalledSize(); // _explodingObject - marshalSize = marshalSize + 2; // _explosiveMaterial - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + 4; // _explosiveForce - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ExplosionDescriptor.h b/src/dis7/ExplosionDescriptor.h deleted file mode 100644 index 11e18e90..00000000 --- a/src/dis7/ExplosionDescriptor.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Explosion of a non-munition. Section 6.2.20.3 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ExplosionDescriptor -{ -protected: - /** Type of the object that exploded. See 6.2.30 */ - EntityType _explodingObject; - - /** Material that exploded. Can be grain dust, tnt, gasoline, etc. */ - unsigned short _explosiveMaterial; - - /** padding */ - unsigned short _padding; - - /** Force of explosion, in equivalent KG of TNT */ - float _explosiveForce; - - - public: - ExplosionDescriptor(); - virtual ~ExplosionDescriptor(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getExplodingObject(); - const EntityType& getExplodingObject() const; - void setExplodingObject(const EntityType &pX); - - unsigned short getExplosiveMaterial() const; - void setExplosiveMaterial(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - float getExplosiveForce() const; - void setExplosiveForce(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ExplosionDescriptor& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FalseTargetsAttribute.cpp b/src/dis7/FalseTargetsAttribute.cpp deleted file mode 100644 index 84548ae8..00000000 --- a/src/dis7/FalseTargetsAttribute.cpp +++ /dev/null @@ -1,277 +0,0 @@ -#include - -using namespace DIS; - - -FalseTargetsAttribute::FalseTargetsAttribute(): - _recordType(3502), - _recordLength(40), - _padding(0), - _emitterNumber(0), - _beamNumber(0), - _stateIndicator(0), - _padding2(0), - _falseTargetCount(0.0), - _walkSpeed(0.0), - _walkAcceleration(0.0), - _maximumWalkDistance(0.0), - _keepTime(0.0), - _echoSpacing(0.0), - _padding3(0) -{ -} - -FalseTargetsAttribute::~FalseTargetsAttribute() -{ -} - -unsigned int FalseTargetsAttribute::getRecordType() const -{ - return _recordType; -} - -void FalseTargetsAttribute::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short FalseTargetsAttribute::getRecordLength() const -{ - return _recordLength; -} - -void FalseTargetsAttribute::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned short FalseTargetsAttribute::getPadding() const -{ - return _padding; -} - -void FalseTargetsAttribute::setPadding(unsigned short pX) -{ - _padding = pX; -} - -unsigned char FalseTargetsAttribute::getEmitterNumber() const -{ - return _emitterNumber; -} - -void FalseTargetsAttribute::setEmitterNumber(unsigned char pX) -{ - _emitterNumber = pX; -} - -unsigned char FalseTargetsAttribute::getBeamNumber() const -{ - return _beamNumber; -} - -void FalseTargetsAttribute::setBeamNumber(unsigned char pX) -{ - _beamNumber = pX; -} - -unsigned char FalseTargetsAttribute::getStateIndicator() const -{ - return _stateIndicator; -} - -void FalseTargetsAttribute::setStateIndicator(unsigned char pX) -{ - _stateIndicator = pX; -} - -unsigned char FalseTargetsAttribute::getPadding2() const -{ - return _padding2; -} - -void FalseTargetsAttribute::setPadding2(unsigned char pX) -{ - _padding2 = pX; -} - -float FalseTargetsAttribute::getFalseTargetCount() const -{ - return _falseTargetCount; -} - -void FalseTargetsAttribute::setFalseTargetCount(float pX) -{ - _falseTargetCount = pX; -} - -float FalseTargetsAttribute::getWalkSpeed() const -{ - return _walkSpeed; -} - -void FalseTargetsAttribute::setWalkSpeed(float pX) -{ - _walkSpeed = pX; -} - -float FalseTargetsAttribute::getWalkAcceleration() const -{ - return _walkAcceleration; -} - -void FalseTargetsAttribute::setWalkAcceleration(float pX) -{ - _walkAcceleration = pX; -} - -float FalseTargetsAttribute::getMaximumWalkDistance() const -{ - return _maximumWalkDistance; -} - -void FalseTargetsAttribute::setMaximumWalkDistance(float pX) -{ - _maximumWalkDistance = pX; -} - -float FalseTargetsAttribute::getKeepTime() const -{ - return _keepTime; -} - -void FalseTargetsAttribute::setKeepTime(float pX) -{ - _keepTime = pX; -} - -float FalseTargetsAttribute::getEchoSpacing() const -{ - return _echoSpacing; -} - -void FalseTargetsAttribute::setEchoSpacing(float pX) -{ - _echoSpacing = pX; -} - -unsigned int FalseTargetsAttribute::getPadding3() const -{ - return _padding3; -} - -void FalseTargetsAttribute::setPadding3(unsigned int pX) -{ - _padding3 = pX; -} - -void FalseTargetsAttribute::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _padding; - dataStream << _emitterNumber; - dataStream << _beamNumber; - dataStream << _stateIndicator; - dataStream << _padding2; - dataStream << _falseTargetCount; - dataStream << _walkSpeed; - dataStream << _walkAcceleration; - dataStream << _maximumWalkDistance; - dataStream << _keepTime; - dataStream << _echoSpacing; - dataStream << _padding3; -} - -void FalseTargetsAttribute::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _padding; - dataStream >> _emitterNumber; - dataStream >> _beamNumber; - dataStream >> _stateIndicator; - dataStream >> _padding2; - dataStream >> _falseTargetCount; - dataStream >> _walkSpeed; - dataStream >> _walkAcceleration; - dataStream >> _maximumWalkDistance; - dataStream >> _keepTime; - dataStream >> _echoSpacing; - dataStream >> _padding3; -} - - -bool FalseTargetsAttribute::operator ==(const FalseTargetsAttribute& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_emitterNumber == rhs._emitterNumber) ) ivarsEqual = false; - if( ! (_beamNumber == rhs._beamNumber) ) ivarsEqual = false; - if( ! (_stateIndicator == rhs._stateIndicator) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_falseTargetCount == rhs._falseTargetCount) ) ivarsEqual = false; - if( ! (_walkSpeed == rhs._walkSpeed) ) ivarsEqual = false; - if( ! (_walkAcceleration == rhs._walkAcceleration) ) ivarsEqual = false; - if( ! (_maximumWalkDistance == rhs._maximumWalkDistance) ) ivarsEqual = false; - if( ! (_keepTime == rhs._keepTime) ) ivarsEqual = false; - if( ! (_echoSpacing == rhs._echoSpacing) ) ivarsEqual = false; - if( ! (_padding3 == rhs._padding3) ) ivarsEqual = false; - - return ivarsEqual; - } - -int FalseTargetsAttribute::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + 1; // _emitterNumber - marshalSize = marshalSize + 1; // _beamNumber - marshalSize = marshalSize + 1; // _stateIndicator - marshalSize = marshalSize + 1; // _padding2 - marshalSize = marshalSize + 4; // _falseTargetCount - marshalSize = marshalSize + 4; // _walkSpeed - marshalSize = marshalSize + 4; // _walkAcceleration - marshalSize = marshalSize + 4; // _maximumWalkDistance - marshalSize = marshalSize + 4; // _keepTime - marshalSize = marshalSize + 4; // _echoSpacing - marshalSize = marshalSize + 4; // _padding3 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FalseTargetsAttribute.h b/src/dis7/FalseTargetsAttribute.h deleted file mode 100644 index 349cbc47..00000000 --- a/src/dis7/FalseTargetsAttribute.h +++ /dev/null @@ -1,132 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The False Targets attribute record shall be used to communicate discrete values that are associated with false targets jamming that cannot be referenced to an emitter mode. The values provided in the False Targets attri- bute record shall be considered valid only for the victim radar beams listed in the jamming beam's Track/Jam Data records (provided in the associated Electromagnetic Emission PDU). Section 6.2.12.3 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT FalseTargetsAttribute -{ -protected: - unsigned int _recordType; - - unsigned short _recordLength; - - unsigned short _padding; - - unsigned char _emitterNumber; - - unsigned char _beamNumber; - - unsigned char _stateIndicator; - - unsigned char _padding2; - - float _falseTargetCount; - - float _walkSpeed; - - float _walkAcceleration; - - float _maximumWalkDistance; - - float _keepTime; - - float _echoSpacing; - - unsigned int _padding3; - - - public: - FalseTargetsAttribute(); - virtual ~FalseTargetsAttribute(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - unsigned char getEmitterNumber() const; - void setEmitterNumber(unsigned char pX); - - unsigned char getBeamNumber() const; - void setBeamNumber(unsigned char pX); - - unsigned char getStateIndicator() const; - void setStateIndicator(unsigned char pX); - - unsigned char getPadding2() const; - void setPadding2(unsigned char pX); - - float getFalseTargetCount() const; - void setFalseTargetCount(float pX); - - float getWalkSpeed() const; - void setWalkSpeed(float pX); - - float getWalkAcceleration() const; - void setWalkAcceleration(float pX); - - float getMaximumWalkDistance() const; - void setMaximumWalkDistance(float pX); - - float getKeepTime() const; - void setKeepTime(float pX); - - float getEchoSpacing() const; - void setEchoSpacing(float pX); - - unsigned int getPadding3() const; - void setPadding3(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FalseTargetsAttribute& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FastEntityStatePdu.cpp b/src/dis7/FastEntityStatePdu.cpp deleted file mode 100644 index 27b4b6f5..00000000 --- a/src/dis7/FastEntityStatePdu.cpp +++ /dev/null @@ -1,761 +0,0 @@ -#include - -#include - -using namespace DIS; - - -FastEntityStatePdu::FastEntityStatePdu() : EntityInformationFamilyPdu(), - _site(0), - _application(0), - _entity(0), - _forceId(0), - _numberOfVariableParameters(0), - _entityKind(0), - _domain(0), - _country(0), - _category(0), - _subcategory(0), - _specific(0), - _extra(0), - _altEntityKind(0), - _altDomain(0), - _altCountry(0), - _altCategory(0), - _altSubcategory(0), - _altSpecific(0), - _altExtra(0), - _xVelocity(0.0), - _yVelocity(0.0), - _zVelocity(0.0), - _xLocation(0.0), - _yLocation(0.0), - _zLocation(0.0), - _psi(0.0), - _theta(0.0), - _phi(0.0), - _entityAppearance(0), - _deadReckoningAlgorithm(0), - _xAcceleration(0.0), - _yAcceleration(0.0), - _zAcceleration(0.0), - _xAngularVelocity(0.0), - _yAngularVelocity(0.0), - _zAngularVelocity(0.0), - _capabilities(0) -{ - setPduType( 1 ); - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 15; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - - // Initialize fixed length array - for(int lengthmarking= 0; lengthmarking < 12; lengthmarking++) - { - _marking[lengthmarking] = 0; - } - -} - -FastEntityStatePdu::~FastEntityStatePdu() -{ - _variableParameters.clear(); -} - -unsigned short FastEntityStatePdu::getSite() const -{ - return _site; -} - -void FastEntityStatePdu::setSite(unsigned short pX) -{ - _site = pX; -} - -unsigned short FastEntityStatePdu::getApplication() const -{ - return _application; -} - -void FastEntityStatePdu::setApplication(unsigned short pX) -{ - _application = pX; -} - -unsigned short FastEntityStatePdu::getEntity() const -{ - return _entity; -} - -void FastEntityStatePdu::setEntity(unsigned short pX) -{ - _entity = pX; -} - -unsigned char FastEntityStatePdu::getForceId() const -{ - return _forceId; -} - -void FastEntityStatePdu::setForceId(unsigned char pX) -{ - _forceId = pX; -} - -char FastEntityStatePdu::getNumberOfVariableParameters() const -{ - return _variableParameters.size(); -} - -unsigned char FastEntityStatePdu::getEntityKind() const -{ - return _entityKind; -} - -void FastEntityStatePdu::setEntityKind(unsigned char pX) -{ - _entityKind = pX; -} - -unsigned char FastEntityStatePdu::getDomain() const -{ - return _domain; -} - -void FastEntityStatePdu::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short FastEntityStatePdu::getCountry() const -{ - return _country; -} - -void FastEntityStatePdu::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char FastEntityStatePdu::getCategory() const -{ - return _category; -} - -void FastEntityStatePdu::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char FastEntityStatePdu::getSubcategory() const -{ - return _subcategory; -} - -void FastEntityStatePdu::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char FastEntityStatePdu::getSpecific() const -{ - return _specific; -} - -void FastEntityStatePdu::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -unsigned char FastEntityStatePdu::getExtra() const -{ - return _extra; -} - -void FastEntityStatePdu::setExtra(unsigned char pX) -{ - _extra = pX; -} - -unsigned char FastEntityStatePdu::getAltEntityKind() const -{ - return _altEntityKind; -} - -void FastEntityStatePdu::setAltEntityKind(unsigned char pX) -{ - _altEntityKind = pX; -} - -unsigned char FastEntityStatePdu::getAltDomain() const -{ - return _altDomain; -} - -void FastEntityStatePdu::setAltDomain(unsigned char pX) -{ - _altDomain = pX; -} - -unsigned short FastEntityStatePdu::getAltCountry() const -{ - return _altCountry; -} - -void FastEntityStatePdu::setAltCountry(unsigned short pX) -{ - _altCountry = pX; -} - -unsigned char FastEntityStatePdu::getAltCategory() const -{ - return _altCategory; -} - -void FastEntityStatePdu::setAltCategory(unsigned char pX) -{ - _altCategory = pX; -} - -unsigned char FastEntityStatePdu::getAltSubcategory() const -{ - return _altSubcategory; -} - -void FastEntityStatePdu::setAltSubcategory(unsigned char pX) -{ - _altSubcategory = pX; -} - -unsigned char FastEntityStatePdu::getAltSpecific() const -{ - return _altSpecific; -} - -void FastEntityStatePdu::setAltSpecific(unsigned char pX) -{ - _altSpecific = pX; -} - -unsigned char FastEntityStatePdu::getAltExtra() const -{ - return _altExtra; -} - -void FastEntityStatePdu::setAltExtra(unsigned char pX) -{ - _altExtra = pX; -} - -float FastEntityStatePdu::getXVelocity() const -{ - return _xVelocity; -} - -void FastEntityStatePdu::setXVelocity(float pX) -{ - _xVelocity = pX; -} - -float FastEntityStatePdu::getYVelocity() const -{ - return _yVelocity; -} - -void FastEntityStatePdu::setYVelocity(float pX) -{ - _yVelocity = pX; -} - -float FastEntityStatePdu::getZVelocity() const -{ - return _zVelocity; -} - -void FastEntityStatePdu::setZVelocity(float pX) -{ - _zVelocity = pX; -} - -double FastEntityStatePdu::getXLocation() const -{ - return _xLocation; -} - -void FastEntityStatePdu::setXLocation(double pX) -{ - _xLocation = pX; -} - -double FastEntityStatePdu::getYLocation() const -{ - return _yLocation; -} - -void FastEntityStatePdu::setYLocation(double pX) -{ - _yLocation = pX; -} - -double FastEntityStatePdu::getZLocation() const -{ - return _zLocation; -} - -void FastEntityStatePdu::setZLocation(double pX) -{ - _zLocation = pX; -} - -float FastEntityStatePdu::getPsi() const -{ - return _psi; -} - -void FastEntityStatePdu::setPsi(float pX) -{ - _psi = pX; -} - -float FastEntityStatePdu::getTheta() const -{ - return _theta; -} - -void FastEntityStatePdu::setTheta(float pX) -{ - _theta = pX; -} - -float FastEntityStatePdu::getPhi() const -{ - return _phi; -} - -void FastEntityStatePdu::setPhi(float pX) -{ - _phi = pX; -} - -int FastEntityStatePdu::getEntityAppearance() const -{ - return _entityAppearance; -} - -void FastEntityStatePdu::setEntityAppearance(int pX) -{ - _entityAppearance = pX; -} - -unsigned char FastEntityStatePdu::getDeadReckoningAlgorithm() const -{ - return _deadReckoningAlgorithm; -} - -void FastEntityStatePdu::setDeadReckoningAlgorithm(unsigned char pX) -{ - _deadReckoningAlgorithm = pX; -} - -char* FastEntityStatePdu::getOtherParameters() -{ - return _otherParameters; -} - -const char* FastEntityStatePdu::getOtherParameters() const -{ - return _otherParameters; -} - -void FastEntityStatePdu::setOtherParameters(const char* x) -{ - for(int i = 0; i < 15; i++) - { - _otherParameters[i] = x[i]; - } -} - -float FastEntityStatePdu::getXAcceleration() const -{ - return _xAcceleration; -} - -void FastEntityStatePdu::setXAcceleration(float pX) -{ - _xAcceleration = pX; -} - -float FastEntityStatePdu::getYAcceleration() const -{ - return _yAcceleration; -} - -void FastEntityStatePdu::setYAcceleration(float pX) -{ - _yAcceleration = pX; -} - -float FastEntityStatePdu::getZAcceleration() const -{ - return _zAcceleration; -} - -void FastEntityStatePdu::setZAcceleration(float pX) -{ - _zAcceleration = pX; -} - -float FastEntityStatePdu::getXAngularVelocity() const -{ - return _xAngularVelocity; -} - -void FastEntityStatePdu::setXAngularVelocity(float pX) -{ - _xAngularVelocity = pX; -} - -float FastEntityStatePdu::getYAngularVelocity() const -{ - return _yAngularVelocity; -} - -void FastEntityStatePdu::setYAngularVelocity(float pX) -{ - _yAngularVelocity = pX; -} - -float FastEntityStatePdu::getZAngularVelocity() const -{ - return _zAngularVelocity; -} - -void FastEntityStatePdu::setZAngularVelocity(float pX) -{ - _zAngularVelocity = pX; -} - -char* FastEntityStatePdu::getMarking() -{ - return _marking; -} - -const char* FastEntityStatePdu::getMarking() const -{ - return _marking; -} - -void FastEntityStatePdu::setMarking(const char* x) -{ - for(int i = 0; i < 12; i++) - { - _marking[i] = x[i]; - } -} - -// An alternate method to set the value if this could be a string. This is not strictly comnpliant with the DIS standard. -void FastEntityStatePdu::setByStringMarking(const char* x) -{ - std::strncpy(_marking, x, 12-1); - _marking[12 -1] = '\0'; -} - -int FastEntityStatePdu::getCapabilities() const -{ - return _capabilities; -} - -void FastEntityStatePdu::setCapabilities(int pX) -{ - _capabilities = pX; -} - -std::vector& FastEntityStatePdu::getVariableParameters() -{ - return _variableParameters; -} - -const std::vector& FastEntityStatePdu::getVariableParameters() const -{ - return _variableParameters; -} - -void FastEntityStatePdu::setVariableParameters(const std::vector& pX) -{ - _variableParameters = pX; -} - -void FastEntityStatePdu::marshal(DataStream& dataStream) const -{ - EntityInformationFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _site; - dataStream << _application; - dataStream << _entity; - dataStream << _forceId; - dataStream << ( char )_variableParameters.size(); - dataStream << _entityKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; - dataStream << _extra; - dataStream << _altEntityKind; - dataStream << _altDomain; - dataStream << _altCountry; - dataStream << _altCategory; - dataStream << _altSubcategory; - dataStream << _altSpecific; - dataStream << _altExtra; - dataStream << _xVelocity; - dataStream << _yVelocity; - dataStream << _zVelocity; - dataStream << _xLocation; - dataStream << _yLocation; - dataStream << _zLocation; - dataStream << _psi; - dataStream << _theta; - dataStream << _phi; - dataStream << _entityAppearance; - dataStream << _deadReckoningAlgorithm; - - for(size_t idx = 0; idx < 15; idx++) - { - dataStream << _otherParameters[idx]; - } - - dataStream << _xAcceleration; - dataStream << _yAcceleration; - dataStream << _zAcceleration; - dataStream << _xAngularVelocity; - dataStream << _yAngularVelocity; - dataStream << _zAngularVelocity; - - for(size_t idx = 0; idx < 12; idx++) - { - dataStream << _marking[idx]; - } - - dataStream << _capabilities; - - for(size_t idx = 0; idx < _variableParameters.size(); idx++) - { - VariableParameter x = _variableParameters[idx]; - x.marshal(dataStream); - } - -} - -void FastEntityStatePdu::unmarshal(DataStream& dataStream) -{ - EntityInformationFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _site; - dataStream >> _application; - dataStream >> _entity; - dataStream >> _forceId; - dataStream >> _numberOfVariableParameters; - dataStream >> _entityKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; - dataStream >> _extra; - dataStream >> _altEntityKind; - dataStream >> _altDomain; - dataStream >> _altCountry; - dataStream >> _altCategory; - dataStream >> _altSubcategory; - dataStream >> _altSpecific; - dataStream >> _altExtra; - dataStream >> _xVelocity; - dataStream >> _yVelocity; - dataStream >> _zVelocity; - dataStream >> _xLocation; - dataStream >> _yLocation; - dataStream >> _zLocation; - dataStream >> _psi; - dataStream >> _theta; - dataStream >> _phi; - dataStream >> _entityAppearance; - dataStream >> _deadReckoningAlgorithm; - - for(size_t idx = 0; idx < 15; idx++) - { - dataStream >> _otherParameters[idx]; - } - - dataStream >> _xAcceleration; - dataStream >> _yAcceleration; - dataStream >> _zAcceleration; - dataStream >> _xAngularVelocity; - dataStream >> _yAngularVelocity; - dataStream >> _zAngularVelocity; - - for(size_t idx = 0; idx < 12; idx++) - { - dataStream >> _marking[idx]; - } - - dataStream >> _capabilities; - - _variableParameters.clear(); - for(size_t idx = 0; idx < _numberOfVariableParameters; idx++) - { - VariableParameter x; - x.unmarshal(dataStream); - _variableParameters.push_back(x); - } -} - - -bool FastEntityStatePdu::operator ==(const FastEntityStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); - - if( ! (_site == rhs._site) ) ivarsEqual = false; - if( ! (_application == rhs._application) ) ivarsEqual = false; - if( ! (_entity == rhs._entity) ) ivarsEqual = false; - if( ! (_forceId == rhs._forceId) ) ivarsEqual = false; - if( ! (_entityKind == rhs._entityKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - if( ! (_extra == rhs._extra) ) ivarsEqual = false; - if( ! (_altEntityKind == rhs._altEntityKind) ) ivarsEqual = false; - if( ! (_altDomain == rhs._altDomain) ) ivarsEqual = false; - if( ! (_altCountry == rhs._altCountry) ) ivarsEqual = false; - if( ! (_altCategory == rhs._altCategory) ) ivarsEqual = false; - if( ! (_altSubcategory == rhs._altSubcategory) ) ivarsEqual = false; - if( ! (_altSpecific == rhs._altSpecific) ) ivarsEqual = false; - if( ! (_altExtra == rhs._altExtra) ) ivarsEqual = false; - if( ! (_xVelocity == rhs._xVelocity) ) ivarsEqual = false; - if( ! (_yVelocity == rhs._yVelocity) ) ivarsEqual = false; - if( ! (_zVelocity == rhs._zVelocity) ) ivarsEqual = false; - if( ! (_xLocation == rhs._xLocation) ) ivarsEqual = false; - if( ! (_yLocation == rhs._yLocation) ) ivarsEqual = false; - if( ! (_zLocation == rhs._zLocation) ) ivarsEqual = false; - if( ! (_psi == rhs._psi) ) ivarsEqual = false; - if( ! (_theta == rhs._theta) ) ivarsEqual = false; - if( ! (_phi == rhs._phi) ) ivarsEqual = false; - if( ! (_entityAppearance == rhs._entityAppearance) ) ivarsEqual = false; - if( ! (_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 15; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - if( ! (_xAcceleration == rhs._xAcceleration) ) ivarsEqual = false; - if( ! (_yAcceleration == rhs._yAcceleration) ) ivarsEqual = false; - if( ! (_zAcceleration == rhs._zAcceleration) ) ivarsEqual = false; - if( ! (_xAngularVelocity == rhs._xAngularVelocity) ) ivarsEqual = false; - if( ! (_yAngularVelocity == rhs._yAngularVelocity) ) ivarsEqual = false; - if( ! (_zAngularVelocity == rhs._zAngularVelocity) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 12; idx++) - { - if(!(_marking[idx] == rhs._marking[idx]) ) ivarsEqual = false; - } - - if( ! (_capabilities == rhs._capabilities) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _variableParameters.size(); idx++) - { - if( ! ( _variableParameters[idx] == rhs._variableParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int FastEntityStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _site - marshalSize = marshalSize + 2; // _application - marshalSize = marshalSize + 2; // _entity - marshalSize = marshalSize + 1; // _forceId - marshalSize = marshalSize + 1; // _numberOfVariableParameters - marshalSize = marshalSize + 1; // _entityKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - marshalSize = marshalSize + 1; // _extra - marshalSize = marshalSize + 1; // _altEntityKind - marshalSize = marshalSize + 1; // _altDomain - marshalSize = marshalSize + 2; // _altCountry - marshalSize = marshalSize + 1; // _altCategory - marshalSize = marshalSize + 1; // _altSubcategory - marshalSize = marshalSize + 1; // _altSpecific - marshalSize = marshalSize + 1; // _altExtra - marshalSize = marshalSize + 4; // _xVelocity - marshalSize = marshalSize + 4; // _yVelocity - marshalSize = marshalSize + 4; // _zVelocity - marshalSize = marshalSize + 8; // _xLocation - marshalSize = marshalSize + 8; // _yLocation - marshalSize = marshalSize + 8; // _zLocation - marshalSize = marshalSize + 4; // _psi - marshalSize = marshalSize + 4; // _theta - marshalSize = marshalSize + 4; // _phi - marshalSize = marshalSize + 4; // _entityAppearance - marshalSize = marshalSize + 1; // _deadReckoningAlgorithm - marshalSize = marshalSize + 15 * 1; // _otherParameters - marshalSize = marshalSize + 4; // _xAcceleration - marshalSize = marshalSize + 4; // _yAcceleration - marshalSize = marshalSize + 4; // _zAcceleration - marshalSize = marshalSize + 4; // _xAngularVelocity - marshalSize = marshalSize + 4; // _yAngularVelocity - marshalSize = marshalSize + 4; // _zAngularVelocity - marshalSize = marshalSize + 12 * 1; // _marking - marshalSize = marshalSize + 4; // _capabilities - - for(unsigned long long idx=0; idx < _variableParameters.size(); idx++) - { - VariableParameter listElement = _variableParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FastEntityStatePdu.h b/src/dis7/FastEntityStatePdu.h deleted file mode 100644 index 9905b13d..00000000 --- a/src/dis7/FastEntityStatePdu.h +++ /dev/null @@ -1,303 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Represents the postion and state of one entity in the world. This is identical in function to entity state pdu, but generates less garbage to collect in the Java world. Section 7.2.2. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT FastEntityStatePdu : public EntityInformationFamilyPdu -{ -protected: - /** The site ID */ - unsigned short _site; - - /** The application ID */ - unsigned short _application; - - /** the entity ID */ - unsigned short _entity; - - /** what force this entity is affiliated with, eg red, blue, neutral, etc */ - unsigned char _forceId; - - /** How many variable (nee articulation) parameters are in the variable length list */ - unsigned char _numberOfVariableParameters; - - /** Kind of entity */ - unsigned char _entityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - /** specific info based on subcategory field */ - unsigned char _specific; - - unsigned char _extra; - - /** Kind of entity */ - unsigned char _altEntityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _altDomain; - - /** country to which the design of the entity is attributed */ - unsigned short _altCountry; - - /** category of entity */ - unsigned char _altCategory; - - /** subcategory of entity */ - unsigned char _altSubcategory; - - /** specific info based on subcategory field */ - unsigned char _altSpecific; - - unsigned char _altExtra; - - /** X velo */ - float _xVelocity; - - /** y Value */ - float _yVelocity; - - /** Z value */ - float _zVelocity; - - /** X value */ - double _xLocation; - - /** y Value */ - double _yLocation; - - /** Z value */ - double _zLocation; - - float _psi; - - float _theta; - - float _phi; - - /** a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. */ - int _entityAppearance; - - /** enumeration of what dead reckoning algorighm to use */ - unsigned char _deadReckoningAlgorithm; - - /** other parameters to use in the dead reckoning algorithm */ - char _otherParameters[15]; - - /** X value */ - float _xAcceleration; - - /** y Value */ - float _yAcceleration; - - /** Z value */ - float _zAcceleration; - - /** X value */ - float _xAngularVelocity; - - /** y Value */ - float _yAngularVelocity; - - /** Z value */ - float _zAngularVelocity; - - /** characters that can be used for debugging, or to draw unique strings on the side of entities in the world */ - char _marking[12]; - - /** a series of bit flags */ - int _capabilities; - - /** variable length list of variable parameters. In earlier versions of DIS these were known as articulation parameters */ - std::vector _variableParameters; - - - public: - FastEntityStatePdu(); - virtual ~FastEntityStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSite() const; - void setSite(unsigned short pX); - - unsigned short getApplication() const; - void setApplication(unsigned short pX); - - unsigned short getEntity() const; - void setEntity(unsigned short pX); - - unsigned char getForceId() const; - void setForceId(unsigned char pX); - - char getNumberOfVariableParameters() const; - - unsigned char getEntityKind() const; - void setEntityKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - unsigned char getExtra() const; - void setExtra(unsigned char pX); - - unsigned char getAltEntityKind() const; - void setAltEntityKind(unsigned char pX); - - unsigned char getAltDomain() const; - void setAltDomain(unsigned char pX); - - unsigned short getAltCountry() const; - void setAltCountry(unsigned short pX); - - unsigned char getAltCategory() const; - void setAltCategory(unsigned char pX); - - unsigned char getAltSubcategory() const; - void setAltSubcategory(unsigned char pX); - - unsigned char getAltSpecific() const; - void setAltSpecific(unsigned char pX); - - unsigned char getAltExtra() const; - void setAltExtra(unsigned char pX); - - float getXVelocity() const; - void setXVelocity(float pX); - - float getYVelocity() const; - void setYVelocity(float pX); - - float getZVelocity() const; - void setZVelocity(float pX); - - double getXLocation() const; - void setXLocation(double pX); - - double getYLocation() const; - void setYLocation(double pX); - - double getZLocation() const; - void setZLocation(double pX); - - float getPsi() const; - void setPsi(float pX); - - float getTheta() const; - void setTheta(float pX); - - float getPhi() const; - void setPhi(float pX); - - int getEntityAppearance() const; - void setEntityAppearance(int pX); - - unsigned char getDeadReckoningAlgorithm() const; - void setDeadReckoningAlgorithm(unsigned char pX); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - float getXAcceleration() const; - void setXAcceleration(float pX); - - float getYAcceleration() const; - void setYAcceleration(float pX); - - float getZAcceleration() const; - void setZAcceleration(float pX); - - float getXAngularVelocity() const; - void setXAngularVelocity(float pX); - - float getYAngularVelocity() const; - void setYAngularVelocity(float pX); - - float getZAngularVelocity() const; - void setZAngularVelocity(float pX); - - char* getMarking(); - const char* getMarking() const; - void setMarking( const char* pX); - void setByStringMarking(const char* pX); - - int getCapabilities() const; - void setCapabilities(int pX); - - std::vector& getVariableParameters(); - const std::vector& getVariableParameters() const; - void setVariableParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FastEntityStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FirePdu.cpp b/src/dis7/FirePdu.cpp deleted file mode 100644 index 3a64b043..00000000 --- a/src/dis7/FirePdu.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#include - -using namespace DIS; - - -FirePdu::FirePdu() : WarfareFamilyPdu(), - _munitionExpendibleID(), - _eventID(), - _fireMissionIndex(0), - _locationInWorldCoordinates(), - _descriptor(), - _velocity(), - _range(0.0) -{ - setPduType( 2 ); -} - -FirePdu::~FirePdu() -{ -} - -EntityID& FirePdu::getMunitionExpendibleID() -{ - return _munitionExpendibleID; -} - -const EntityID& FirePdu::getMunitionExpendibleID() const -{ - return _munitionExpendibleID; -} - -void FirePdu::setMunitionExpendibleID(const EntityID &pX) -{ - _munitionExpendibleID = pX; -} - -EventIdentifier& FirePdu::getEventID() -{ - return _eventID; -} - -const EventIdentifier& FirePdu::getEventID() const -{ - return _eventID; -} - -void FirePdu::setEventID(const EventIdentifier &pX) -{ - _eventID = pX; -} - -unsigned int FirePdu::getFireMissionIndex() const -{ - return _fireMissionIndex; -} - -void FirePdu::setFireMissionIndex(unsigned int pX) -{ - _fireMissionIndex = pX; -} - -Vector3Double& FirePdu::getLocationInWorldCoordinates() -{ - return _locationInWorldCoordinates; -} - -const Vector3Double& FirePdu::getLocationInWorldCoordinates() const -{ - return _locationInWorldCoordinates; -} - -void FirePdu::setLocationInWorldCoordinates(const Vector3Double &pX) -{ - _locationInWorldCoordinates = pX; -} - -MunitionDescriptor& FirePdu::getDescriptor() -{ - return _descriptor; -} - -const MunitionDescriptor& FirePdu::getDescriptor() const -{ - return _descriptor; -} - -void FirePdu::setDescriptor(const MunitionDescriptor &pX) -{ - _descriptor = pX; -} - -Vector3Float& FirePdu::getVelocity() -{ - return _velocity; -} - -const Vector3Float& FirePdu::getVelocity() const -{ - return _velocity; -} - -void FirePdu::setVelocity(const Vector3Float &pX) -{ - _velocity = pX; -} - -float FirePdu::getRange() const -{ - return _range; -} - -void FirePdu::setRange(float pX) -{ - _range = pX; -} - -void FirePdu::marshal(DataStream& dataStream) const -{ - WarfareFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _munitionExpendibleID.marshal(dataStream); - _eventID.marshal(dataStream); - dataStream << _fireMissionIndex; - _locationInWorldCoordinates.marshal(dataStream); - _descriptor.marshal(dataStream); - _velocity.marshal(dataStream); - dataStream << _range; -} - -void FirePdu::unmarshal(DataStream& dataStream) -{ - WarfareFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _munitionExpendibleID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - dataStream >> _fireMissionIndex; - _locationInWorldCoordinates.unmarshal(dataStream); - _descriptor.unmarshal(dataStream); - _velocity.unmarshal(dataStream); - dataStream >> _range; -} - - -bool FirePdu::operator ==(const FirePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = WarfareFamilyPdu::operator==(rhs); - - if( ! (_munitionExpendibleID == rhs._munitionExpendibleID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_fireMissionIndex == rhs._fireMissionIndex) ) ivarsEqual = false; - if( ! (_locationInWorldCoordinates == rhs._locationInWorldCoordinates) ) ivarsEqual = false; - if( ! (_descriptor == rhs._descriptor) ) ivarsEqual = false; - if( ! (_velocity == rhs._velocity) ) ivarsEqual = false; - if( ! (_range == rhs._range) ) ivarsEqual = false; - - return ivarsEqual; - } - -int FirePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = WarfareFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _munitionExpendibleID.getMarshalledSize(); // _munitionExpendibleID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + 4; // _fireMissionIndex - marshalSize = marshalSize + _locationInWorldCoordinates.getMarshalledSize(); // _locationInWorldCoordinates - marshalSize = marshalSize + _descriptor.getMarshalledSize(); // _descriptor - marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity - marshalSize = marshalSize + 4; // _range - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FirePdu.h b/src/dis7/FirePdu.h deleted file mode 100644 index dc941975..00000000 --- a/src/dis7/FirePdu.h +++ /dev/null @@ -1,115 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// The firing of a weapon or expendable shall be communicated by issuing a Fire PDU. Sectioin 7.3.2. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT FirePdu : public WarfareFamilyPdu -{ -protected: - /** This field shall specify the entity identification of the fired munition or expendable. This field shall be represented by an Entity Identifier record (see 6.2.28). */ - EntityID _munitionExpendibleID; - - /** This field shall contain an identification generated by the firing entity to associate related firing and detonation events. This field shall be represented by an Event Identifier record (see 6.2.34). */ - EventIdentifier _eventID; - - /** This field shall identify the fire mission (see 5.4.3.3). This field shall be representedby a 32-bit unsigned integer. */ - unsigned int _fireMissionIndex; - - /** This field shall specify the location, in world coordinates, from which the munition was launched, and shall be represented by a World Coordinates record (see 6.2.97). */ - Vector3Double _locationInWorldCoordinates; - - /** This field shall describe the firing or launch of a munition or expendable represented by one of the following types of Descriptor records: Munition Descriptor (6.2.20.2) or Expendable Descriptor (6.2.20.4). */ - MunitionDescriptor _descriptor; - - /** This field shall specify the velocity of the fired munition at the point when the issuing simulation application intends the externally visible effects of the launch (e.g. exhaust plume or muzzle blast) to first become apparent. The velocity shall be represented in world coordinates. This field shall be represented by a Linear Velocity Vector record [see 6.2.95 item c)]. */ - Vector3Float _velocity; - - /** This field shall specify the range that an entity’s fire control system has assumed in computing the fire control solution. This field shall be represented by a 32-bit floating point number in meters. For systems where range is unknown or unavailable, this field shall contain a value of zero. */ - float _range; - - - public: - FirePdu(); - virtual ~FirePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getMunitionExpendibleID(); - const EntityID& getMunitionExpendibleID() const; - void setMunitionExpendibleID(const EntityID &pX); - - EventIdentifier& getEventID(); - const EventIdentifier& getEventID() const; - void setEventID(const EventIdentifier &pX); - - unsigned int getFireMissionIndex() const; - void setFireMissionIndex(unsigned int pX); - - Vector3Double& getLocationInWorldCoordinates(); - const Vector3Double& getLocationInWorldCoordinates() const; - void setLocationInWorldCoordinates(const Vector3Double &pX); - - MunitionDescriptor& getDescriptor(); - const MunitionDescriptor& getDescriptor() const; - void setDescriptor(const MunitionDescriptor &pX); - - Vector3Float& getVelocity(); - const Vector3Float& getVelocity() const; - void setVelocity(const Vector3Float &pX); - - float getRange() const; - void setRange(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FirePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FixedDatum.cpp b/src/dis7/FixedDatum.cpp deleted file mode 100644 index 0839913c..00000000 --- a/src/dis7/FixedDatum.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -FixedDatum::FixedDatum(): - _fixedDatumID(0), - _fixedDatumValue(0) -{ -} - -FixedDatum::~FixedDatum() -{ -} - -unsigned int FixedDatum::getFixedDatumID() const -{ - return _fixedDatumID; -} - -void FixedDatum::setFixedDatumID(unsigned int pX) -{ - _fixedDatumID = pX; -} - -unsigned int FixedDatum::getFixedDatumValue() const -{ - return _fixedDatumValue; -} - -void FixedDatum::setFixedDatumValue(unsigned int pX) -{ - _fixedDatumValue = pX; -} - -void FixedDatum::marshal(DataStream& dataStream) const -{ - dataStream << _fixedDatumID; - dataStream << _fixedDatumValue; -} - -void FixedDatum::unmarshal(DataStream& dataStream) -{ - dataStream >> _fixedDatumID; - dataStream >> _fixedDatumValue; -} - - -bool FixedDatum::operator ==(const FixedDatum& rhs) const - { - bool ivarsEqual = true; - - if( ! (_fixedDatumID == rhs._fixedDatumID) ) ivarsEqual = false; - if( ! (_fixedDatumValue == rhs._fixedDatumValue) ) ivarsEqual = false; - - return ivarsEqual; - } - -int FixedDatum::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _fixedDatumID - marshalSize = marshalSize + 4; // _fixedDatumValue - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FixedDatum.h b/src/dis7/FixedDatum.h deleted file mode 100644 index 7e67207e..00000000 --- a/src/dis7/FixedDatum.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Fixed Datum Record. Section 6.2.38 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT FixedDatum -{ -protected: - /** ID of the fixed datum, an enumeration */ - unsigned int _fixedDatumID; - - /** Value for the fixed datum */ - unsigned int _fixedDatumValue; - - - public: - FixedDatum(); - virtual ~FixedDatum(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getFixedDatumID() const; - void setFixedDatumID(unsigned int pX); - - unsigned int getFixedDatumValue() const; - void setFixedDatumValue(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FixedDatum& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FourByteChunk.cpp b/src/dis7/FourByteChunk.cpp deleted file mode 100644 index 24861f09..00000000 --- a/src/dis7/FourByteChunk.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -using namespace DIS; - - -FourByteChunk::FourByteChunk() -{ - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 4; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - -} - -FourByteChunk::~FourByteChunk() -{ -} - -char* FourByteChunk::getOtherParameters() -{ - return _otherParameters; -} - -const char* FourByteChunk::getOtherParameters() const -{ - return _otherParameters; -} - -void FourByteChunk::setOtherParameters(const char* x) -{ - for(int i = 0; i < 4; i++) - { - _otherParameters[i] = x[i]; - } -} - -void FourByteChunk::marshal(DataStream& dataStream) const -{ - - for(size_t idx = 0; idx < 4; idx++) - { - dataStream << _otherParameters[idx]; - } - -} - -void FourByteChunk::unmarshal(DataStream& dataStream) -{ - - for(size_t idx = 0; idx < 4; idx++) - { - dataStream >> _otherParameters[idx]; - } - -} - - -bool FourByteChunk::operator ==(const FourByteChunk& rhs) const - { - bool ivarsEqual = true; - - - for(unsigned char idx = 0; idx < 4; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int FourByteChunk::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4 * 1; // _otherParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FourByteChunk.h b/src/dis7/FourByteChunk.h deleted file mode 100644 index 32fd46d9..00000000 --- a/src/dis7/FourByteChunk.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 32 bit piece of data - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT FourByteChunk -{ -protected: - /** four bytes of arbitrary data */ - char _otherParameters[4]; - - - public: - FourByteChunk(); - virtual ~FourByteChunk(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FourByteChunk& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FundamentalOperationalData.cpp b/src/dis7/FundamentalOperationalData.cpp deleted file mode 100644 index f90f4063..00000000 --- a/src/dis7/FundamentalOperationalData.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include - -using namespace DIS; - - -FundamentalOperationalData::FundamentalOperationalData(): - _systemStatus(0), - _dataField1(0), - _informationLayers(0), - _dataField2(0), - _parameter1(0), - _parameter2(0), - _parameter3(0), - _parameter4(0), - _parameter5(0), - _parameter6(0) -{ -} - -FundamentalOperationalData::~FundamentalOperationalData() -{ -} - -unsigned char FundamentalOperationalData::getSystemStatus() const -{ - return _systemStatus; -} - -void FundamentalOperationalData::setSystemStatus(unsigned char pX) -{ - _systemStatus = pX; -} - -unsigned char FundamentalOperationalData::getDataField1() const -{ - return _dataField1; -} - -void FundamentalOperationalData::setDataField1(unsigned char pX) -{ - _dataField1 = pX; -} - -unsigned char FundamentalOperationalData::getInformationLayers() const -{ - return _informationLayers; -} - -void FundamentalOperationalData::setInformationLayers(unsigned char pX) -{ - _informationLayers = pX; -} - -unsigned char FundamentalOperationalData::getDataField2() const -{ - return _dataField2; -} - -void FundamentalOperationalData::setDataField2(unsigned char pX) -{ - _dataField2 = pX; -} - -unsigned short FundamentalOperationalData::getParameter1() const -{ - return _parameter1; -} - -void FundamentalOperationalData::setParameter1(unsigned short pX) -{ - _parameter1 = pX; -} - -unsigned short FundamentalOperationalData::getParameter2() const -{ - return _parameter2; -} - -void FundamentalOperationalData::setParameter2(unsigned short pX) -{ - _parameter2 = pX; -} - -unsigned short FundamentalOperationalData::getParameter3() const -{ - return _parameter3; -} - -void FundamentalOperationalData::setParameter3(unsigned short pX) -{ - _parameter3 = pX; -} - -unsigned short FundamentalOperationalData::getParameter4() const -{ - return _parameter4; -} - -void FundamentalOperationalData::setParameter4(unsigned short pX) -{ - _parameter4 = pX; -} - -unsigned short FundamentalOperationalData::getParameter5() const -{ - return _parameter5; -} - -void FundamentalOperationalData::setParameter5(unsigned short pX) -{ - _parameter5 = pX; -} - -unsigned short FundamentalOperationalData::getParameter6() const -{ - return _parameter6; -} - -void FundamentalOperationalData::setParameter6(unsigned short pX) -{ - _parameter6 = pX; -} - -void FundamentalOperationalData::marshal(DataStream& dataStream) const -{ - dataStream << _systemStatus; - dataStream << _dataField1; - dataStream << _informationLayers; - dataStream << _dataField2; - dataStream << _parameter1; - dataStream << _parameter2; - dataStream << _parameter3; - dataStream << _parameter4; - dataStream << _parameter5; - dataStream << _parameter6; -} - -void FundamentalOperationalData::unmarshal(DataStream& dataStream) -{ - dataStream >> _systemStatus; - dataStream >> _dataField1; - dataStream >> _informationLayers; - dataStream >> _dataField2; - dataStream >> _parameter1; - dataStream >> _parameter2; - dataStream >> _parameter3; - dataStream >> _parameter4; - dataStream >> _parameter5; - dataStream >> _parameter6; -} - - -bool FundamentalOperationalData::operator ==(const FundamentalOperationalData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_systemStatus == rhs._systemStatus) ) ivarsEqual = false; - if( ! (_dataField1 == rhs._dataField1) ) ivarsEqual = false; - if( ! (_informationLayers == rhs._informationLayers) ) ivarsEqual = false; - if( ! (_dataField2 == rhs._dataField2) ) ivarsEqual = false; - if( ! (_parameter1 == rhs._parameter1) ) ivarsEqual = false; - if( ! (_parameter2 == rhs._parameter2) ) ivarsEqual = false; - if( ! (_parameter3 == rhs._parameter3) ) ivarsEqual = false; - if( ! (_parameter4 == rhs._parameter4) ) ivarsEqual = false; - if( ! (_parameter5 == rhs._parameter5) ) ivarsEqual = false; - if( ! (_parameter6 == rhs._parameter6) ) ivarsEqual = false; - - return ivarsEqual; - } - -int FundamentalOperationalData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _systemStatus - marshalSize = marshalSize + 1; // _dataField1 - marshalSize = marshalSize + 1; // _informationLayers - marshalSize = marshalSize + 1; // _dataField2 - marshalSize = marshalSize + 2; // _parameter1 - marshalSize = marshalSize + 2; // _parameter2 - marshalSize = marshalSize + 2; // _parameter3 - marshalSize = marshalSize + 2; // _parameter4 - marshalSize = marshalSize + 2; // _parameter5 - marshalSize = marshalSize + 2; // _parameter6 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/FundamentalOperationalData.h b/src/dis7/FundamentalOperationalData.h deleted file mode 100644 index 54036e66..00000000 --- a/src/dis7/FundamentalOperationalData.h +++ /dev/null @@ -1,122 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Basic operational data for IFF. Section 6.2.40. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT FundamentalOperationalData -{ -protected: - /** system status */ - unsigned char _systemStatus; - - /** data field 1 */ - unsigned char _dataField1; - - /** eight boolean fields */ - unsigned char _informationLayers; - - /** enumeration */ - unsigned char _dataField2; - - /** parameter, enumeration */ - unsigned short _parameter1; - - /** parameter, enumeration */ - unsigned short _parameter2; - - /** parameter, enumeration */ - unsigned short _parameter3; - - /** parameter, enumeration */ - unsigned short _parameter4; - - /** parameter, enumeration */ - unsigned short _parameter5; - - /** parameter, enumeration */ - unsigned short _parameter6; - - - public: - FundamentalOperationalData(); - virtual ~FundamentalOperationalData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getSystemStatus() const; - void setSystemStatus(unsigned char pX); - - unsigned char getDataField1() const; - void setDataField1(unsigned char pX); - - unsigned char getInformationLayers() const; - void setInformationLayers(unsigned char pX); - - unsigned char getDataField2() const; - void setDataField2(unsigned char pX); - - unsigned short getParameter1() const; - void setParameter1(unsigned short pX); - - unsigned short getParameter2() const; - void setParameter2(unsigned short pX); - - unsigned short getParameter3() const; - void setParameter3(unsigned short pX); - - unsigned short getParameter4() const; - void setParameter4(unsigned short pX); - - unsigned short getParameter5() const; - void setParameter5(unsigned short pX); - - unsigned short getParameter6() const; - void setParameter6(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const FundamentalOperationalData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/GridAxis.cpp b/src/dis7/GridAxis.cpp deleted file mode 100644 index b2aad63a..00000000 --- a/src/dis7/GridAxis.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -GridAxis::GridAxis(): - _domainInitialXi(0.0), - _domainFinalXi(0.0), - _domainPointsXi(0), - _interleafFactor(0), - _axisType(0), - _numberOfPointsOnXiAxis(0), - _initialIndex(0) -{ -} - -GridAxis::~GridAxis() -{ -} - -double GridAxis::getDomainInitialXi() const -{ - return _domainInitialXi; -} - -void GridAxis::setDomainInitialXi(double pX) -{ - _domainInitialXi = pX; -} - -double GridAxis::getDomainFinalXi() const -{ - return _domainFinalXi; -} - -void GridAxis::setDomainFinalXi(double pX) -{ - _domainFinalXi = pX; -} - -unsigned short GridAxis::getDomainPointsXi() const -{ - return _domainPointsXi; -} - -void GridAxis::setDomainPointsXi(unsigned short pX) -{ - _domainPointsXi = pX; -} - -unsigned char GridAxis::getInterleafFactor() const -{ - return _interleafFactor; -} - -void GridAxis::setInterleafFactor(unsigned char pX) -{ - _interleafFactor = pX; -} - -unsigned char GridAxis::getAxisType() const -{ - return _axisType; -} - -void GridAxis::setAxisType(unsigned char pX) -{ - _axisType = pX; -} - -unsigned short GridAxis::getNumberOfPointsOnXiAxis() const -{ - return _numberOfPointsOnXiAxis; -} - -void GridAxis::setNumberOfPointsOnXiAxis(unsigned short pX) -{ - _numberOfPointsOnXiAxis = pX; -} - -unsigned short GridAxis::getInitialIndex() const -{ - return _initialIndex; -} - -void GridAxis::setInitialIndex(unsigned short pX) -{ - _initialIndex = pX; -} - -void GridAxis::marshal(DataStream& dataStream) const -{ - dataStream << _domainInitialXi; - dataStream << _domainFinalXi; - dataStream << _domainPointsXi; - dataStream << _interleafFactor; - dataStream << _axisType; - dataStream << _numberOfPointsOnXiAxis; - dataStream << _initialIndex; -} - -void GridAxis::unmarshal(DataStream& dataStream) -{ - dataStream >> _domainInitialXi; - dataStream >> _domainFinalXi; - dataStream >> _domainPointsXi; - dataStream >> _interleafFactor; - dataStream >> _axisType; - dataStream >> _numberOfPointsOnXiAxis; - dataStream >> _initialIndex; -} - - -bool GridAxis::operator ==(const GridAxis& rhs) const - { - bool ivarsEqual = true; - - if( ! (_domainInitialXi == rhs._domainInitialXi) ) ivarsEqual = false; - if( ! (_domainFinalXi == rhs._domainFinalXi) ) ivarsEqual = false; - if( ! (_domainPointsXi == rhs._domainPointsXi) ) ivarsEqual = false; - if( ! (_interleafFactor == rhs._interleafFactor) ) ivarsEqual = false; - if( ! (_axisType == rhs._axisType) ) ivarsEqual = false; - if( ! (_numberOfPointsOnXiAxis == rhs._numberOfPointsOnXiAxis) ) ivarsEqual = false; - if( ! (_initialIndex == rhs._initialIndex) ) ivarsEqual = false; - - return ivarsEqual; - } - -int GridAxis::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 8; // _domainInitialXi - marshalSize = marshalSize + 8; // _domainFinalXi - marshalSize = marshalSize + 2; // _domainPointsXi - marshalSize = marshalSize + 1; // _interleafFactor - marshalSize = marshalSize + 1; // _axisType - marshalSize = marshalSize + 2; // _numberOfPointsOnXiAxis - marshalSize = marshalSize + 2; // _initialIndex - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/GridAxis.h b/src/dis7/GridAxis.h deleted file mode 100644 index a04908fd..00000000 --- a/src/dis7/GridAxis.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Grid axis record for fixed data. Section 6.2.41 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT GridAxis -{ -protected: - /** coordinate of the grid origin or initial value */ - double _domainInitialXi; - - /** coordinate of the endpoint or final value */ - double _domainFinalXi; - - /** The number of grid points along the Xi domain axis for the enviornmental state data */ - unsigned short _domainPointsXi; - - /** interleaf factor along the domain axis. */ - unsigned char _interleafFactor; - - /** type of grid axis */ - unsigned char _axisType; - - /** Number of grid locations along Xi axis */ - unsigned short _numberOfPointsOnXiAxis; - - /** initial grid point for the current pdu */ - unsigned short _initialIndex; - - - public: - GridAxis(); - virtual ~GridAxis(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - double getDomainInitialXi() const; - void setDomainInitialXi(double pX); - - double getDomainFinalXi() const; - void setDomainFinalXi(double pX); - - unsigned short getDomainPointsXi() const; - void setDomainPointsXi(unsigned short pX); - - unsigned char getInterleafFactor() const; - void setInterleafFactor(unsigned char pX); - - unsigned char getAxisType() const; - void setAxisType(unsigned char pX); - - unsigned short getNumberOfPointsOnXiAxis() const; - void setNumberOfPointsOnXiAxis(unsigned short pX); - - unsigned short getInitialIndex() const; - void setInitialIndex(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const GridAxis& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/GroupIdentifier.cpp b/src/dis7/GroupIdentifier.cpp deleted file mode 100644 index cbbcc939..00000000 --- a/src/dis7/GroupIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -GroupIdentifier::GroupIdentifier(): - _simulationAddress(), - _groupNumber(0) -{ -} - -GroupIdentifier::~GroupIdentifier() -{ -} - -EntityType& GroupIdentifier::getSimulationAddress() -{ - return _simulationAddress; -} - -const EntityType& GroupIdentifier::getSimulationAddress() const -{ - return _simulationAddress; -} - -void GroupIdentifier::setSimulationAddress(const EntityType &pX) -{ - _simulationAddress = pX; -} - -unsigned short GroupIdentifier::getGroupNumber() const -{ - return _groupNumber; -} - -void GroupIdentifier::setGroupNumber(unsigned short pX) -{ - _groupNumber = pX; -} - -void GroupIdentifier::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _groupNumber; -} - -void GroupIdentifier::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _groupNumber; -} - - -bool GroupIdentifier::operator ==(const GroupIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_groupNumber == rhs._groupNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int GroupIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _groupNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/GroupIdentifier.h b/src/dis7/GroupIdentifier.h deleted file mode 100644 index f54a82d4..00000000 --- a/src/dis7/GroupIdentifier.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Unique designation of a group of entities contained in the isGroupOfPdu. Represents a group of entities rather than a single entity. Section 6.2.43 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT GroupIdentifier -{ -protected: - /** Simulation address (site and application number) */ - EntityType _simulationAddress; - - /** group number */ - unsigned short _groupNumber; - - - public: - GroupIdentifier(); - virtual ~GroupIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getSimulationAddress(); - const EntityType& getSimulationAddress() const; - void setSimulationAddress(const EntityType &pX); - - unsigned short getGroupNumber() const; - void setGroupNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const GroupIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IFFFundamentalParameterData.cpp b/src/dis7/IFFFundamentalParameterData.cpp deleted file mode 100644 index a4941129..00000000 --- a/src/dis7/IFFFundamentalParameterData.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#include - -using namespace DIS; - - -IFFFundamentalParameterData::IFFFundamentalParameterData(): - _erp(0.0), - _frequency(0.0), - _pgrf(0.0), - _pulseWidth(0.0), - _burstLength(0), - _applicableModes(0) -{ - // Initialize fixed length array - for(int lengthsystemSpecificData= 0; lengthsystemSpecificData < 3; lengthsystemSpecificData++) - { - _systemSpecificData[lengthsystemSpecificData] = 0; - } - -} - -IFFFundamentalParameterData::~IFFFundamentalParameterData() -{ -} - -float IFFFundamentalParameterData::getErp() const -{ - return _erp; -} - -void IFFFundamentalParameterData::setErp(float pX) -{ - _erp = pX; -} - -float IFFFundamentalParameterData::getFrequency() const -{ - return _frequency; -} - -void IFFFundamentalParameterData::setFrequency(float pX) -{ - _frequency = pX; -} - -float IFFFundamentalParameterData::getPgrf() const -{ - return _pgrf; -} - -void IFFFundamentalParameterData::setPgrf(float pX) -{ - _pgrf = pX; -} - -float IFFFundamentalParameterData::getPulseWidth() const -{ - return _pulseWidth; -} - -void IFFFundamentalParameterData::setPulseWidth(float pX) -{ - _pulseWidth = pX; -} - -unsigned int IFFFundamentalParameterData::getBurstLength() const -{ - return _burstLength; -} - -void IFFFundamentalParameterData::setBurstLength(unsigned int pX) -{ - _burstLength = pX; -} - -unsigned char IFFFundamentalParameterData::getApplicableModes() const -{ - return _applicableModes; -} - -void IFFFundamentalParameterData::setApplicableModes(unsigned char pX) -{ - _applicableModes = pX; -} - -unsigned char* IFFFundamentalParameterData::getSystemSpecificData() -{ - return _systemSpecificData; -} - -const unsigned char* IFFFundamentalParameterData::getSystemSpecificData() const -{ - return _systemSpecificData; -} - -void IFFFundamentalParameterData::setSystemSpecificData(const unsigned char* x) -{ - for(int i = 0; i < 3; i++) - { - _systemSpecificData[i] = x[i]; - } -} - -void IFFFundamentalParameterData::marshal(DataStream& dataStream) const -{ - dataStream << _erp; - dataStream << _frequency; - dataStream << _pgrf; - dataStream << _pulseWidth; - dataStream << _burstLength; - dataStream << _applicableModes; - - for(size_t idx = 0; idx < 3; idx++) - { - dataStream << _systemSpecificData[idx]; - } - -} - -void IFFFundamentalParameterData::unmarshal(DataStream& dataStream) -{ - dataStream >> _erp; - dataStream >> _frequency; - dataStream >> _pgrf; - dataStream >> _pulseWidth; - dataStream >> _burstLength; - dataStream >> _applicableModes; - - for(size_t idx = 0; idx < 3; idx++) - { - dataStream >> _systemSpecificData[idx]; - } - -} - - -bool IFFFundamentalParameterData::operator ==(const IFFFundamentalParameterData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_erp == rhs._erp) ) ivarsEqual = false; - if( ! (_frequency == rhs._frequency) ) ivarsEqual = false; - if( ! (_pgrf == rhs._pgrf) ) ivarsEqual = false; - if( ! (_pulseWidth == rhs._pulseWidth) ) ivarsEqual = false; - if( ! (_burstLength == rhs._burstLength) ) ivarsEqual = false; - if( ! (_applicableModes == rhs._applicableModes) ) ivarsEqual = false; - - for(unsigned char idx = 0; idx < 3; idx++) - { - if(!(_systemSpecificData[idx] == rhs._systemSpecificData[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int IFFFundamentalParameterData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _erp - marshalSize = marshalSize + 4; // _frequency - marshalSize = marshalSize + 4; // _pgrf - marshalSize = marshalSize + 4; // _pulseWidth - marshalSize = marshalSize + 4; // _burstLength - marshalSize = marshalSize + 1; // _applicableModes - marshalSize = marshalSize + 3 * 1; // _systemSpecificData - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IFFFundamentalParameterData.h b/src/dis7/IFFFundamentalParameterData.h deleted file mode 100644 index 24cff119..00000000 --- a/src/dis7/IFFFundamentalParameterData.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Fundamental IFF atc data. Section 6.2.45 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT IFFFundamentalParameterData -{ -protected: - /** ERP */ - float _erp; - - /** frequency */ - float _frequency; - - /** pgrf */ - float _pgrf; - - /** Pulse width */ - float _pulseWidth; - - /** Burst length */ - unsigned int _burstLength; - - /** Applicable modes enumeration */ - unsigned char _applicableModes; - - /** System-specific data */ - unsigned char _systemSpecificData[3]; - - - public: - IFFFundamentalParameterData(); - virtual ~IFFFundamentalParameterData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getErp() const; - void setErp(float pX); - - float getFrequency() const; - void setFrequency(float pX); - - float getPgrf() const; - void setPgrf(float pX); - - float getPulseWidth() const; - void setPulseWidth(float pX); - - unsigned int getBurstLength() const; - void setBurstLength(unsigned int pX); - - unsigned char getApplicableModes() const; - void setApplicableModes(unsigned char pX); - - unsigned char* getSystemSpecificData(); - const unsigned char* getSystemSpecificData() const; - void setSystemSpecificData( const unsigned char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IFFFundamentalParameterData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IFFPdu.cpp b/src/dis7/IFFPdu.cpp deleted file mode 100644 index a3866a5a..00000000 --- a/src/dis7/IFFPdu.cpp +++ /dev/null @@ -1,282 +0,0 @@ -#include - -using namespace DIS; - - -IFFPdu::IFFPdu() : DistributedEmissionsFamilyPdu(), - _emittingEntityID(), - _eventID(), - _relativeAntennaLocation(), - _numberOfIFFParameters(0), - _systemID(), - _systemDesignator(0), - _systemSpecificData(0), - _fundamentalOperationalData(), - _layerHeader(), - _beamData(), - _secondaryOperationalData() -{ - setPduType( 28 ); -} - -IFFPdu::~IFFPdu() -{ - _iffParameters.clear(); -} - -EntityID& IFFPdu::getEmittingEntityID() -{ - return _emittingEntityID; -} - -const EntityID& IFFPdu::getEmittingEntityID() const -{ - return _emittingEntityID; -} - -void IFFPdu::setEmittingEntityID(const EntityID &pX) -{ - _emittingEntityID = pX; -} - -EventIdentifier& IFFPdu::getEventID() -{ - return _eventID; -} - -const EventIdentifier& IFFPdu::getEventID() const -{ - return _eventID; -} - -void IFFPdu::setEventID(const EventIdentifier &pX) -{ - _eventID = pX; -} - -Vector3Float& IFFPdu::getRelativeAntennaLocation() -{ - return _relativeAntennaLocation; -} - -const Vector3Float& IFFPdu::getRelativeAntennaLocation() const -{ - return _relativeAntennaLocation; -} - -void IFFPdu::setRelativeAntennaLocation(const Vector3Float &pX) -{ - _relativeAntennaLocation = pX; -} - -unsigned int IFFPdu::getNumberOfIFFParameters() const -{ - return _numberOfIFFParameters; -} - -SystemIdentifier& IFFPdu::getSystemID() -{ - return _systemID; -} - -const SystemIdentifier& IFFPdu::getSystemID() const -{ - return _systemID; -} - -void IFFPdu::setSystemID(const SystemIdentifier &pX) -{ - _systemID = pX; -} - -unsigned char IFFPdu::getSystemDesignator() const -{ - return _systemDesignator; -} - -void IFFPdu::setSystemDesignator(unsigned char pX) -{ - _systemDesignator = pX; -} - -unsigned char IFFPdu::getSystemSpecificData() const -{ - return _systemSpecificData; -} - -void IFFPdu::setSystemSpecificData(unsigned char pX) -{ - _systemSpecificData = pX; -} - -FundamentalOperationalData& IFFPdu::getFundamentalOperationalData() -{ - return _fundamentalOperationalData; -} - -const FundamentalOperationalData& IFFPdu::getFundamentalOperationalData() const -{ - return _fundamentalOperationalData; -} - -void IFFPdu::setFundamentalOperationalData(const FundamentalOperationalData &pX) -{ - _fundamentalOperationalData = pX; -} - -LayerHeader& IFFPdu::getLayerHeader() -{ - return _layerHeader; -} - -const LayerHeader& IFFPdu::getLayerHeader() const -{ - return _layerHeader; -} - -void IFFPdu::setLayerHeader(const LayerHeader& pX) -{ - _layerHeader = pX; -} - -BeamData& IFFPdu::getBeamData() -{ - return _beamData; -} - -const BeamData& IFFPdu::getBeamData() const -{ - return _beamData; -} - -void IFFPdu::setBeamData(const BeamData& pX) -{ - _beamData = pX; -} - -SecondaryOperationalData& IFFPdu::getSecondaryOperationalData() -{ - return _secondaryOperationalData; -} - -const SecondaryOperationalData& IFFPdu::getSecondaryOperationalData() const -{ - return _secondaryOperationalData; -} - -void IFFPdu::setSecondaryOperationalData(const SecondaryOperationalData& pX) -{ - _secondaryOperationalData = pX; -} - -std::vector& IFFPdu::getIFFParameters() -{ - return _iffParameters; -} - -const std::vector& IFFPdu::getIFFParameters() const -{ - return _iffParameters; -} - -void IFFPdu::setIFFParameters(const std::vector& pX) -{ - _iffParameters = pX; -} - -void IFFPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _emittingEntityID.marshal(dataStream); - _eventID.marshal(dataStream); - _relativeAntennaLocation.marshal(dataStream); - _systemID.marshal(dataStream); - dataStream << _systemDesignator; - dataStream << _systemSpecificData; - _fundamentalOperationalData.marshal(dataStream); - _layerHeader.marshal(dataStream); - _beamData.marshal(dataStream); - _secondaryOperationalData.marshal(dataStream); - dataStream << ( unsigned char )_iffParameters.size(); - for(size_t idx = 0; idx < _iffParameters.size(); idx++) - { - IFFFundamentalParameterData x = _iffParameters[idx]; - x.marshal(dataStream); - } - -} - -void IFFPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _emittingEntityID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - _relativeAntennaLocation.unmarshal(dataStream); - _systemID.unmarshal(dataStream); - dataStream >> _systemDesignator; - dataStream >> _systemSpecificData; - _fundamentalOperationalData.unmarshal(dataStream); - _layerHeader.unmarshal(dataStream); - _beamData.unmarshal(dataStream); - _secondaryOperationalData.unmarshal(dataStream); - _numberOfIFFParameters = _secondaryOperationalData.getNumberOfIFFFundamentalParameterRecords(); - _iffParameters.clear(); - for(size_t idx = 0; idx < _numberOfIFFParameters; idx++) - { - IFFFundamentalParameterData x; - x.unmarshal(dataStream); - _iffParameters.push_back(x); - } -} - - -bool IFFPdu::operator ==(const IFFPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_emittingEntityID == rhs._emittingEntityID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_relativeAntennaLocation == rhs._relativeAntennaLocation) ) ivarsEqual = false; - if( ! (_systemID == rhs._systemID) ) ivarsEqual = false; - if( ! (_systemDesignator == rhs._systemDesignator) ) ivarsEqual = false; - if( ! (_systemSpecificData == rhs._systemSpecificData) ) ivarsEqual = false; - if( ! (_fundamentalOperationalData == rhs._fundamentalOperationalData) ) ivarsEqual = false; - if( ! (_layerHeader == rhs._layerHeader) ) ivarsEqual = false; - if( ! (_beamData == rhs._beamData) ) ivarsEqual = false; - if( ! (_secondaryOperationalData == rhs._secondaryOperationalData) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _iffParameters.size(); idx++) - { - if( ! ( _iffParameters[idx] == rhs._iffParameters[idx]) ) ivarsEqual = false; - } - - return ivarsEqual; - } - -int IFFPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + _relativeAntennaLocation.getMarshalledSize(); //_relativeAntennaLocation - marshalSize = marshalSize + 1; // _numberOfIFFParameters - marshalSize = marshalSize + _systemID.getMarshalledSize(); //_systemID - marshalSize = marshalSize + 1; //_systemDesignator - marshalSize = marshalSize + 1; //_systemSpecificData - marshalSize = marshalSize + _fundamentalOperationalData.getMarshalledSize(); // _fundamentalOperationalData - marshalSize = marshalSize + _layerHeader.getMarshalledSize(); // _layerHeader - marshalSize = marshalSize + _beamData.getMarshalledSize(); // _beamData - marshalSize = marshalSize + _secondaryOperationalData.getMarshalledSize(); // _secondaryOperationalData - - for(unsigned long long idx=0; idx < _iffParameters.size(); idx++) - { - IFFFundamentalParameterData listElement = _iffParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} diff --git a/src/dis7/IFFPdu.h b/src/dis7/IFFPdu.h deleted file mode 100644 index 7bc8295e..00000000 --- a/src/dis7/IFFPdu.h +++ /dev/null @@ -1,113 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -//This PDU is written according SISO Standard, the link is on below: -//https://www.sisostds.org/DesktopModules/Bring2mind/DMX/API/Entries/Download?Command=Core_Download&EntryId=36292&PortalId=0&TabId=105 -//Another good document for DIS v6 and v7 is: -//https://www.sisostds.org/DesktopModules/Bring2mind/DMX/API/Entries/Download?Command=Core_Download&EntryId=29289&PortalId=0&TabId=105 - -// @author semihkurt , 09/04/2021 - -class OPENDIS7_EXPORT IFFPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** ID of the entity emitting */ - EntityID _emittingEntityID; - - /** ID of event */ - EventIdentifier _eventID; - - Vector3Float _relativeAntennaLocation; - - /** How many iff parameters are in the variable length list */ - unsigned int _numberOfIFFParameters; - - SystemIdentifier _systemID; - - unsigned char _systemDesignator; - - unsigned char _systemSpecificData; - - FundamentalOperationalData _fundamentalOperationalData; - - LayerHeader _layerHeader; - - BeamData _beamData; - - SecondaryOperationalData _secondaryOperationalData; - - std::vector _iffParameters; - - public: - IFFPdu(); - virtual ~IFFPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEmittingEntityID(); - const EntityID& getEmittingEntityID() const; - void setEmittingEntityID(const EntityID &pX); - - EventIdentifier& getEventID(); - const EventIdentifier& getEventID() const; - void setEventID(const EventIdentifier &pX); - - Vector3Float& getRelativeAntennaLocation(); - const Vector3Float& getRelativeAntennaLocation() const; - void setRelativeAntennaLocation(const Vector3Float &pX); - - unsigned int getNumberOfIFFParameters() const; - - SystemIdentifier& getSystemID(); - const SystemIdentifier& getSystemID() const; - void setSystemID(const SystemIdentifier &pX); - - unsigned char getSystemDesignator() const; - void setSystemDesignator(unsigned char pX); - - unsigned char getSystemSpecificData() const; - void setSystemSpecificData(unsigned char pX); - - FundamentalOperationalData& getFundamentalOperationalData(); - const FundamentalOperationalData& getFundamentalOperationalData() const; - void setFundamentalOperationalData(const FundamentalOperationalData &pX); - - LayerHeader& getLayerHeader(); - const LayerHeader& getLayerHeader() const; - void setLayerHeader(const LayerHeader &pX); - - BeamData& getBeamData(); - const BeamData& getBeamData() const; - void setBeamData(const BeamData &pX); - - SecondaryOperationalData& getSecondaryOperationalData(); - const SecondaryOperationalData& getSecondaryOperationalData() const; - void setSecondaryOperationalData(const SecondaryOperationalData &pX); - - std::vector& getIFFParameters(); - const std::vector& getIFFParameters() const; - void setIFFParameters(const std::vector& pX); - -virtual int getMarshalledSize() const; - - bool operator ==(const IFFPdu& rhs) const; -}; -} - diff --git a/src/dis7/IOCommunicationsNode.cpp b/src/dis7/IOCommunicationsNode.cpp deleted file mode 100644 index a6535550..00000000 --- a/src/dis7/IOCommunicationsNode.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include - -using namespace DIS; - - -IOCommunicationsNode::IOCommunicationsNode(): - _recordType(5501), - _recordLength(16), - _communcationsNodeType(0), - _padding(0), - _communicationsNode(), - _elementID(0) -{ -} - -IOCommunicationsNode::~IOCommunicationsNode() -{ -} - -unsigned int IOCommunicationsNode::getRecordType() const -{ - return _recordType; -} - -void IOCommunicationsNode::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short IOCommunicationsNode::getRecordLength() const -{ - return _recordLength; -} - -void IOCommunicationsNode::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned char IOCommunicationsNode::getCommuncationsNodeType() const -{ - return _communcationsNodeType; -} - -void IOCommunicationsNode::setCommuncationsNodeType(unsigned char pX) -{ - _communcationsNodeType = pX; -} - -unsigned char IOCommunicationsNode::getPadding() const -{ - return _padding; -} - -void IOCommunicationsNode::setPadding(unsigned char pX) -{ - _padding = pX; -} - -EntityID& IOCommunicationsNode::getCommunicationsNode() -{ - return _communicationsNode; -} - -const EntityID& IOCommunicationsNode::getCommunicationsNode() const -{ - return _communicationsNode; -} - -void IOCommunicationsNode::setCommunicationsNode(const EntityID &pX) -{ - _communicationsNode = pX; -} - -unsigned short IOCommunicationsNode::getElementID() const -{ - return _elementID; -} - -void IOCommunicationsNode::setElementID(unsigned short pX) -{ - _elementID = pX; -} - -void IOCommunicationsNode::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _communcationsNodeType; - dataStream << _padding; - _communicationsNode.marshal(dataStream); - dataStream << _elementID; -} - -void IOCommunicationsNode::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _communcationsNodeType; - dataStream >> _padding; - _communicationsNode.unmarshal(dataStream); - dataStream >> _elementID; -} - - -bool IOCommunicationsNode::operator ==(const IOCommunicationsNode& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_communcationsNodeType == rhs._communcationsNodeType) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_communicationsNode == rhs._communicationsNode) ) ivarsEqual = false; - if( ! (_elementID == rhs._elementID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IOCommunicationsNode::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 1; // _communcationsNodeType - marshalSize = marshalSize + 1; // _padding - marshalSize = marshalSize + _communicationsNode.getMarshalledSize(); // _communicationsNode - marshalSize = marshalSize + 2; // _elementID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IOCommunicationsNode.h b/src/dis7/IOCommunicationsNode.h deleted file mode 100644 index 2bb2e2b2..00000000 --- a/src/dis7/IOCommunicationsNode.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// A communications node that is part of a simulted communcations network. Section 6.2.49.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT IOCommunicationsNode -{ -protected: - unsigned int _recordType; - - unsigned short _recordLength; - - unsigned char _communcationsNodeType; - - unsigned char _padding; - - EntityID _communicationsNode; - - unsigned short _elementID; - - - public: - IOCommunicationsNode(); - virtual ~IOCommunicationsNode(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned char getCommuncationsNodeType() const; - void setCommuncationsNodeType(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - EntityID& getCommunicationsNode(); - const EntityID& getCommunicationsNode() const; - void setCommunicationsNode(const EntityID &pX); - - unsigned short getElementID() const; - void setElementID(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IOCommunicationsNode& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IOEffect.cpp b/src/dis7/IOEffect.cpp deleted file mode 100644 index 546a3529..00000000 --- a/src/dis7/IOEffect.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include - -using namespace DIS; - - -IOEffect::IOEffect(): - _recordType(5500), - _recordLength(16), - _ioStatus(0), - _ioLinkType(0), - _ioEffect(), - _ioEffectDutyCycle(0), - _ioEffectDuration(0), - _ioProcess(0), - _padding(0) -{ -} - -IOEffect::~IOEffect() -{ -} - -unsigned int IOEffect::getRecordType() const -{ - return _recordType; -} - -void IOEffect::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned short IOEffect::getRecordLength() const -{ - return _recordLength; -} - -void IOEffect::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned char IOEffect::getIoStatus() const -{ - return _ioStatus; -} - -void IOEffect::setIoStatus(unsigned char pX) -{ - _ioStatus = pX; -} - -unsigned char IOEffect::getIoLinkType() const -{ - return _ioLinkType; -} - -void IOEffect::setIoLinkType(unsigned char pX) -{ - _ioLinkType = pX; -} - -EntityID& IOEffect::getIoEffect() -{ - return _ioEffect; -} - -const EntityID& IOEffect::getIoEffect() const -{ - return _ioEffect; -} - -void IOEffect::setIoEffect(const EntityID &pX) -{ - _ioEffect = pX; -} - -unsigned char IOEffect::getIoEffectDutyCycle() const -{ - return _ioEffectDutyCycle; -} - -void IOEffect::setIoEffectDutyCycle(unsigned char pX) -{ - _ioEffectDutyCycle = pX; -} - -unsigned short IOEffect::getIoEffectDuration() const -{ - return _ioEffectDuration; -} - -void IOEffect::setIoEffectDuration(unsigned short pX) -{ - _ioEffectDuration = pX; -} - -unsigned short IOEffect::getIoProcess() const -{ - return _ioProcess; -} - -void IOEffect::setIoProcess(unsigned short pX) -{ - _ioProcess = pX; -} - -unsigned short IOEffect::getPadding() const -{ - return _padding; -} - -void IOEffect::setPadding(unsigned short pX) -{ - _padding = pX; -} - -void IOEffect::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _ioStatus; - dataStream << _ioLinkType; - _ioEffect.marshal(dataStream); - dataStream << _ioEffectDutyCycle; - dataStream << _ioEffectDuration; - dataStream << _ioProcess; - dataStream << _padding; -} - -void IOEffect::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _ioStatus; - dataStream >> _ioLinkType; - _ioEffect.unmarshal(dataStream); - dataStream >> _ioEffectDutyCycle; - dataStream >> _ioEffectDuration; - dataStream >> _ioProcess; - dataStream >> _padding; -} - - -bool IOEffect::operator ==(const IOEffect& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_ioStatus == rhs._ioStatus) ) ivarsEqual = false; - if( ! (_ioLinkType == rhs._ioLinkType) ) ivarsEqual = false; - if( ! (_ioEffect == rhs._ioEffect) ) ivarsEqual = false; - if( ! (_ioEffectDutyCycle == rhs._ioEffectDutyCycle) ) ivarsEqual = false; - if( ! (_ioEffectDuration == rhs._ioEffectDuration) ) ivarsEqual = false; - if( ! (_ioProcess == rhs._ioProcess) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IOEffect::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 1; // _ioStatus - marshalSize = marshalSize + 1; // _ioLinkType - marshalSize = marshalSize + _ioEffect.getMarshalledSize(); // _ioEffect - marshalSize = marshalSize + 1; // _ioEffectDutyCycle - marshalSize = marshalSize + 2; // _ioEffectDuration - marshalSize = marshalSize + 2; // _ioProcess - marshalSize = marshalSize + 2; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IOEffect.h b/src/dis7/IOEffect.h deleted file mode 100644 index 3ab44a7e..00000000 --- a/src/dis7/IOEffect.h +++ /dev/null @@ -1,109 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Effect of IO on an entity. Section 6.2.49.3 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT IOEffect -{ -protected: - unsigned int _recordType; - - unsigned short _recordLength; - - unsigned char _ioStatus; - - unsigned char _ioLinkType; - - EntityID _ioEffect; - - unsigned char _ioEffectDutyCycle; - - unsigned short _ioEffectDuration; - - unsigned short _ioProcess; - - unsigned short _padding; - - - public: - IOEffect(); - virtual ~IOEffect(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned char getIoStatus() const; - void setIoStatus(unsigned char pX); - - unsigned char getIoLinkType() const; - void setIoLinkType(unsigned char pX); - - EntityID& getIoEffect(); - const EntityID& getIoEffect() const; - void setIoEffect(const EntityID &pX); - - unsigned char getIoEffectDutyCycle() const; - void setIoEffectDutyCycle(unsigned char pX); - - unsigned short getIoEffectDuration() const; - void setIoEffectDuration(unsigned short pX); - - unsigned short getIoProcess() const; - void setIoProcess(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IOEffect& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IffDataSpecification.cpp b/src/dis7/IffDataSpecification.cpp deleted file mode 100644 index 62ff8403..00000000 --- a/src/dis7/IffDataSpecification.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include - -using namespace DIS; - - -IffDataSpecification::IffDataSpecification(): - _numberOfIffDataRecords() -{ -} - -IffDataSpecification::~IffDataSpecification() -{ -} - -EntityType& IffDataSpecification::getNumberOfIffDataRecords() -{ - return _numberOfIffDataRecords; -} - -const EntityType& IffDataSpecification::getNumberOfIffDataRecords() const -{ - return _numberOfIffDataRecords; -} - -void IffDataSpecification::setNumberOfIffDataRecords(const EntityType &pX) -{ - _numberOfIffDataRecords = pX; -} - -void IffDataSpecification::marshal(DataStream& dataStream) const -{ - _numberOfIffDataRecords.marshal(dataStream); -} - -void IffDataSpecification::unmarshal(DataStream& dataStream) -{ - _numberOfIffDataRecords.unmarshal(dataStream); -} - - -bool IffDataSpecification::operator ==(const IffDataSpecification& rhs) const - { - bool ivarsEqual = true; - - if( ! (_numberOfIffDataRecords == rhs._numberOfIffDataRecords) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IffDataSpecification::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _numberOfIffDataRecords.getMarshalledSize(); // _numberOfIffDataRecords - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IffDataSpecification.h b/src/dis7/IffDataSpecification.h deleted file mode 100644 index f04b5ec7..00000000 --- a/src/dis7/IffDataSpecification.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Requires hand coding to be useful. Section 6.2.44 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT IffDataSpecification -{ -protected: - /** Number of iff records */ - EntityType _numberOfIffDataRecords; - - - public: - IffDataSpecification(); - virtual ~IffDataSpecification(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getNumberOfIffDataRecords(); - const EntityType& getNumberOfIffDataRecords() const; - void setNumberOfIffDataRecords(const EntityType &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IffDataSpecification& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IntercomCommunicationsParameters.cpp b/src/dis7/IntercomCommunicationsParameters.cpp deleted file mode 100644 index 67d8c47e..00000000 --- a/src/dis7/IntercomCommunicationsParameters.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -IntercomCommunicationsParameters::IntercomCommunicationsParameters(): - _recordType(0), - _recordLength(0), - _recordSpecificField(0) -{ -} - -IntercomCommunicationsParameters::~IntercomCommunicationsParameters() -{ -} - -unsigned short IntercomCommunicationsParameters::getRecordType() const -{ - return _recordType; -} - -void IntercomCommunicationsParameters::setRecordType(unsigned short pX) -{ - _recordType = pX; -} - -unsigned short IntercomCommunicationsParameters::getRecordLength() const -{ - return _recordLength; -} - -void IntercomCommunicationsParameters::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned int IntercomCommunicationsParameters::getRecordSpecificField() const -{ - return _recordSpecificField; -} - -void IntercomCommunicationsParameters::setRecordSpecificField(unsigned int pX) -{ - _recordSpecificField = pX; -} - -void IntercomCommunicationsParameters::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; - dataStream << _recordSpecificField; -} - -void IntercomCommunicationsParameters::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; - dataStream >> _recordSpecificField; -} - - -bool IntercomCommunicationsParameters::operator ==(const IntercomCommunicationsParameters& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_recordSpecificField == rhs._recordSpecificField) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IntercomCommunicationsParameters::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _recordType - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 4; // _recordSpecificField - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IntercomCommunicationsParameters.h b/src/dis7/IntercomCommunicationsParameters.h deleted file mode 100644 index 07454831..00000000 --- a/src/dis7/IntercomCommunicationsParameters.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Intercom communcations parameters. Section 6.2.47. This requires hand coding - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT IntercomCommunicationsParameters -{ -protected: - /** Type of intercom parameters record */ - unsigned short _recordType; - - /** length of record */ - unsigned short _recordLength; - - /** This is a placeholder. */ - unsigned int _recordSpecificField; - - - public: - IntercomCommunicationsParameters(); - virtual ~IntercomCommunicationsParameters(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getRecordType() const; - void setRecordType(unsigned short pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned int getRecordSpecificField() const; - void setRecordSpecificField(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IntercomCommunicationsParameters& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IntercomIdentifier.cpp b/src/dis7/IntercomIdentifier.cpp deleted file mode 100644 index 33f7b4eb..00000000 --- a/src/dis7/IntercomIdentifier.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -IntercomIdentifier::IntercomIdentifier(): - _siteNumber(0), - _applicationNumber(0), - _referenceNumber(0), - _intercomNumber(0) -{ -} - -IntercomIdentifier::~IntercomIdentifier() -{ -} - -unsigned short IntercomIdentifier::getSiteNumber() const -{ - return _siteNumber; -} - -void IntercomIdentifier::setSiteNumber(unsigned short pX) -{ - _siteNumber = pX; -} - -unsigned short IntercomIdentifier::getApplicationNumber() const -{ - return _applicationNumber; -} - -void IntercomIdentifier::setApplicationNumber(unsigned short pX) -{ - _applicationNumber = pX; -} - -unsigned short IntercomIdentifier::getReferenceNumber() const -{ - return _referenceNumber; -} - -void IntercomIdentifier::setReferenceNumber(unsigned short pX) -{ - _referenceNumber = pX; -} - -unsigned short IntercomIdentifier::getIntercomNumber() const -{ - return _intercomNumber; -} - -void IntercomIdentifier::setIntercomNumber(unsigned short pX) -{ - _intercomNumber = pX; -} - -void IntercomIdentifier::marshal(DataStream& dataStream) const -{ - dataStream << _siteNumber; - dataStream << _applicationNumber; - dataStream << _referenceNumber; - dataStream << _intercomNumber; -} - -void IntercomIdentifier::unmarshal(DataStream& dataStream) -{ - dataStream >> _siteNumber; - dataStream >> _applicationNumber; - dataStream >> _referenceNumber; - dataStream >> _intercomNumber; -} - - -bool IntercomIdentifier::operator ==(const IntercomIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_siteNumber == rhs._siteNumber) ) ivarsEqual = false; - if( ! (_applicationNumber == rhs._applicationNumber) ) ivarsEqual = false; - if( ! (_referenceNumber == rhs._referenceNumber) ) ivarsEqual = false; - if( ! (_intercomNumber == rhs._intercomNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IntercomIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _siteNumber - marshalSize = marshalSize + 2; // _applicationNumber - marshalSize = marshalSize + 2; // _referenceNumber - marshalSize = marshalSize + 2; // _intercomNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IntercomIdentifier.h b/src/dis7/IntercomIdentifier.h deleted file mode 100644 index b85fd774..00000000 --- a/src/dis7/IntercomIdentifier.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Unique designation of an attached or unattached intercom in an event or exercirse. Section 6.2.48 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT IntercomIdentifier -{ -protected: - unsigned short _siteNumber; - - unsigned short _applicationNumber; - - unsigned short _referenceNumber; - - unsigned short _intercomNumber; - - - public: - IntercomIdentifier(); - virtual ~IntercomIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSiteNumber() const; - void setSiteNumber(unsigned short pX); - - unsigned short getApplicationNumber() const; - void setApplicationNumber(unsigned short pX); - - unsigned short getReferenceNumber() const; - void setReferenceNumber(unsigned short pX); - - unsigned short getIntercomNumber() const; - void setIntercomNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IntercomIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IntercomSignalPdu.cpp b/src/dis7/IntercomSignalPdu.cpp deleted file mode 100644 index b5266b0f..00000000 --- a/src/dis7/IntercomSignalPdu.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include - -using namespace DIS; - -IntercomSignalPdu::IntercomSignalPdu() - : RadioCommunicationsFamilyPdu(), _entityID(), _communicationsDeviceID(0), - _encodingScheme(0), _tdlType(0), _sampleRate(0), _dataLength(0), - _samples(0) { - setPduType(31); -} - -IntercomSignalPdu::~IntercomSignalPdu() { _data.clear(); } - -EntityID &IntercomSignalPdu::getEntityID() { return _entityID; } - -const EntityID &IntercomSignalPdu::getEntityID() const { return _entityID; } - -void IntercomSignalPdu::setEntityID(const EntityID &pX) { _entityID = pX; } - -unsigned short IntercomSignalPdu::getCommunicationsDeviceID() const { - return _communicationsDeviceID; -} - -void IntercomSignalPdu::setCommunicationsDeviceID(unsigned short pX) { - _communicationsDeviceID = pX; -} - -unsigned short IntercomSignalPdu::getEncodingScheme() const { - return _encodingScheme; -} - -void IntercomSignalPdu::setEncodingScheme(unsigned short pX) { - _encodingScheme = pX; -} - -unsigned short IntercomSignalPdu::getTdlType() const { return _tdlType; } - -void IntercomSignalPdu::setTdlType(unsigned short pX) { _tdlType = pX; } - -unsigned int IntercomSignalPdu::getSampleRate() const { return _sampleRate; } - -void IntercomSignalPdu::setSampleRate(unsigned int pX) { _sampleRate = pX; } - -unsigned short IntercomSignalPdu::getDataLength() const { return _data.size(); } - -unsigned short IntercomSignalPdu::getSamples() const { return _samples; } - -void IntercomSignalPdu::setSamples(unsigned short pX) { _samples = pX; } - -std::vector &IntercomSignalPdu::getData() { return _data; } - -const std::vector &IntercomSignalPdu::getData() const { - return _data; -} - -void IntercomSignalPdu::setData(const std::vector &pX) { - _data = pX; -} - -void IntercomSignalPdu::marshal(DataStream &dataStream) const { - RadioCommunicationsFamilyPdu::marshal( - dataStream); // Marshal information in superclass first - _entityID.marshal(dataStream); - dataStream << _communicationsDeviceID; - dataStream << _encodingScheme; - dataStream << _tdlType; - dataStream << _sampleRate; - dataStream << (unsigned short)_data.size(); - dataStream << _samples; - - for (auto &byte : _data) { - dataStream << byte; - } -} - -void IntercomSignalPdu::unmarshal(DataStream &dataStream) { - RadioCommunicationsFamilyPdu::unmarshal( - dataStream); // unmarshal information in superclass first - _entityID.unmarshal(dataStream); - dataStream >> _communicationsDeviceID; - dataStream >> _encodingScheme; - dataStream >> _tdlType; - dataStream >> _sampleRate; - dataStream >> _dataLength; - dataStream >> _samples; - - _data.clear(); - for (auto idx = 0; idx < _dataLength; idx++) { - uint8_t x; - dataStream >> x; - _data.push_back(x); - } -} - -bool IntercomSignalPdu::operator==(const IntercomSignalPdu &rhs) const { - bool ivarsEqual = true; - - ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); - - if (!(_entityID == rhs._entityID)) - ivarsEqual = false; - if (!(_communicationsDeviceID == rhs._communicationsDeviceID)) - ivarsEqual = false; - if (!(_encodingScheme == rhs._encodingScheme)) - ivarsEqual = false; - if (!(_tdlType == rhs._tdlType)) - ivarsEqual = false; - if (!(_sampleRate == rhs._sampleRate)) - ivarsEqual = false; - if (!(_samples == rhs._samples)) - ivarsEqual = false; - - for (size_t idx = 0; idx < _data.size(); idx++) { - if (!(_data[idx] == rhs._data[idx])) - ivarsEqual = false; - } - - return ivarsEqual; -} - -int IntercomSignalPdu::getMarshalledSize() const { - int marshalSize = 0; - - marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); - marshalSize += _entityID.getMarshalledSize(); // _entityID - marshalSize += 2; // _communicationsDeviceID - marshalSize += 2; // _encodingScheme - marshalSize += 2; // _tdlType - marshalSize += 4; // _sampleRate - marshalSize += 2; // _dataLength - marshalSize += 2; // _samples - marshalSize += _data.size(); - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IntercomSignalPdu.h b/src/dis7/IntercomSignalPdu.h deleted file mode 100644 index 5468f071..00000000 --- a/src/dis7/IntercomSignalPdu.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -namespace DIS { -// Actual transmission of intercome voice data. Section 7.7.5. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All -// rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT IntercomSignalPdu : public RadioCommunicationsFamilyPdu { -protected: - /** entity ID */ - EntityID _entityID; - - /** ID of communications device */ - unsigned short _communicationsDeviceID; - - /** encoding scheme */ - unsigned short _encodingScheme; - - /** tactical data link type */ - unsigned short _tdlType; - - /** sample rate */ - unsigned int _sampleRate; - - /** data length */ - unsigned short _dataLength; - - /** samples */ - unsigned short _samples; - - /** data bytes */ - std::vector _data; - -public: - IntercomSignalPdu(); - virtual ~IntercomSignalPdu(); - - virtual void marshal(DataStream &dataStream) const; - virtual void unmarshal(DataStream &dataStream); - - EntityID &getEntityID(); - const EntityID &getEntityID() const; - void setEntityID(const EntityID &pX); - - unsigned short getCommunicationsDeviceID() const; - void setCommunicationsDeviceID(unsigned short pX); - - unsigned short getEncodingScheme() const; - void setEncodingScheme(unsigned short pX); - - unsigned short getTdlType() const; - void setTdlType(unsigned short pX); - - unsigned int getSampleRate() const; - void setSampleRate(unsigned int pX); - - unsigned short getDataLength() const; - - unsigned short getSamples() const; - void setSamples(unsigned short pX); - - std::vector &getData(); - const std::vector &getData() const; - void setData(const std::vector &pX); - - virtual int getMarshalledSize() const; - - bool operator==(const IntercomSignalPdu &rhs) const; -}; -} // namespace DIS - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IsPartOfPdu.cpp b/src/dis7/IsPartOfPdu.cpp deleted file mode 100644 index f4066748..00000000 --- a/src/dis7/IsPartOfPdu.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include - -using namespace DIS; - - -IsPartOfPdu::IsPartOfPdu() : EntityManagementFamilyPdu(), - _orginatingEntityID(), - _receivingEntityID(), - _relationship(), - _partLocation(), - _namedLocationID(), - _partEntityType() -{ - setPduType( 36 ); -} - -IsPartOfPdu::~IsPartOfPdu() -{ -} - -EntityID& IsPartOfPdu::getOrginatingEntityID() -{ - return _orginatingEntityID; -} - -const EntityID& IsPartOfPdu::getOrginatingEntityID() const -{ - return _orginatingEntityID; -} - -void IsPartOfPdu::setOrginatingEntityID(const EntityID &pX) -{ - _orginatingEntityID = pX; -} - -EntityID& IsPartOfPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& IsPartOfPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void IsPartOfPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -Relationship& IsPartOfPdu::getRelationship() -{ - return _relationship; -} - -const Relationship& IsPartOfPdu::getRelationship() const -{ - return _relationship; -} - -void IsPartOfPdu::setRelationship(const Relationship &pX) -{ - _relationship = pX; -} - -Vector3Float& IsPartOfPdu::getPartLocation() -{ - return _partLocation; -} - -const Vector3Float& IsPartOfPdu::getPartLocation() const -{ - return _partLocation; -} - -void IsPartOfPdu::setPartLocation(const Vector3Float &pX) -{ - _partLocation = pX; -} - -NamedLocationIdentification& IsPartOfPdu::getNamedLocationID() -{ - return _namedLocationID; -} - -const NamedLocationIdentification& IsPartOfPdu::getNamedLocationID() const -{ - return _namedLocationID; -} - -void IsPartOfPdu::setNamedLocationID(const NamedLocationIdentification &pX) -{ - _namedLocationID = pX; -} - -EntityType& IsPartOfPdu::getPartEntityType() -{ - return _partEntityType; -} - -const EntityType& IsPartOfPdu::getPartEntityType() const -{ - return _partEntityType; -} - -void IsPartOfPdu::setPartEntityType(const EntityType &pX) -{ - _partEntityType = pX; -} - -void IsPartOfPdu::marshal(DataStream& dataStream) const -{ - EntityManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _orginatingEntityID.marshal(dataStream); - _receivingEntityID.marshal(dataStream); - _relationship.marshal(dataStream); - _partLocation.marshal(dataStream); - _namedLocationID.marshal(dataStream); - _partEntityType.marshal(dataStream); -} - -void IsPartOfPdu::unmarshal(DataStream& dataStream) -{ - EntityManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _orginatingEntityID.unmarshal(dataStream); - _receivingEntityID.unmarshal(dataStream); - _relationship.unmarshal(dataStream); - _partLocation.unmarshal(dataStream); - _namedLocationID.unmarshal(dataStream); - _partEntityType.unmarshal(dataStream); -} - - -bool IsPartOfPdu::operator ==(const IsPartOfPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); - - if( ! (_orginatingEntityID == rhs._orginatingEntityID) ) ivarsEqual = false; - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_relationship == rhs._relationship) ) ivarsEqual = false; - if( ! (_partLocation == rhs._partLocation) ) ivarsEqual = false; - if( ! (_namedLocationID == rhs._namedLocationID) ) ivarsEqual = false; - if( ! (_partEntityType == rhs._partEntityType) ) ivarsEqual = false; - - return ivarsEqual; - } - -int IsPartOfPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _relationship.getMarshalledSize(); // _relationship - marshalSize = marshalSize + _partLocation.getMarshalledSize(); // _partLocation - marshalSize = marshalSize + _namedLocationID.getMarshalledSize(); // _namedLocationID - marshalSize = marshalSize + _partEntityType.getMarshalledSize(); // _partEntityType - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/IsPartOfPdu.h b/src/dis7/IsPartOfPdu.h deleted file mode 100644 index 25b2f80d..00000000 --- a/src/dis7/IsPartOfPdu.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// The joining of two or more simulation entities is communicated by this PDU. Section 7.8.5 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT IsPartOfPdu : public EntityManagementFamilyPdu -{ -protected: - /** ID of entity originating PDU */ - EntityID _orginatingEntityID; - - /** ID of entity receiving PDU */ - EntityID _receivingEntityID; - - /** relationship of joined parts */ - Relationship _relationship; - - /** location of part; centroid of part in host's coordinate system. x=range, y=bearing, z=0 */ - Vector3Float _partLocation; - - /** named location */ - NamedLocationIdentification _namedLocationID; - - /** entity type */ - EntityType _partEntityType; - - - public: - IsPartOfPdu(); - virtual ~IsPartOfPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOrginatingEntityID(); - const EntityID& getOrginatingEntityID() const; - void setOrginatingEntityID(const EntityID &pX); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - Relationship& getRelationship(); - const Relationship& getRelationship() const; - void setRelationship(const Relationship &pX); - - Vector3Float& getPartLocation(); - const Vector3Float& getPartLocation() const; - void setPartLocation(const Vector3Float &pX); - - NamedLocationIdentification& getNamedLocationID(); - const NamedLocationIdentification& getNamedLocationID() const; - void setNamedLocationID(const NamedLocationIdentification &pX); - - EntityType& getPartEntityType(); - const EntityType& getPartEntityType() const; - void setPartEntityType(const EntityType &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const IsPartOfPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/JammingTechnique.cpp b/src/dis7/JammingTechnique.cpp deleted file mode 100644 index cf7a459c..00000000 --- a/src/dis7/JammingTechnique.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -JammingTechnique::JammingTechnique(): - _kind(0), - _category(0), - _subcategory(0), - _specific(0) -{ -} - -JammingTechnique::~JammingTechnique() -{ -} - -unsigned char JammingTechnique::getKind() const -{ - return _kind; -} - -void JammingTechnique::setKind(unsigned char pX) -{ - _kind = pX; -} - -unsigned char JammingTechnique::getCategory() const -{ - return _category; -} - -void JammingTechnique::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char JammingTechnique::getSubcategory() const -{ - return _subcategory; -} - -void JammingTechnique::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char JammingTechnique::getSpecific() const -{ - return _specific; -} - -void JammingTechnique::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -void JammingTechnique::marshal(DataStream& dataStream) const -{ - dataStream << _kind; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; -} - -void JammingTechnique::unmarshal(DataStream& dataStream) -{ - dataStream >> _kind; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; -} - - -bool JammingTechnique::operator ==(const JammingTechnique& rhs) const - { - bool ivarsEqual = true; - - if( ! (_kind == rhs._kind) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - - return ivarsEqual; - } - -int JammingTechnique::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _kind - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/JammingTechnique.h b/src/dis7/JammingTechnique.h deleted file mode 100644 index d8c5cbf9..00000000 --- a/src/dis7/JammingTechnique.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Jamming technique. Section 6.2.50 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT JammingTechnique -{ -protected: - unsigned char _kind; - - unsigned char _category; - - unsigned char _subcategory; - - unsigned char _specific; - - - public: - JammingTechnique(); - virtual ~JammingTechnique(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getKind() const; - void setKind(unsigned char pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const JammingTechnique& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LaunchedMunitionRecord.cpp b/src/dis7/LaunchedMunitionRecord.cpp deleted file mode 100644 index 0d5551c4..00000000 --- a/src/dis7/LaunchedMunitionRecord.cpp +++ /dev/null @@ -1,192 +0,0 @@ -#include - -using namespace DIS; - - -LaunchedMunitionRecord::LaunchedMunitionRecord(): - _fireEventID(), - _padding(0), - _firingEntityID(), - _padding2(0), - _targetEntityID(), - _padding3(0), - _targetLocation() -{ -} - -LaunchedMunitionRecord::~LaunchedMunitionRecord() -{ -} - -EventIdentifier& LaunchedMunitionRecord::getFireEventID() -{ - return _fireEventID; -} - -const EventIdentifier& LaunchedMunitionRecord::getFireEventID() const -{ - return _fireEventID; -} - -void LaunchedMunitionRecord::setFireEventID(const EventIdentifier &pX) -{ - _fireEventID = pX; -} - -unsigned short LaunchedMunitionRecord::getPadding() const -{ - return _padding; -} - -void LaunchedMunitionRecord::setPadding(unsigned short pX) -{ - _padding = pX; -} - -EventIdentifier& LaunchedMunitionRecord::getFiringEntityID() -{ - return _firingEntityID; -} - -const EventIdentifier& LaunchedMunitionRecord::getFiringEntityID() const -{ - return _firingEntityID; -} - -void LaunchedMunitionRecord::setFiringEntityID(const EventIdentifier &pX) -{ - _firingEntityID = pX; -} - -unsigned short LaunchedMunitionRecord::getPadding2() const -{ - return _padding2; -} - -void LaunchedMunitionRecord::setPadding2(unsigned short pX) -{ - _padding2 = pX; -} - -EventIdentifier& LaunchedMunitionRecord::getTargetEntityID() -{ - return _targetEntityID; -} - -const EventIdentifier& LaunchedMunitionRecord::getTargetEntityID() const -{ - return _targetEntityID; -} - -void LaunchedMunitionRecord::setTargetEntityID(const EventIdentifier &pX) -{ - _targetEntityID = pX; -} - -unsigned short LaunchedMunitionRecord::getPadding3() const -{ - return _padding3; -} - -void LaunchedMunitionRecord::setPadding3(unsigned short pX) -{ - _padding3 = pX; -} - -Vector3Double& LaunchedMunitionRecord::getTargetLocation() -{ - return _targetLocation; -} - -const Vector3Double& LaunchedMunitionRecord::getTargetLocation() const -{ - return _targetLocation; -} - -void LaunchedMunitionRecord::setTargetLocation(const Vector3Double &pX) -{ - _targetLocation = pX; -} - -void LaunchedMunitionRecord::marshal(DataStream& dataStream) const -{ - _fireEventID.marshal(dataStream); - dataStream << _padding; - _firingEntityID.marshal(dataStream); - dataStream << _padding2; - _targetEntityID.marshal(dataStream); - dataStream << _padding3; - _targetLocation.marshal(dataStream); -} - -void LaunchedMunitionRecord::unmarshal(DataStream& dataStream) -{ - _fireEventID.unmarshal(dataStream); - dataStream >> _padding; - _firingEntityID.unmarshal(dataStream); - dataStream >> _padding2; - _targetEntityID.unmarshal(dataStream); - dataStream >> _padding3; - _targetLocation.unmarshal(dataStream); -} - - -bool LaunchedMunitionRecord::operator ==(const LaunchedMunitionRecord& rhs) const - { - bool ivarsEqual = true; - - if( ! (_fireEventID == rhs._fireEventID) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - if( ! (_firingEntityID == rhs._firingEntityID) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_targetEntityID == rhs._targetEntityID) ) ivarsEqual = false; - if( ! (_padding3 == rhs._padding3) ) ivarsEqual = false; - if( ! (_targetLocation == rhs._targetLocation) ) ivarsEqual = false; - - return ivarsEqual; - } - -int LaunchedMunitionRecord::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _fireEventID.getMarshalledSize(); // _fireEventID - marshalSize = marshalSize + 2; // _padding - marshalSize = marshalSize + _firingEntityID.getMarshalledSize(); // _firingEntityID - marshalSize = marshalSize + 2; // _padding2 - marshalSize = marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID - marshalSize = marshalSize + 2; // _padding3 - marshalSize = marshalSize + _targetLocation.getMarshalledSize(); // _targetLocation - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LaunchedMunitionRecord.h b/src/dis7/LaunchedMunitionRecord.h deleted file mode 100644 index abe45a7a..00000000 --- a/src/dis7/LaunchedMunitionRecord.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Identity of a communications node. Section 6.2.51 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT LaunchedMunitionRecord -{ -protected: - EventIdentifier _fireEventID; - - unsigned short _padding; - - EventIdentifier _firingEntityID; - - unsigned short _padding2; - - EventIdentifier _targetEntityID; - - unsigned short _padding3; - - Vector3Double _targetLocation; - - - public: - LaunchedMunitionRecord(); - virtual ~LaunchedMunitionRecord(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EventIdentifier& getFireEventID(); - const EventIdentifier& getFireEventID() const; - void setFireEventID(const EventIdentifier &pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - EventIdentifier& getFiringEntityID(); - const EventIdentifier& getFiringEntityID() const; - void setFiringEntityID(const EventIdentifier &pX); - - unsigned short getPadding2() const; - void setPadding2(unsigned short pX); - - EventIdentifier& getTargetEntityID(); - const EventIdentifier& getTargetEntityID() const; - void setTargetEntityID(const EventIdentifier &pX); - - unsigned short getPadding3() const; - void setPadding3(unsigned short pX); - - Vector3Double& getTargetLocation(); - const Vector3Double& getTargetLocation() const; - void setTargetLocation(const Vector3Double &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LaunchedMunitionRecord& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LayerHeader.cpp b/src/dis7/LayerHeader.cpp deleted file mode 100644 index 17891240..00000000 --- a/src/dis7/LayerHeader.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -LayerHeader::LayerHeader(): - _layerNumber(0), - _layerSpecificInformation(0), - _length(0) -{ -} - -LayerHeader::~LayerHeader() -{ -} - -unsigned char LayerHeader::getLayerNumber() const -{ - return _layerNumber; -} - -void LayerHeader::setLayerNumber(unsigned char pX) -{ - _layerNumber = pX; -} - -unsigned char LayerHeader::getLayerSpecificInformation() const -{ - return _layerSpecificInformation; -} - -void LayerHeader::setLayerSpecificInformation(unsigned char pX) -{ - _layerSpecificInformation = pX; -} - -unsigned short LayerHeader::getLength() const -{ - return _length; -} - -void LayerHeader::setLength(unsigned short pX) -{ - _length = pX; -} - -void LayerHeader::marshal(DataStream& dataStream) const -{ - dataStream << _layerNumber; - dataStream << _layerSpecificInformation; - dataStream << _length; -} - -void LayerHeader::unmarshal(DataStream& dataStream) -{ - dataStream >> _layerNumber; - dataStream >> _layerSpecificInformation; - dataStream >> _length; -} - - -bool LayerHeader::operator ==(const LayerHeader& rhs) const - { - bool ivarsEqual = true; - - if( ! (_layerNumber == rhs._layerNumber) ) ivarsEqual = false; - if( ! (_layerSpecificInformation == rhs._layerSpecificInformation) ) ivarsEqual = false; - if( ! (_length == rhs._length) ) ivarsEqual = false; - - return ivarsEqual; - } - -int LayerHeader::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _layerNumber - marshalSize = marshalSize + 1; // _layerSpecificInformation - marshalSize = marshalSize + 2; // _length - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LayerHeader.h b/src/dis7/LayerHeader.h deleted file mode 100644 index 554fc598..00000000 --- a/src/dis7/LayerHeader.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The identification of the additional information layer number, layer-specific information, and the length of the layer. Section 6.2.52 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT LayerHeader -{ -protected: - unsigned char _layerNumber; - - /** field shall specify layer-specific information that varies by System Type (see 6.2.86) and Layer Number. */ - unsigned char _layerSpecificInformation; - - /** This field shall specify the length in octets of the layer, including the Layer Header record */ - unsigned short _length; - - - public: - LayerHeader(); - virtual ~LayerHeader(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getLayerNumber() const; - void setLayerNumber(unsigned char pX); - - unsigned char getLayerSpecificInformation() const; - void setLayerSpecificInformation(unsigned char pX); - - unsigned short getLength() const; - void setLength(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LayerHeader& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LinearObjectStatePdu.cpp b/src/dis7/LinearObjectStatePdu.cpp deleted file mode 100644 index 51fab8da..00000000 --- a/src/dis7/LinearObjectStatePdu.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include - -using namespace DIS; - - -LinearObjectStatePdu::LinearObjectStatePdu() : SyntheticEnvironmentFamilyPdu(), - _objectID(), - _referencedObjectID(), - _updateNumber(0), - _forceID(0), - _numberOfSegments(0), - _requesterID(), - _receivingID(), - _objectType() -{ - setPduType( 44 ); -} - -LinearObjectStatePdu::~LinearObjectStatePdu() -{ - _linearSegmentParameters.clear(); -} - -EntityID& LinearObjectStatePdu::getObjectID() -{ - return _objectID; -} - -const EntityID& LinearObjectStatePdu::getObjectID() const -{ - return _objectID; -} - -void LinearObjectStatePdu::setObjectID(const EntityID &pX) -{ - _objectID = pX; -} - -EntityID& LinearObjectStatePdu::getReferencedObjectID() -{ - return _referencedObjectID; -} - -const EntityID& LinearObjectStatePdu::getReferencedObjectID() const -{ - return _referencedObjectID; -} - -void LinearObjectStatePdu::setReferencedObjectID(const EntityID &pX) -{ - _referencedObjectID = pX; -} - -unsigned short LinearObjectStatePdu::getUpdateNumber() const -{ - return _updateNumber; -} - -void LinearObjectStatePdu::setUpdateNumber(unsigned short pX) -{ - _updateNumber = pX; -} - -unsigned char LinearObjectStatePdu::getForceID() const -{ - return _forceID; -} - -void LinearObjectStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char LinearObjectStatePdu::getNumberOfSegments() const -{ - return _linearSegmentParameters.size(); -} - -SimulationAddress& LinearObjectStatePdu::getRequesterID() -{ - return _requesterID; -} - -const SimulationAddress& LinearObjectStatePdu::getRequesterID() const -{ - return _requesterID; -} - -void LinearObjectStatePdu::setRequesterID(const SimulationAddress &pX) -{ - _requesterID = pX; -} - -SimulationAddress& LinearObjectStatePdu::getReceivingID() -{ - return _receivingID; -} - -const SimulationAddress& LinearObjectStatePdu::getReceivingID() const -{ - return _receivingID; -} - -void LinearObjectStatePdu::setReceivingID(const SimulationAddress &pX) -{ - _receivingID = pX; -} - -ObjectType& LinearObjectStatePdu::getObjectType() -{ - return _objectType; -} - -const ObjectType& LinearObjectStatePdu::getObjectType() const -{ - return _objectType; -} - -void LinearObjectStatePdu::setObjectType(const ObjectType &pX) -{ - _objectType = pX; -} - -std::vector& LinearObjectStatePdu::getLinearSegmentParameters() -{ - return _linearSegmentParameters; -} - -const std::vector& LinearObjectStatePdu::getLinearSegmentParameters() const -{ - return _linearSegmentParameters; -} - -void LinearObjectStatePdu::setLinearSegmentParameters(const std::vector& pX) -{ - _linearSegmentParameters = pX; -} - -void LinearObjectStatePdu::marshal(DataStream& dataStream) const -{ - SyntheticEnvironmentFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _objectID.marshal(dataStream); - _referencedObjectID.marshal(dataStream); - dataStream << _updateNumber; - dataStream << _forceID; - dataStream << ( unsigned char )_linearSegmentParameters.size(); - _requesterID.marshal(dataStream); - _receivingID.marshal(dataStream); - _objectType.marshal(dataStream); - - for(size_t idx = 0; idx < _linearSegmentParameters.size(); idx++) - { - LinearSegmentParameter x = _linearSegmentParameters[idx]; - x.marshal(dataStream); - } - -} - -void LinearObjectStatePdu::unmarshal(DataStream& dataStream) -{ - SyntheticEnvironmentFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _objectID.unmarshal(dataStream); - _referencedObjectID.unmarshal(dataStream); - dataStream >> _updateNumber; - dataStream >> _forceID; - dataStream >> _numberOfSegments; - _requesterID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - _objectType.unmarshal(dataStream); - - _linearSegmentParameters.clear(); - for(size_t idx = 0; idx < _numberOfSegments; idx++) - { - LinearSegmentParameter x; - x.unmarshal(dataStream); - _linearSegmentParameters.push_back(x); - } -} - - -bool LinearObjectStatePdu::operator ==(const LinearObjectStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); - - if( ! (_objectID == rhs._objectID) ) ivarsEqual = false; - if( ! (_referencedObjectID == rhs._referencedObjectID) ) ivarsEqual = false; - if( ! (_updateNumber == rhs._updateNumber) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_requesterID == rhs._requesterID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_objectType == rhs._objectType) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _linearSegmentParameters.size(); idx++) - { - if( ! ( _linearSegmentParameters[idx] == rhs._linearSegmentParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int LinearObjectStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID - marshalSize = marshalSize + _referencedObjectID.getMarshalledSize(); // _referencedObjectID - marshalSize = marshalSize + 2; // _updateNumber - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _numberOfSegments - marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType - - for(unsigned long long idx=0; idx < _linearSegmentParameters.size(); idx++) - { - LinearSegmentParameter listElement = _linearSegmentParameters[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LinearObjectStatePdu.h b/src/dis7/LinearObjectStatePdu.h deleted file mode 100644 index 46167f6c..00000000 --- a/src/dis7/LinearObjectStatePdu.h +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// : Information abut the addition or modification of a synthecic enviroment object that is anchored to the terrain with a single point and has size or orientation. Section 7.10.5 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT LinearObjectStatePdu : public SyntheticEnvironmentFamilyPdu -{ -protected: - /** Object in synthetic environment */ - EntityID _objectID; - - /** Object with which this point object is associated */ - EntityID _referencedObjectID; - - /** unique update number of each state transition of an object */ - unsigned short _updateNumber; - - /** force ID */ - unsigned char _forceID; - - /** number of linear segment parameters */ - unsigned char _numberOfSegments; - - /** requesterID */ - SimulationAddress _requesterID; - - /** receiver ID */ - SimulationAddress _receivingID; - - /** Object type */ - ObjectType _objectType; - - /** Linear segment parameters */ - std::vector _linearSegmentParameters; - - - public: - LinearObjectStatePdu(); - virtual ~LinearObjectStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getObjectID(); - const EntityID& getObjectID() const; - void setObjectID(const EntityID &pX); - - EntityID& getReferencedObjectID(); - const EntityID& getReferencedObjectID() const; - void setReferencedObjectID(const EntityID &pX); - - unsigned short getUpdateNumber() const; - void setUpdateNumber(unsigned short pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getNumberOfSegments() const; - - SimulationAddress& getRequesterID(); - const SimulationAddress& getRequesterID() const; - void setRequesterID(const SimulationAddress &pX); - - SimulationAddress& getReceivingID(); - const SimulationAddress& getReceivingID() const; - void setReceivingID(const SimulationAddress &pX); - - ObjectType& getObjectType(); - const ObjectType& getObjectType() const; - void setObjectType(const ObjectType &pX); - - std::vector& getLinearSegmentParameters(); - const std::vector& getLinearSegmentParameters() const; - void setLinearSegmentParameters(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LinearObjectStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LinearSegmentParameter.cpp b/src/dis7/LinearSegmentParameter.cpp deleted file mode 100644 index 742f75e6..00000000 --- a/src/dis7/LinearSegmentParameter.cpp +++ /dev/null @@ -1,227 +0,0 @@ -#include - -using namespace DIS; - - -LinearSegmentParameter::LinearSegmentParameter(): - _segmentNumber(0), - _segmentModification(0), - _generalSegmentAppearance(0), - _specificSegmentAppearance(0), - _segmentLocation(), - _segmentOrientation(), - _segmentLength(0), - _segmentWidth(0), - _segmentHeight(0), - _segmentDepth(0) -{ -} - -LinearSegmentParameter::~LinearSegmentParameter() -{ -} - -unsigned char LinearSegmentParameter::getSegmentNumber() const -{ - return _segmentNumber; -} - -void LinearSegmentParameter::setSegmentNumber(unsigned char pX) -{ - _segmentNumber = pX; -} - -unsigned char LinearSegmentParameter::getSegmentModification() const -{ - return _segmentModification; -} - -void LinearSegmentParameter::setSegmentModification(unsigned char pX) -{ - _segmentModification = pX; -} - -unsigned short LinearSegmentParameter::getGeneralSegmentAppearance() const -{ - return _generalSegmentAppearance; -} - -void LinearSegmentParameter::setGeneralSegmentAppearance(unsigned short pX) -{ - _generalSegmentAppearance = pX; -} - -unsigned short LinearSegmentParameter::getSpecificSegmentAppearance() const -{ - return _specificSegmentAppearance; -} - -void LinearSegmentParameter::setSpecificSegmentAppearance(unsigned short pX) -{ - _specificSegmentAppearance = pX; -} - -Vector3Double& LinearSegmentParameter::getSegmentLocation() -{ - return _segmentLocation; -} - -const Vector3Double& LinearSegmentParameter::getSegmentLocation() const -{ - return _segmentLocation; -} - -void LinearSegmentParameter::setSegmentLocation(const Vector3Double &pX) -{ - _segmentLocation = pX; -} - -EulerAngles& LinearSegmentParameter::getSegmentOrientation() -{ - return _segmentOrientation; -} - -const EulerAngles& LinearSegmentParameter::getSegmentOrientation() const -{ - return _segmentOrientation; -} - -void LinearSegmentParameter::setSegmentOrientation(const EulerAngles &pX) -{ - _segmentOrientation = pX; -} - -unsigned short LinearSegmentParameter::getSegmentLength() const -{ - return _segmentLength; -} - -void LinearSegmentParameter::setSegmentLength(unsigned short pX) -{ - _segmentLength = pX; -} - -unsigned short LinearSegmentParameter::getSegmentWidth() const -{ - return _segmentWidth; -} - -void LinearSegmentParameter::setSegmentWidth(unsigned short pX) -{ - _segmentWidth = pX; -} - -unsigned short LinearSegmentParameter::getSegmentHeight() const -{ - return _segmentHeight; -} - -void LinearSegmentParameter::setSegmentHeight(unsigned short pX) -{ - _segmentHeight = pX; -} - -unsigned short LinearSegmentParameter::getSegmentDepth() const -{ - return _segmentDepth; -} - -void LinearSegmentParameter::setSegmentDepth(unsigned short pX) -{ - _segmentDepth = pX; -} - -void LinearSegmentParameter::marshal(DataStream& dataStream) const -{ - dataStream << _segmentNumber; - dataStream << _segmentModification; - dataStream << _generalSegmentAppearance; - dataStream << _specificSegmentAppearance; - _segmentLocation.marshal(dataStream); - _segmentOrientation.marshal(dataStream); - dataStream << _segmentLength; - dataStream << _segmentWidth; - dataStream << _segmentHeight; - dataStream << _segmentDepth; -} - -void LinearSegmentParameter::unmarshal(DataStream& dataStream) -{ - dataStream >> _segmentNumber; - dataStream >> _segmentModification; - dataStream >> _generalSegmentAppearance; - dataStream >> _specificSegmentAppearance; - _segmentLocation.unmarshal(dataStream); - _segmentOrientation.unmarshal(dataStream); - dataStream >> _segmentLength; - dataStream >> _segmentWidth; - dataStream >> _segmentHeight; - dataStream >> _segmentDepth; -} - - -bool LinearSegmentParameter::operator ==(const LinearSegmentParameter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_segmentNumber == rhs._segmentNumber) ) ivarsEqual = false; - if( ! (_segmentModification == rhs._segmentModification) ) ivarsEqual = false; - if( ! (_generalSegmentAppearance == rhs._generalSegmentAppearance) ) ivarsEqual = false; - if( ! (_specificSegmentAppearance == rhs._specificSegmentAppearance) ) ivarsEqual = false; - if( ! (_segmentLocation == rhs._segmentLocation) ) ivarsEqual = false; - if( ! (_segmentOrientation == rhs._segmentOrientation) ) ivarsEqual = false; - if( ! (_segmentLength == rhs._segmentLength) ) ivarsEqual = false; - if( ! (_segmentWidth == rhs._segmentWidth) ) ivarsEqual = false; - if( ! (_segmentHeight == rhs._segmentHeight) ) ivarsEqual = false; - if( ! (_segmentDepth == rhs._segmentDepth) ) ivarsEqual = false; - - return ivarsEqual; - } - -int LinearSegmentParameter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _segmentNumber - marshalSize = marshalSize + 1; // _segmentModification - marshalSize = marshalSize + 2; // _generalSegmentAppearance - marshalSize = marshalSize + 2; // _specificSegmentAppearance - marshalSize = marshalSize + _segmentLocation.getMarshalledSize(); // _segmentLocation - marshalSize = marshalSize + _segmentOrientation.getMarshalledSize(); // _segmentOrientation - marshalSize = marshalSize + 2; // _segmentLength - marshalSize = marshalSize + 2; // _segmentWidth - marshalSize = marshalSize + 2; // _segmentHeight - marshalSize = marshalSize + 2; // _segmentDepth - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LinearSegmentParameter.h b/src/dis7/LinearSegmentParameter.h deleted file mode 100644 index 04b0d41f..00000000 --- a/src/dis7/LinearSegmentParameter.h +++ /dev/null @@ -1,126 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// The specification of an individual segment of a linear segment synthetic environment object in a Linear Object State PDU Section 6.2.53 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT LinearSegmentParameter -{ -protected: - /** the individual segment of the linear segment */ - unsigned char _segmentNumber; - - /** whether a modification has been made to the point object’s location or orientation */ - unsigned char _segmentModification; - - /** general dynamic appearance attributes of the segment. This record shall be defined as a 16-bit record of enumerations. The values defined for this record are included in Section 12 of SISO-REF-010. */ - unsigned short _generalSegmentAppearance; - - /** This field shall specify specific dynamic appearance attributes of the segment. This record shall be defined as a 32-bit record of enumerations. */ - unsigned short _specificSegmentAppearance; - - /** This field shall specify the location of the linear segment in the simulated world and shall be represented by a World Coordinates record */ - Vector3Double _segmentLocation; - - /** orientation of the linear segment about the segment location and shall be represented by a Euler Angles record */ - EulerAngles _segmentOrientation; - - /** length of the linear segment, in meters, extending in the positive X direction */ - unsigned short _segmentLength; - - /** The total width of the linear segment, in meters, shall be specified by a 16-bit unsigned integer. One-half of the width shall extend in the positive Y direction, and one-half of the width shall extend in the negative Y direction. */ - unsigned short _segmentWidth; - - /** The height of the linear segment, in meters, above ground shall be specified by a 16-bit unsigned integer. */ - unsigned short _segmentHeight; - - /** The depth of the linear segment, in meters, below ground level */ - unsigned short _segmentDepth; - - - public: - LinearSegmentParameter(); - virtual ~LinearSegmentParameter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getSegmentNumber() const; - void setSegmentNumber(unsigned char pX); - - unsigned char getSegmentModification() const; - void setSegmentModification(unsigned char pX); - - unsigned short getGeneralSegmentAppearance() const; - void setGeneralSegmentAppearance(unsigned short pX); - - unsigned short getSpecificSegmentAppearance() const; - void setSpecificSegmentAppearance(unsigned short pX); - - Vector3Double& getSegmentLocation(); - const Vector3Double& getSegmentLocation() const; - void setSegmentLocation(const Vector3Double &pX); - - EulerAngles& getSegmentOrientation(); - const EulerAngles& getSegmentOrientation() const; - void setSegmentOrientation(const EulerAngles &pX); - - unsigned short getSegmentLength() const; - void setSegmentLength(unsigned short pX); - - unsigned short getSegmentWidth() const; - void setSegmentWidth(unsigned short pX); - - unsigned short getSegmentHeight() const; - void setSegmentHeight(unsigned short pX); - - unsigned short getSegmentDepth() const; - void setSegmentDepth(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LinearSegmentParameter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LiveEntityIdentifier.cpp b/src/dis7/LiveEntityIdentifier.cpp deleted file mode 100644 index 493c720b..00000000 --- a/src/dis7/LiveEntityIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -LiveEntityIdentifier::LiveEntityIdentifier(): - _liveSimulationAddress(), - _entityNumber(0) -{ -} - -LiveEntityIdentifier::~LiveEntityIdentifier() -{ -} - -LiveSimulationAddress& LiveEntityIdentifier::getLiveSimulationAddress() -{ - return _liveSimulationAddress; -} - -const LiveSimulationAddress& LiveEntityIdentifier::getLiveSimulationAddress() const -{ - return _liveSimulationAddress; -} - -void LiveEntityIdentifier::setLiveSimulationAddress(const LiveSimulationAddress &pX) -{ - _liveSimulationAddress = pX; -} - -unsigned short LiveEntityIdentifier::getEntityNumber() const -{ - return _entityNumber; -} - -void LiveEntityIdentifier::setEntityNumber(unsigned short pX) -{ - _entityNumber = pX; -} - -void LiveEntityIdentifier::marshal(DataStream& dataStream) const -{ - _liveSimulationAddress.marshal(dataStream); - dataStream << _entityNumber; -} - -void LiveEntityIdentifier::unmarshal(DataStream& dataStream) -{ - _liveSimulationAddress.unmarshal(dataStream); - dataStream >> _entityNumber; -} - - -bool LiveEntityIdentifier::operator ==(const LiveEntityIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_liveSimulationAddress == rhs._liveSimulationAddress) ) ivarsEqual = false; - if( ! (_entityNumber == rhs._entityNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int LiveEntityIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _liveSimulationAddress.getMarshalledSize(); // _liveSimulationAddress - marshalSize = marshalSize + 2; // _entityNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LiveEntityIdentifier.h b/src/dis7/LiveEntityIdentifier.h deleted file mode 100644 index d80bc27b..00000000 --- a/src/dis7/LiveEntityIdentifier.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// The unique designation of each entity in an event or exercise that is contained in a Live Entity PDU. Section 6.2.54 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT LiveEntityIdentifier -{ -protected: - /** Live Simulation Address record (see 6.2.55) */ - LiveSimulationAddress _liveSimulationAddress; - - /** Live entity number */ - unsigned short _entityNumber; - - - public: - LiveEntityIdentifier(); - virtual ~LiveEntityIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - LiveSimulationAddress& getLiveSimulationAddress(); - const LiveSimulationAddress& getLiveSimulationAddress() const; - void setLiveSimulationAddress(const LiveSimulationAddress &pX); - - unsigned short getEntityNumber() const; - void setEntityNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LiveEntityIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LiveEntityPdu.cpp b/src/dis7/LiveEntityPdu.cpp deleted file mode 100644 index 73e69e80..00000000 --- a/src/dis7/LiveEntityPdu.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -LiveEntityPdu::LiveEntityPdu() : PduSuperclass(), - _subprotocolNumber(0), - _padding(0) -{ -} - -LiveEntityPdu::~LiveEntityPdu() -{ -} - -unsigned short LiveEntityPdu::getSubprotocolNumber() const -{ - return _subprotocolNumber; -} - -void LiveEntityPdu::setSubprotocolNumber(unsigned short pX) -{ - _subprotocolNumber = pX; -} - -unsigned char LiveEntityPdu::getPadding() const -{ - return _padding; -} - -void LiveEntityPdu::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void LiveEntityPdu::marshal(DataStream& dataStream) const -{ - PduSuperclass::marshal(dataStream); // Marshal information in superclass first - dataStream << _subprotocolNumber; - dataStream << _padding; -} - -void LiveEntityPdu::unmarshal(DataStream& dataStream) -{ - PduSuperclass::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _subprotocolNumber; - dataStream >> _padding; -} - - -bool LiveEntityPdu::operator ==(const LiveEntityPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = PduSuperclass::operator==(rhs); - - if( ! (_subprotocolNumber == rhs._subprotocolNumber) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int LiveEntityPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = PduSuperclass::getMarshalledSize(); - marshalSize = marshalSize + 2; // _subprotocolNumber - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LiveEntityPdu.h b/src/dis7/LiveEntityPdu.h deleted file mode 100644 index 00b87a75..00000000 --- a/src/dis7/LiveEntityPdu.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// The live entity PDUs have a header with some different field names, but the same length. Section 9.3.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT LiveEntityPdu : public PduSuperclass -{ -protected: - /** Subprotocol used to decode the PDU. Section 13 of EBV. */ - unsigned short _subprotocolNumber; - - /** zero-filled array of padding */ - unsigned char _padding; - - - public: - LiveEntityPdu(); - virtual ~LiveEntityPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSubprotocolNumber() const; - void setSubprotocolNumber(unsigned short pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LiveEntityPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LiveSimulationAddress.cpp b/src/dis7/LiveSimulationAddress.cpp deleted file mode 100644 index 5bf67baa..00000000 --- a/src/dis7/LiveSimulationAddress.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -LiveSimulationAddress::LiveSimulationAddress(): - _liveSiteNumber(0), - _liveApplicationNumber(0) -{ -} - -LiveSimulationAddress::~LiveSimulationAddress() -{ -} - -unsigned char LiveSimulationAddress::getLiveSiteNumber() const -{ - return _liveSiteNumber; -} - -void LiveSimulationAddress::setLiveSiteNumber(unsigned char pX) -{ - _liveSiteNumber = pX; -} - -unsigned short LiveSimulationAddress::getLiveApplicationNumber() const -{ - return _liveApplicationNumber; -} - -void LiveSimulationAddress::setLiveApplicationNumber(unsigned short pX) -{ - _liveApplicationNumber = pX; -} - -void LiveSimulationAddress::marshal(DataStream& dataStream) const -{ - dataStream << _liveSiteNumber; - dataStream << _liveApplicationNumber; -} - -void LiveSimulationAddress::unmarshal(DataStream& dataStream) -{ - dataStream >> _liveSiteNumber; - dataStream >> _liveApplicationNumber; -} - - -bool LiveSimulationAddress::operator ==(const LiveSimulationAddress& rhs) const - { - bool ivarsEqual = true; - - if( ! (_liveSiteNumber == rhs._liveSiteNumber) ) ivarsEqual = false; - if( ! (_liveApplicationNumber == rhs._liveApplicationNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int LiveSimulationAddress::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _liveSiteNumber - marshalSize = marshalSize + 2; // _liveApplicationNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LiveSimulationAddress.h b/src/dis7/LiveSimulationAddress.h deleted file mode 100644 index 4575ac87..00000000 --- a/src/dis7/LiveSimulationAddress.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// A simulation's designation associated with all Live Entity IDs contained in Live Entity PDUs. Section 6.2.55 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT LiveSimulationAddress -{ -protected: - /** facility, installation, organizational unit or geographic location may have multiple sites associated with it. The Site Number is the first component of the Live Simulation Address, which defines a live simulation. */ - unsigned char _liveSiteNumber; - - /** An application associated with a live site is termed a live application. Each live application participating in an event */ - unsigned short _liveApplicationNumber; - - - public: - LiveSimulationAddress(); - virtual ~LiveSimulationAddress(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getLiveSiteNumber() const; - void setLiveSiteNumber(unsigned char pX); - - unsigned short getLiveApplicationNumber() const; - void setLiveApplicationNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LiveSimulationAddress& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LogisticsFamilyPdu.cpp b/src/dis7/LogisticsFamilyPdu.cpp deleted file mode 100644 index 41c04906..00000000 --- a/src/dis7/LogisticsFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -LogisticsFamilyPdu::LogisticsFamilyPdu() : Pdu() - -{ - setProtocolFamily( 3 ); -} - -LogisticsFamilyPdu::~LogisticsFamilyPdu() -{ -} - -void LogisticsFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void LogisticsFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool LogisticsFamilyPdu::operator ==(const LogisticsFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int LogisticsFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/LogisticsFamilyPdu.h b/src/dis7/LogisticsFamilyPdu.h deleted file mode 100644 index 7490182e..00000000 --- a/src/dis7/LogisticsFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Abstract superclass for logistics PDUs. Section 7.4 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT LogisticsFamilyPdu : public Pdu -{ -protected: - - public: - LogisticsFamilyPdu(); - virtual ~LogisticsFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const LogisticsFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MineEntityIdentifier.cpp b/src/dis7/MineEntityIdentifier.cpp deleted file mode 100644 index 5b499c3a..00000000 --- a/src/dis7/MineEntityIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -MineEntityIdentifier::MineEntityIdentifier(): - _simulationAddress(), - _mineEntityNumber(0) -{ -} - -MineEntityIdentifier::~MineEntityIdentifier() -{ -} - -SimulationAddress& MineEntityIdentifier::getSimulationAddress() -{ - return _simulationAddress; -} - -const SimulationAddress& MineEntityIdentifier::getSimulationAddress() const -{ - return _simulationAddress; -} - -void MineEntityIdentifier::setSimulationAddress(const SimulationAddress &pX) -{ - _simulationAddress = pX; -} - -unsigned short MineEntityIdentifier::getMineEntityNumber() const -{ - return _mineEntityNumber; -} - -void MineEntityIdentifier::setMineEntityNumber(unsigned short pX) -{ - _mineEntityNumber = pX; -} - -void MineEntityIdentifier::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _mineEntityNumber; -} - -void MineEntityIdentifier::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _mineEntityNumber; -} - - -bool MineEntityIdentifier::operator ==(const MineEntityIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_mineEntityNumber == rhs._mineEntityNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int MineEntityIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _mineEntityNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MineEntityIdentifier.h b/src/dis7/MineEntityIdentifier.h deleted file mode 100644 index c34688ef..00000000 --- a/src/dis7/MineEntityIdentifier.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// The unique designation of a mine contained in the Minefield Data PDU. No espdus are issued for mine entities. Section 6.2.56 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT MineEntityIdentifier -{ -protected: - /** */ - SimulationAddress _simulationAddress; - - /** */ - unsigned short _mineEntityNumber; - - - public: - MineEntityIdentifier(); - virtual ~MineEntityIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getSimulationAddress(); - const SimulationAddress& getSimulationAddress() const; - void setSimulationAddress(const SimulationAddress &pX); - - unsigned short getMineEntityNumber() const; - void setMineEntityNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MineEntityIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MinefieldFamilyPdu.cpp b/src/dis7/MinefieldFamilyPdu.cpp deleted file mode 100644 index cd879287..00000000 --- a/src/dis7/MinefieldFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldFamilyPdu::MinefieldFamilyPdu() : Pdu() - -{ - setProtocolFamily( 8 ); -} - -MinefieldFamilyPdu::~MinefieldFamilyPdu() -{ -} - -void MinefieldFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void MinefieldFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool MinefieldFamilyPdu::operator ==(const MinefieldFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int MinefieldFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MinefieldFamilyPdu.h b/src/dis7/MinefieldFamilyPdu.h deleted file mode 100644 index 8b48e6ba..00000000 --- a/src/dis7/MinefieldFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Abstract superclass for PDUs relating to minefields. Section 7.9 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT MinefieldFamilyPdu : public Pdu -{ -protected: - - public: - MinefieldFamilyPdu(); - virtual ~MinefieldFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MinefieldIdentifier.cpp b/src/dis7/MinefieldIdentifier.cpp deleted file mode 100644 index 78855a2b..00000000 --- a/src/dis7/MinefieldIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldIdentifier::MinefieldIdentifier(): - _simulationAddress(), - _minefieldNumber(0) -{ -} - -MinefieldIdentifier::~MinefieldIdentifier() -{ -} - -SimulationAddress& MinefieldIdentifier::getSimulationAddress() -{ - return _simulationAddress; -} - -const SimulationAddress& MinefieldIdentifier::getSimulationAddress() const -{ - return _simulationAddress; -} - -void MinefieldIdentifier::setSimulationAddress(const SimulationAddress &pX) -{ - _simulationAddress = pX; -} - -unsigned short MinefieldIdentifier::getMinefieldNumber() const -{ - return _minefieldNumber; -} - -void MinefieldIdentifier::setMinefieldNumber(unsigned short pX) -{ - _minefieldNumber = pX; -} - -void MinefieldIdentifier::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _minefieldNumber; -} - -void MinefieldIdentifier::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _minefieldNumber; -} - - -bool MinefieldIdentifier::operator ==(const MinefieldIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_minefieldNumber == rhs._minefieldNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int MinefieldIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _minefieldNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MinefieldIdentifier.h b/src/dis7/MinefieldIdentifier.h deleted file mode 100644 index 4ebc38b0..00000000 --- a/src/dis7/MinefieldIdentifier.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// The unique designation of a minefield Section 6.2.57 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT MinefieldIdentifier -{ -protected: - /** */ - SimulationAddress _simulationAddress; - - /** */ - unsigned short _minefieldNumber; - - - public: - MinefieldIdentifier(); - virtual ~MinefieldIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getSimulationAddress(); - const SimulationAddress& getSimulationAddress() const; - void setSimulationAddress(const SimulationAddress &pX); - - unsigned short getMinefieldNumber() const; - void setMinefieldNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MinefieldResponseNackPdu.cpp b/src/dis7/MinefieldResponseNackPdu.cpp deleted file mode 100644 index a289543f..00000000 --- a/src/dis7/MinefieldResponseNackPdu.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldResponseNackPdu::MinefieldResponseNackPdu() : MinefieldFamilyPdu(), - _minefieldID(), - _requestingEntityID(), - _requestID(0), - _numberOfMissingPdus(0) -{ - setPduType( 40 ); -} - -MinefieldResponseNackPdu::~MinefieldResponseNackPdu() -{ - _missingPduSequenceNumbers.clear(); -} - -EntityID& MinefieldResponseNackPdu::getMinefieldID() -{ - return _minefieldID; -} - -const EntityID& MinefieldResponseNackPdu::getMinefieldID() const -{ - return _minefieldID; -} - -void MinefieldResponseNackPdu::setMinefieldID(const EntityID &pX) -{ - _minefieldID = pX; -} - -EntityID& MinefieldResponseNackPdu::getRequestingEntityID() -{ - return _requestingEntityID; -} - -const EntityID& MinefieldResponseNackPdu::getRequestingEntityID() const -{ - return _requestingEntityID; -} - -void MinefieldResponseNackPdu::setRequestingEntityID(const EntityID &pX) -{ - _requestingEntityID = pX; -} - -unsigned char MinefieldResponseNackPdu::getRequestID() const -{ - return _requestID; -} - -void MinefieldResponseNackPdu::setRequestID(unsigned char pX) -{ - _requestID = pX; -} - -unsigned char MinefieldResponseNackPdu::getNumberOfMissingPdus() const -{ - return _missingPduSequenceNumbers.size(); -} - -std::vector& MinefieldResponseNackPdu::getMissingPduSequenceNumbers() -{ - return _missingPduSequenceNumbers; -} - -const std::vector& MinefieldResponseNackPdu::getMissingPduSequenceNumbers() const -{ - return _missingPduSequenceNumbers; -} - -void MinefieldResponseNackPdu::setMissingPduSequenceNumbers(const std::vector& pX) -{ - _missingPduSequenceNumbers = pX; -} - -void MinefieldResponseNackPdu::marshal(DataStream& dataStream) const -{ - MinefieldFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _minefieldID.marshal(dataStream); - _requestingEntityID.marshal(dataStream); - dataStream << _requestID; - dataStream << ( unsigned char )_missingPduSequenceNumbers.size(); - - for(size_t idx = 0; idx < _missingPduSequenceNumbers.size(); idx++) - { - EightByteChunk x = _missingPduSequenceNumbers[idx]; - x.marshal(dataStream); - } - -} - -void MinefieldResponseNackPdu::unmarshal(DataStream& dataStream) -{ - MinefieldFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _minefieldID.unmarshal(dataStream); - _requestingEntityID.unmarshal(dataStream); - dataStream >> _requestID; - dataStream >> _numberOfMissingPdus; - - _missingPduSequenceNumbers.clear(); - for(size_t idx = 0; idx < _numberOfMissingPdus; idx++) - { - EightByteChunk x; - x.unmarshal(dataStream); - _missingPduSequenceNumbers.push_back(x); - } -} - - -bool MinefieldResponseNackPdu::operator ==(const MinefieldResponseNackPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = MinefieldFamilyPdu::operator==(rhs); - - if( ! (_minefieldID == rhs._minefieldID) ) ivarsEqual = false; - if( ! (_requestingEntityID == rhs._requestingEntityID) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _missingPduSequenceNumbers.size(); idx++) - { - if( ! ( _missingPduSequenceNumbers[idx] == rhs._missingPduSequenceNumbers[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int MinefieldResponseNackPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = MinefieldFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID - marshalSize = marshalSize + _requestingEntityID.getMarshalledSize(); // _requestingEntityID - marshalSize = marshalSize + 1; // _requestID - marshalSize = marshalSize + 1; // _numberOfMissingPdus - - for(unsigned long long idx=0; idx < _missingPduSequenceNumbers.size(); idx++) - { - EightByteChunk listElement = _missingPduSequenceNumbers[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MinefieldResponseNackPdu.h b/src/dis7/MinefieldResponseNackPdu.h deleted file mode 100644 index 60ef683c..00000000 --- a/src/dis7/MinefieldResponseNackPdu.h +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// proivde the means to request a retransmit of a minefield data pdu. Section 7.9.5 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT MinefieldResponseNackPdu : public MinefieldFamilyPdu -{ -protected: - /** Minefield ID */ - EntityID _minefieldID; - - /** entity ID making the request */ - EntityID _requestingEntityID; - - /** request ID */ - unsigned char _requestID; - - /** how many pdus were missing */ - unsigned char _numberOfMissingPdus; - - /** PDU sequence numbers that were missing */ - std::vector _missingPduSequenceNumbers; - - - public: - MinefieldResponseNackPdu(); - virtual ~MinefieldResponseNackPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getMinefieldID(); - const EntityID& getMinefieldID() const; - void setMinefieldID(const EntityID &pX); - - EntityID& getRequestingEntityID(); - const EntityID& getRequestingEntityID() const; - void setRequestingEntityID(const EntityID &pX); - - unsigned char getRequestID() const; - void setRequestID(unsigned char pX); - - unsigned char getNumberOfMissingPdus() const; - - std::vector& getMissingPduSequenceNumbers(); - const std::vector& getMissingPduSequenceNumbers() const; - void setMissingPduSequenceNumbers(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldResponseNackPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MinefieldStatePdu.cpp b/src/dis7/MinefieldStatePdu.cpp deleted file mode 100644 index 34804a13..00000000 --- a/src/dis7/MinefieldStatePdu.cpp +++ /dev/null @@ -1,319 +0,0 @@ -#include - -using namespace DIS; - - -MinefieldStatePdu::MinefieldStatePdu() : MinefieldFamilyPdu(), - _minefieldID(), - _minefieldSequence(0), - _forceID(0), - _numberOfPerimeterPoints(0), - _minefieldType(), - _numberOfMineTypes(0), - _minefieldLocation(), - _minefieldOrientation(), - _appearance(0), - _protocolMode(0) -{ - setPduType( 37 ); -} - -MinefieldStatePdu::~MinefieldStatePdu() -{ - _perimeterPoints.clear(); - _mineType.clear(); -} - -MinefieldIdentifier& MinefieldStatePdu::getMinefieldID() -{ - return _minefieldID; -} - -const MinefieldIdentifier& MinefieldStatePdu::getMinefieldID() const -{ - return _minefieldID; -} - -void MinefieldStatePdu::setMinefieldID(const MinefieldIdentifier &pX) -{ - _minefieldID = pX; -} - -unsigned short MinefieldStatePdu::getMinefieldSequence() const -{ - return _minefieldSequence; -} - -void MinefieldStatePdu::setMinefieldSequence(unsigned short pX) -{ - _minefieldSequence = pX; -} - -unsigned char MinefieldStatePdu::getForceID() const -{ - return _forceID; -} - -void MinefieldStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char MinefieldStatePdu::getNumberOfPerimeterPoints() const -{ - return _perimeterPoints.size(); -} - -EntityType& MinefieldStatePdu::getMinefieldType() -{ - return _minefieldType; -} - -const EntityType& MinefieldStatePdu::getMinefieldType() const -{ - return _minefieldType; -} - -void MinefieldStatePdu::setMinefieldType(const EntityType &pX) -{ - _minefieldType = pX; -} - -unsigned short MinefieldStatePdu::getNumberOfMineTypes() const -{ - return _mineType.size(); -} - -Vector3Double& MinefieldStatePdu::getMinefieldLocation() -{ - return _minefieldLocation; -} - -const Vector3Double& MinefieldStatePdu::getMinefieldLocation() const -{ - return _minefieldLocation; -} - -void MinefieldStatePdu::setMinefieldLocation(const Vector3Double &pX) -{ - _minefieldLocation = pX; -} - -EulerAngles& MinefieldStatePdu::getMinefieldOrientation() -{ - return _minefieldOrientation; -} - -const EulerAngles& MinefieldStatePdu::getMinefieldOrientation() const -{ - return _minefieldOrientation; -} - -void MinefieldStatePdu::setMinefieldOrientation(const EulerAngles &pX) -{ - _minefieldOrientation = pX; -} - -unsigned short MinefieldStatePdu::getAppearance() const -{ - return _appearance; -} - -void MinefieldStatePdu::setAppearance(unsigned short pX) -{ - _appearance = pX; -} - -unsigned short MinefieldStatePdu::getProtocolMode() const -{ - return _protocolMode; -} - -void MinefieldStatePdu::setProtocolMode(unsigned short pX) -{ - _protocolMode = pX; -} - -std::vector& MinefieldStatePdu::getPerimeterPoints() -{ - return _perimeterPoints; -} - -const std::vector& MinefieldStatePdu::getPerimeterPoints() const -{ - return _perimeterPoints; -} - -void MinefieldStatePdu::setPerimeterPoints(const std::vector& pX) -{ - _perimeterPoints = pX; -} - -std::vector& MinefieldStatePdu::getMineType() -{ - return _mineType; -} - -const std::vector& MinefieldStatePdu::getMineType() const -{ - return _mineType; -} - -void MinefieldStatePdu::setMineType(const std::vector& pX) -{ - _mineType = pX; -} - -void MinefieldStatePdu::marshal(DataStream& dataStream) const -{ - MinefieldFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _minefieldID.marshal(dataStream); - dataStream << _minefieldSequence; - dataStream << _forceID; - dataStream << ( unsigned char )_perimeterPoints.size(); - _minefieldType.marshal(dataStream); - dataStream << ( unsigned short )_mineType.size(); - _minefieldLocation.marshal(dataStream); - _minefieldOrientation.marshal(dataStream); - dataStream << _appearance; - dataStream << _protocolMode; - - for(size_t idx = 0; idx < _perimeterPoints.size(); idx++) - { - Vector2Float x = _perimeterPoints[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _mineType.size(); idx++) - { - EntityType x = _mineType[idx]; - x.marshal(dataStream); - } - -} - -void MinefieldStatePdu::unmarshal(DataStream& dataStream) -{ - MinefieldFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _minefieldID.unmarshal(dataStream); - dataStream >> _minefieldSequence; - dataStream >> _forceID; - dataStream >> _numberOfPerimeterPoints; - _minefieldType.unmarshal(dataStream); - dataStream >> _numberOfMineTypes; - _minefieldLocation.unmarshal(dataStream); - _minefieldOrientation.unmarshal(dataStream); - dataStream >> _appearance; - dataStream >> _protocolMode; - - _perimeterPoints.clear(); - for(size_t idx = 0; idx < _numberOfPerimeterPoints; idx++) - { - Vector2Float x; - x.unmarshal(dataStream); - _perimeterPoints.push_back(x); - } - - _mineType.clear(); - for(size_t idx = 0; idx < _numberOfMineTypes; idx++) - { - EntityType x; - x.unmarshal(dataStream); - _mineType.push_back(x); - } -} - - -bool MinefieldStatePdu::operator ==(const MinefieldStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = MinefieldFamilyPdu::operator==(rhs); - - if( ! (_minefieldID == rhs._minefieldID) ) ivarsEqual = false; - if( ! (_minefieldSequence == rhs._minefieldSequence) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_minefieldType == rhs._minefieldType) ) ivarsEqual = false; - if( ! (_minefieldLocation == rhs._minefieldLocation) ) ivarsEqual = false; - if( ! (_minefieldOrientation == rhs._minefieldOrientation) ) ivarsEqual = false; - if( ! (_appearance == rhs._appearance) ) ivarsEqual = false; - if( ! (_protocolMode == rhs._protocolMode) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _perimeterPoints.size(); idx++) - { - if( ! ( _perimeterPoints[idx] == rhs._perimeterPoints[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _mineType.size(); idx++) - { - if( ! ( _mineType[idx] == rhs._mineType[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int MinefieldStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = MinefieldFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID - marshalSize = marshalSize + 2; // _minefieldSequence - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _numberOfPerimeterPoints - marshalSize = marshalSize + _minefieldType.getMarshalledSize(); // _minefieldType - marshalSize = marshalSize + 2; // _numberOfMineTypes - marshalSize = marshalSize + _minefieldLocation.getMarshalledSize(); // _minefieldLocation - marshalSize = marshalSize + _minefieldOrientation.getMarshalledSize(); // _minefieldOrientation - marshalSize = marshalSize + 2; // _appearance - marshalSize = marshalSize + 2; // _protocolMode - - for(unsigned long long idx=0; idx < _perimeterPoints.size(); idx++) - { - Vector2Float listElement = _perimeterPoints[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _mineType.size(); idx++) - { - EntityType listElement = _mineType[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MinefieldStatePdu.h b/src/dis7/MinefieldStatePdu.h deleted file mode 100644 index e6ecc9fe..00000000 --- a/src/dis7/MinefieldStatePdu.h +++ /dev/null @@ -1,146 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// information about the complete minefield. The minefield presence, perimiter, etc. Section 7.9.2 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT MinefieldStatePdu : public MinefieldFamilyPdu -{ -protected: - /** Minefield ID */ - MinefieldIdentifier _minefieldID; - - /** Minefield sequence */ - unsigned short _minefieldSequence; - - /** force ID */ - unsigned char _forceID; - - /** Number of permieter points */ - unsigned char _numberOfPerimeterPoints; - - /** type of minefield */ - EntityType _minefieldType; - - /** how many mine types */ - unsigned short _numberOfMineTypes; - - /** location of center of minefield in world coords */ - Vector3Double _minefieldLocation; - - /** orientation of minefield */ - EulerAngles _minefieldOrientation; - - /** appearance bitflags */ - unsigned short _appearance; - - /** protocolMode. First two bits are the protocol mode, 14 bits reserved. */ - unsigned short _protocolMode; - - /** perimeter points for the minefield */ - std::vector _perimeterPoints; - - /** Type of mines */ - std::vector _mineType; - - - public: - MinefieldStatePdu(); - virtual ~MinefieldStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - MinefieldIdentifier& getMinefieldID(); - const MinefieldIdentifier& getMinefieldID() const; - void setMinefieldID(const MinefieldIdentifier &pX); - - unsigned short getMinefieldSequence() const; - void setMinefieldSequence(unsigned short pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getNumberOfPerimeterPoints() const; - - EntityType& getMinefieldType(); - const EntityType& getMinefieldType() const; - void setMinefieldType(const EntityType &pX); - - unsigned short getNumberOfMineTypes() const; - - Vector3Double& getMinefieldLocation(); - const Vector3Double& getMinefieldLocation() const; - void setMinefieldLocation(const Vector3Double &pX); - - EulerAngles& getMinefieldOrientation(); - const EulerAngles& getMinefieldOrientation() const; - void setMinefieldOrientation(const EulerAngles &pX); - - unsigned short getAppearance() const; - void setAppearance(unsigned short pX); - - unsigned short getProtocolMode() const; - void setProtocolMode(unsigned short pX); - - std::vector& getPerimeterPoints(); - const std::vector& getPerimeterPoints() const; - void setPerimeterPoints(const std::vector& pX); - - std::vector& getMineType(); - const std::vector& getMineType() const; - void setMineType(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MinefieldStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ModulationType.cpp b/src/dis7/ModulationType.cpp deleted file mode 100644 index c5bf5fd9..00000000 --- a/src/dis7/ModulationType.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -ModulationType::ModulationType(): - _spreadSpectrum(0), - _majorModulation(0), - _detail(0), - _radioSystem(0) -{ -} - -ModulationType::~ModulationType() -{ -} - -unsigned short ModulationType::getSpreadSpectrum() const -{ - return _spreadSpectrum; -} - -void ModulationType::setSpreadSpectrum(unsigned short pX) -{ - _spreadSpectrum = pX; -} - -unsigned short ModulationType::getMajorModulation() const -{ - return _majorModulation; -} - -void ModulationType::setMajorModulation(unsigned short pX) -{ - _majorModulation = pX; -} - -unsigned short ModulationType::getDetail() const -{ - return _detail; -} - -void ModulationType::setDetail(unsigned short pX) -{ - _detail = pX; -} - -unsigned short ModulationType::getRadioSystem() const -{ - return _radioSystem; -} - -void ModulationType::setRadioSystem(unsigned short pX) -{ - _radioSystem = pX; -} - -void ModulationType::marshal(DataStream& dataStream) const -{ - dataStream << _spreadSpectrum; - dataStream << _majorModulation; - dataStream << _detail; - dataStream << _radioSystem; -} - -void ModulationType::unmarshal(DataStream& dataStream) -{ - dataStream >> _spreadSpectrum; - dataStream >> _majorModulation; - dataStream >> _detail; - dataStream >> _radioSystem; -} - - -bool ModulationType::operator ==(const ModulationType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_spreadSpectrum == rhs._spreadSpectrum) ) ivarsEqual = false; - if( ! (_majorModulation == rhs._majorModulation) ) ivarsEqual = false; - if( ! (_detail == rhs._detail) ) ivarsEqual = false; - if( ! (_radioSystem == rhs._radioSystem) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ModulationType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _spreadSpectrum - marshalSize = marshalSize + 2; // _majorModulation - marshalSize = marshalSize + 2; // _detail - marshalSize = marshalSize + 2; // _radioSystem - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ModulationType.h b/src/dis7/ModulationType.h deleted file mode 100644 index 8674299a..00000000 --- a/src/dis7/ModulationType.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Information about the type of modulation used for radio transmission. 6.2.59 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ModulationType -{ -protected: - /** This field shall indicate the spread spectrum technique or combination of spread spectrum techniques in use. Bt field. */ - unsigned short _spreadSpectrum; - - /** the major classification of the modulation type. */ - unsigned short _majorModulation; - - /** provide certain detailed information depending upon the major modulation type */ - unsigned short _detail; - - /** the radio system associated with this Transmitter PDU and shall be used as the basis to interpret other fields whose values depend on a specific radio system. */ - unsigned short _radioSystem; - - - public: - ModulationType(); - virtual ~ModulationType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSpreadSpectrum() const; - void setSpreadSpectrum(unsigned short pX); - - unsigned short getMajorModulation() const; - void setMajorModulation(unsigned short pX); - - unsigned short getDetail() const; - void setDetail(unsigned short pX); - - unsigned short getRadioSystem() const; - void setRadioSystem(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ModulationType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Munition.cpp b/src/dis7/Munition.cpp deleted file mode 100644 index 550ca477..00000000 --- a/src/dis7/Munition.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include - -using namespace DIS; - - -Munition::Munition(): - _munitionType(), - _station(0), - _quantity(0), - _munitionStatus(0), - _padding(0) -{ -} - -Munition::~Munition() -{ -} - -EntityType& Munition::getMunitionType() -{ - return _munitionType; -} - -const EntityType& Munition::getMunitionType() const -{ - return _munitionType; -} - -void Munition::setMunitionType(const EntityType &pX) -{ - _munitionType = pX; -} - -unsigned int Munition::getStation() const -{ - return _station; -} - -void Munition::setStation(unsigned int pX) -{ - _station = pX; -} - -unsigned short Munition::getQuantity() const -{ - return _quantity; -} - -void Munition::setQuantity(unsigned short pX) -{ - _quantity = pX; -} - -unsigned char Munition::getMunitionStatus() const -{ - return _munitionStatus; -} - -void Munition::setMunitionStatus(unsigned char pX) -{ - _munitionStatus = pX; -} - -unsigned char Munition::getPadding() const -{ - return _padding; -} - -void Munition::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void Munition::marshal(DataStream& dataStream) const -{ - _munitionType.marshal(dataStream); - dataStream << _station; - dataStream << _quantity; - dataStream << _munitionStatus; - dataStream << _padding; -} - -void Munition::unmarshal(DataStream& dataStream) -{ - _munitionType.unmarshal(dataStream); - dataStream >> _station; - dataStream >> _quantity; - dataStream >> _munitionStatus; - dataStream >> _padding; -} - - -bool Munition::operator ==(const Munition& rhs) const - { - bool ivarsEqual = true; - - if( ! (_munitionType == rhs._munitionType) ) ivarsEqual = false; - if( ! (_station == rhs._station) ) ivarsEqual = false; - if( ! (_quantity == rhs._quantity) ) ivarsEqual = false; - if( ! (_munitionStatus == rhs._munitionStatus) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Munition::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _munitionType.getMarshalledSize(); // _munitionType - marshalSize = marshalSize + 4; // _station - marshalSize = marshalSize + 2; // _quantity - marshalSize = marshalSize + 1; // _munitionStatus - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Munition.h b/src/dis7/Munition.h deleted file mode 100644 index 710f7d05..00000000 --- a/src/dis7/Munition.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// An entity's munition (e.g., bomb, missile) information shall be represented by one or more Munition records. For each type or location of munition, this record shall specify the type, location, quantity and status of munitions that an entity contains. Section 6.2.60 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Munition -{ -protected: - /** This field shall identify the entity type of the munition. See section 6.2.30. */ - EntityType _munitionType; - - /** the station or launcher to which the munition is assigned. See Annex I */ - unsigned int _station; - - /** the quantity remaining of this munition. */ - unsigned short _quantity; - - /** the status of the munition. It shall be represented by an 8-bit enumeration. */ - unsigned char _munitionStatus; - - /** padding */ - unsigned char _padding; - - - public: - Munition(); - virtual ~Munition(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getMunitionType(); - const EntityType& getMunitionType() const; - void setMunitionType(const EntityType &pX); - - unsigned int getStation() const; - void setStation(unsigned int pX); - - unsigned short getQuantity() const; - void setQuantity(unsigned short pX); - - unsigned char getMunitionStatus() const; - void setMunitionStatus(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Munition& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MunitionDescriptor.cpp b/src/dis7/MunitionDescriptor.cpp deleted file mode 100644 index 20edb38d..00000000 --- a/src/dis7/MunitionDescriptor.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include - -using namespace DIS; - - -MunitionDescriptor::MunitionDescriptor(): - _munitionType(), - _warhead(0), - _fuse(0), - _quantity(0), - _rate(0) -{ -} - -MunitionDescriptor::~MunitionDescriptor() -{ -} - -EntityType& MunitionDescriptor::getMunitionType() -{ - return _munitionType; -} - -const EntityType& MunitionDescriptor::getMunitionType() const -{ - return _munitionType; -} - -void MunitionDescriptor::setMunitionType(const EntityType &pX) -{ - _munitionType = pX; -} - -unsigned short MunitionDescriptor::getWarhead() const -{ - return _warhead; -} - -void MunitionDescriptor::setWarhead(unsigned short pX) -{ - _warhead = pX; -} - -unsigned short MunitionDescriptor::getFuse() const -{ - return _fuse; -} - -void MunitionDescriptor::setFuse(unsigned short pX) -{ - _fuse = pX; -} - -unsigned short MunitionDescriptor::getQuantity() const -{ - return _quantity; -} - -void MunitionDescriptor::setQuantity(unsigned short pX) -{ - _quantity = pX; -} - -unsigned short MunitionDescriptor::getRate() const -{ - return _rate; -} - -void MunitionDescriptor::setRate(unsigned short pX) -{ - _rate = pX; -} - -void MunitionDescriptor::marshal(DataStream& dataStream) const -{ - _munitionType.marshal(dataStream); - dataStream << _warhead; - dataStream << _fuse; - dataStream << _quantity; - dataStream << _rate; -} - -void MunitionDescriptor::unmarshal(DataStream& dataStream) -{ - _munitionType.unmarshal(dataStream); - dataStream >> _warhead; - dataStream >> _fuse; - dataStream >> _quantity; - dataStream >> _rate; -} - - -bool MunitionDescriptor::operator ==(const MunitionDescriptor& rhs) const - { - bool ivarsEqual = true; - - if( ! (_munitionType == rhs._munitionType) ) ivarsEqual = false; - if( ! (_warhead == rhs._warhead) ) ivarsEqual = false; - if( ! (_fuse == rhs._fuse) ) ivarsEqual = false; - if( ! (_quantity == rhs._quantity) ) ivarsEqual = false; - if( ! (_rate == rhs._rate) ) ivarsEqual = false; - - return ivarsEqual; - } - -int MunitionDescriptor::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _munitionType.getMarshalledSize(); // _munitionType - marshalSize = marshalSize + 2; // _warhead - marshalSize = marshalSize + 2; // _fuse - marshalSize = marshalSize + 2; // _quantity - marshalSize = marshalSize + 2; // _rate - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MunitionDescriptor.h b/src/dis7/MunitionDescriptor.h deleted file mode 100644 index 629a9a70..00000000 --- a/src/dis7/MunitionDescriptor.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Represents the firing or detonation of a munition. Section 6.2.20.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT MunitionDescriptor -{ -protected: - /** What munition was used in the burst */ - EntityType _munitionType; - - /** type of warhead */ - unsigned short _warhead; - - /** type of fuse used */ - unsigned short _fuse; - - /** how many of the munition were fired */ - unsigned short _quantity; - - /** rate at which the munition was fired */ - unsigned short _rate; - - - public: - MunitionDescriptor(); - virtual ~MunitionDescriptor(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getMunitionType(); - const EntityType& getMunitionType() const; - void setMunitionType(const EntityType &pX); - - unsigned short getWarhead() const; - void setWarhead(unsigned short pX); - - unsigned short getFuse() const; - void setFuse(unsigned short pX); - - unsigned short getQuantity() const; - void setQuantity(unsigned short pX); - - unsigned short getRate() const; - void setRate(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MunitionDescriptor& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MunitionReload.cpp b/src/dis7/MunitionReload.cpp deleted file mode 100644 index 3d51486f..00000000 --- a/src/dis7/MunitionReload.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include - -using namespace DIS; - - -MunitionReload::MunitionReload(): - _munitionType(), - _station(0), - _standardQuantity(0), - _maximumQuantity(0), - _stationName(0), - _stationNumber(0) -{ -} - -MunitionReload::~MunitionReload() -{ -} - -EntityType& MunitionReload::getMunitionType() -{ - return _munitionType; -} - -const EntityType& MunitionReload::getMunitionType() const -{ - return _munitionType; -} - -void MunitionReload::setMunitionType(const EntityType &pX) -{ - _munitionType = pX; -} - -unsigned int MunitionReload::getStation() const -{ - return _station; -} - -void MunitionReload::setStation(unsigned int pX) -{ - _station = pX; -} - -unsigned short MunitionReload::getStandardQuantity() const -{ - return _standardQuantity; -} - -void MunitionReload::setStandardQuantity(unsigned short pX) -{ - _standardQuantity = pX; -} - -unsigned short MunitionReload::getMaximumQuantity() const -{ - return _maximumQuantity; -} - -void MunitionReload::setMaximumQuantity(unsigned short pX) -{ - _maximumQuantity = pX; -} - -unsigned short MunitionReload::getStationName() const -{ - return _stationName; -} - -void MunitionReload::setStationName(unsigned short pX) -{ - _stationName = pX; -} - -unsigned short MunitionReload::getStationNumber() const -{ - return _stationNumber; -} - -void MunitionReload::setStationNumber(unsigned short pX) -{ - _stationNumber = pX; -} - -void MunitionReload::marshal(DataStream& dataStream) const -{ - _munitionType.marshal(dataStream); - dataStream << _station; - dataStream << _standardQuantity; - dataStream << _maximumQuantity; - dataStream << _stationName; - dataStream << _stationNumber; -} - -void MunitionReload::unmarshal(DataStream& dataStream) -{ - _munitionType.unmarshal(dataStream); - dataStream >> _station; - dataStream >> _standardQuantity; - dataStream >> _maximumQuantity; - dataStream >> _stationName; - dataStream >> _stationNumber; -} - - -bool MunitionReload::operator ==(const MunitionReload& rhs) const - { - bool ivarsEqual = true; - - if( ! (_munitionType == rhs._munitionType) ) ivarsEqual = false; - if( ! (_station == rhs._station) ) ivarsEqual = false; - if( ! (_standardQuantity == rhs._standardQuantity) ) ivarsEqual = false; - if( ! (_maximumQuantity == rhs._maximumQuantity) ) ivarsEqual = false; - if( ! (_stationName == rhs._stationName) ) ivarsEqual = false; - if( ! (_stationNumber == rhs._stationNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int MunitionReload::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _munitionType.getMarshalledSize(); // _munitionType - marshalSize = marshalSize + 4; // _station - marshalSize = marshalSize + 2; // _standardQuantity - marshalSize = marshalSize + 2; // _maximumQuantity - marshalSize = marshalSize + 2; // _stationName - marshalSize = marshalSize + 2; // _stationNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/MunitionReload.h b/src/dis7/MunitionReload.h deleted file mode 100644 index 5fd2136c..00000000 --- a/src/dis7/MunitionReload.h +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// indicate weapons (munitions) previously communicated via the Munition record. Section 6.2.61 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT MunitionReload -{ -protected: - /** This field shall identify the entity type of the munition. See section 6.2.30. */ - EntityType _munitionType; - - /** the station or launcher to which the munition is assigned. See Annex I */ - unsigned int _station; - - /** the standard quantity of this munition type normally loaded at this station/launcher if a station/launcher is specified. */ - unsigned short _standardQuantity; - - /** the maximum quantity of this munition type that this station/launcher is capable of holding when a station/launcher is specified */ - unsigned short _maximumQuantity; - - /** the station name within the host at which the part entity is located. */ - unsigned short _stationName; - - /** the number of the particular wing station, cargo hold etc., at which the part is attached. */ - unsigned short _stationNumber; - - - public: - MunitionReload(); - virtual ~MunitionReload(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getMunitionType(); - const EntityType& getMunitionType() const; - void setMunitionType(const EntityType &pX); - - unsigned int getStation() const; - void setStation(unsigned int pX); - - unsigned short getStandardQuantity() const; - void setStandardQuantity(unsigned short pX); - - unsigned short getMaximumQuantity() const; - void setMaximumQuantity(unsigned short pX); - - unsigned short getStationName() const; - void setStationName(unsigned short pX); - - unsigned short getStationNumber() const; - void setStationNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const MunitionReload& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/NamedLocationIdentification.cpp b/src/dis7/NamedLocationIdentification.cpp deleted file mode 100644 index bd30b08e..00000000 --- a/src/dis7/NamedLocationIdentification.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -NamedLocationIdentification::NamedLocationIdentification(): - _stationName(0), - _stationNumber(0) -{ -} - -NamedLocationIdentification::~NamedLocationIdentification() -{ -} - -unsigned short NamedLocationIdentification::getStationName() const -{ - return _stationName; -} - -void NamedLocationIdentification::setStationName(unsigned short pX) -{ - _stationName = pX; -} - -unsigned short NamedLocationIdentification::getStationNumber() const -{ - return _stationNumber; -} - -void NamedLocationIdentification::setStationNumber(unsigned short pX) -{ - _stationNumber = pX; -} - -void NamedLocationIdentification::marshal(DataStream& dataStream) const -{ - dataStream << _stationName; - dataStream << _stationNumber; -} - -void NamedLocationIdentification::unmarshal(DataStream& dataStream) -{ - dataStream >> _stationName; - dataStream >> _stationNumber; -} - - -bool NamedLocationIdentification::operator ==(const NamedLocationIdentification& rhs) const - { - bool ivarsEqual = true; - - if( ! (_stationName == rhs._stationName) ) ivarsEqual = false; - if( ! (_stationNumber == rhs._stationNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int NamedLocationIdentification::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _stationName - marshalSize = marshalSize + 2; // _stationNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/NamedLocationIdentification.h b/src/dis7/NamedLocationIdentification.h deleted file mode 100644 index 9a0a4222..00000000 --- a/src/dis7/NamedLocationIdentification.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Information about the discrete positional relationship of the part entity with respect to the its host entity Section 6.2.62 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT NamedLocationIdentification -{ -protected: - /** the station name within the host at which the part entity is located. If the part entity is On Station, this field shall specify the representation of the part’s location data fields. This field shall be specified by a 16-bit enumeration */ - unsigned short _stationName; - - /** the number of the particular wing station, cargo hold etc., at which the part is attached. */ - unsigned short _stationNumber; - - - public: - NamedLocationIdentification(); - virtual ~NamedLocationIdentification(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getStationName() const; - void setStationName(unsigned short pX); - - unsigned short getStationNumber() const; - void setStationNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const NamedLocationIdentification& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ObjectIdentifier.cpp b/src/dis7/ObjectIdentifier.cpp deleted file mode 100644 index fc174835..00000000 --- a/src/dis7/ObjectIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -ObjectIdentifier::ObjectIdentifier(): - _simulationAddress(), - _objectNumber(0) -{ -} - -ObjectIdentifier::~ObjectIdentifier() -{ -} - -SimulationAddress& ObjectIdentifier::getSimulationAddress() -{ - return _simulationAddress; -} - -const SimulationAddress& ObjectIdentifier::getSimulationAddress() const -{ - return _simulationAddress; -} - -void ObjectIdentifier::setSimulationAddress(const SimulationAddress &pX) -{ - _simulationAddress = pX; -} - -unsigned short ObjectIdentifier::getObjectNumber() const -{ - return _objectNumber; -} - -void ObjectIdentifier::setObjectNumber(unsigned short pX) -{ - _objectNumber = pX; -} - -void ObjectIdentifier::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _objectNumber; -} - -void ObjectIdentifier::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _objectNumber; -} - - -bool ObjectIdentifier::operator ==(const ObjectIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_objectNumber == rhs._objectNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ObjectIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _objectNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ObjectIdentifier.h b/src/dis7/ObjectIdentifier.h deleted file mode 100644 index 8db4ea04..00000000 --- a/src/dis7/ObjectIdentifier.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// The unique designation of an environmental object. Section 6.2.63 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ObjectIdentifier -{ -protected: - /** Simulation Address */ - SimulationAddress _simulationAddress; - - /** */ - unsigned short _objectNumber; - - - public: - ObjectIdentifier(); - virtual ~ObjectIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getSimulationAddress(); - const SimulationAddress& getSimulationAddress() const; - void setSimulationAddress(const SimulationAddress &pX); - - unsigned short getObjectNumber() const; - void setObjectNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ObjectIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ObjectType.cpp b/src/dis7/ObjectType.cpp deleted file mode 100644 index 7f19844b..00000000 --- a/src/dis7/ObjectType.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -ObjectType::ObjectType(): - _domain(0), - _objectKind(0), - _category(0), - _subcategory(0) -{ -} - -ObjectType::~ObjectType() -{ -} - -unsigned char ObjectType::getDomain() const -{ - return _domain; -} - -void ObjectType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned char ObjectType::getObjectKind() const -{ - return _objectKind; -} - -void ObjectType::setObjectKind(unsigned char pX) -{ - _objectKind = pX; -} - -unsigned char ObjectType::getCategory() const -{ - return _category; -} - -void ObjectType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char ObjectType::getSubcategory() const -{ - return _subcategory; -} - -void ObjectType::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -void ObjectType::marshal(DataStream& dataStream) const -{ - dataStream << _domain; - dataStream << _objectKind; - dataStream << _category; - dataStream << _subcategory; -} - -void ObjectType::unmarshal(DataStream& dataStream) -{ - dataStream >> _domain; - dataStream >> _objectKind; - dataStream >> _category; - dataStream >> _subcategory; -} - - -bool ObjectType::operator ==(const ObjectType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_objectKind == rhs._objectKind) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ObjectType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 1; // _objectKind - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ObjectType.h b/src/dis7/ObjectType.h deleted file mode 100644 index dcae930d..00000000 --- a/src/dis7/ObjectType.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The unique designation of an environmental object. Section 6.2.64 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ObjectType -{ -protected: - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned char _objectKind; - - /** category of entity */ - unsigned char _category; - - /** subcategory of entity */ - unsigned char _subcategory; - - - public: - ObjectType(); - virtual ~ObjectType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned char getObjectKind() const; - void setObjectKind(unsigned char pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ObjectType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/OwnershipStatus.cpp b/src/dis7/OwnershipStatus.cpp deleted file mode 100644 index ff4f2d23..00000000 --- a/src/dis7/OwnershipStatus.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include - -using namespace DIS; - - -OwnershipStatus::OwnershipStatus(): - _entityId(), - _ownershipStatus(0), - _padding(0) -{ -} - -OwnershipStatus::~OwnershipStatus() -{ -} - -EntityID& OwnershipStatus::getEntityId() -{ - return _entityId; -} - -const EntityID& OwnershipStatus::getEntityId() const -{ - return _entityId; -} - -void OwnershipStatus::setEntityId(const EntityID &pX) -{ - _entityId = pX; -} - -unsigned char OwnershipStatus::getOwnershipStatus() const -{ - return _ownershipStatus; -} - -void OwnershipStatus::setOwnershipStatus(unsigned char pX) -{ - _ownershipStatus = pX; -} - -unsigned char OwnershipStatus::getPadding() const -{ - return _padding; -} - -void OwnershipStatus::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void OwnershipStatus::marshal(DataStream& dataStream) const -{ - _entityId.marshal(dataStream); - dataStream << _ownershipStatus; - dataStream << _padding; -} - -void OwnershipStatus::unmarshal(DataStream& dataStream) -{ - _entityId.unmarshal(dataStream); - dataStream >> _ownershipStatus; - dataStream >> _padding; -} - - -bool OwnershipStatus::operator ==(const OwnershipStatus& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityId == rhs._entityId) ) ivarsEqual = false; - if( ! (_ownershipStatus == rhs._ownershipStatus) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int OwnershipStatus::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _entityId.getMarshalledSize(); // _entityId - marshalSize = marshalSize + 1; // _ownershipStatus - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/OwnershipStatus.h b/src/dis7/OwnershipStatus.h deleted file mode 100644 index f3c9e995..00000000 --- a/src/dis7/OwnershipStatus.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// used to convey entity and conflict status information associated with transferring ownership of an entity. Section 6.2.65 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT OwnershipStatus -{ -protected: - /** EntityID */ - EntityID _entityId; - - /** The ownership and/or ownership conflict status of the entity represented by the Entity ID field. */ - unsigned char _ownershipStatus; - - /** padding */ - unsigned char _padding; - - - public: - OwnershipStatus(); - virtual ~OwnershipStatus(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityId(); - const EntityID& getEntityId() const; - void setEntityId(const EntityID &pX); - - unsigned char getOwnershipStatus() const; - void setOwnershipStatus(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const OwnershipStatus& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Pdu.cpp b/src/dis7/Pdu.cpp deleted file mode 100644 index d7bce854..00000000 --- a/src/dis7/Pdu.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -Pdu::Pdu() : PduSuperclass(), - _pduStatus(0), - _padding(0) -{ -} - -Pdu::~Pdu() -{ -} - -unsigned char Pdu::getPduStatus() const -{ - return _pduStatus; -} - -void Pdu::setPduStatus(unsigned char pX) -{ - _pduStatus = pX; -} - -unsigned char Pdu::getPadding() const -{ - return _padding; -} - -void Pdu::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void Pdu::marshal(DataStream& dataStream) const -{ - PduSuperclass::marshal(dataStream); // Marshal information in superclass first - dataStream << _pduStatus; - dataStream << _padding; -} - -void Pdu::unmarshal(DataStream& dataStream) -{ - PduSuperclass::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _pduStatus; - dataStream >> _padding; -} - - -bool Pdu::operator ==(const Pdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = PduSuperclass::operator==(rhs); - - if( ! (_pduStatus == rhs._pduStatus) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Pdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = PduSuperclass::getMarshalledSize(); - marshalSize = marshalSize + 1; // _pduStatus - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Pdu.h b/src/dis7/Pdu.h deleted file mode 100644 index 357bddb0..00000000 --- a/src/dis7/Pdu.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Adds some fields to the the classic PDU - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Pdu : public PduSuperclass -{ -protected: - /** PDU Status Record. Described in 6.2.67. This field is not present in earlier DIS versions */ - unsigned char _pduStatus; - - /** zero-filled array of padding */ - unsigned char _padding; - - - public: - Pdu(); - virtual ~Pdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getPduStatus() const; - void setPduStatus(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Pdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PduContainer.cpp b/src/dis7/PduContainer.cpp deleted file mode 100644 index af7532b3..00000000 --- a/src/dis7/PduContainer.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include - -using namespace DIS; - - -PduContainer::PduContainer(): - _numberOfPdus(0) -{ -} - -PduContainer::~PduContainer() -{ - _pdus.clear(); -} - -unsigned int PduContainer::getNumberOfPdus() const -{ - return _pdus.size(); -} - -std::vector& PduContainer::getPdus() -{ - return _pdus; -} - -const std::vector& PduContainer::getPdus() const -{ - return _pdus; -} - -void PduContainer::setPdus(const std::vector& pX) -{ - _pdus = pX; -} - -void PduContainer::marshal(DataStream& dataStream) const -{ - dataStream << ( int )_pdus.size(); - - for(size_t idx = 0; idx < _pdus.size(); idx++) - { - Pdu x = _pdus[idx]; - x.marshal(dataStream); - } - -} - -void PduContainer::unmarshal(DataStream& dataStream) -{ - dataStream >> _numberOfPdus; - - _pdus.clear(); - for(size_t idx = 0; idx < _numberOfPdus; idx++) - { - Pdu x; - x.unmarshal(dataStream); - _pdus.push_back(x); - } -} - - -bool PduContainer::operator ==(const PduContainer& rhs) const - { - bool ivarsEqual = true; - - - for(size_t idx = 0; idx < _pdus.size(); idx++) - { - if( ! ( _pdus[idx] == rhs._pdus[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int PduContainer::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _numberOfPdus - - for(unsigned long long idx=0; idx < _pdus.size(); idx++) - { - Pdu listElement = _pdus[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PduContainer.h b/src/dis7/PduContainer.h deleted file mode 100644 index f67c268b..00000000 --- a/src/dis7/PduContainer.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Used for XML compatability. A container that holds PDUs - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT PduContainer -{ -protected: - /** Number of PDUs in the container list */ - unsigned int _numberOfPdus; - - /** record sets */ - std::vector _pdus; - - - public: - PduContainer(); - virtual ~PduContainer(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfPdus() const; - - std::vector& getPdus(); - const std::vector& getPdus() const; - void setPdus(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const PduContainer& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PduHeader.cpp b/src/dis7/PduHeader.cpp deleted file mode 100644 index c1ee5f09..00000000 --- a/src/dis7/PduHeader.cpp +++ /dev/null @@ -1,187 +0,0 @@ -#include - -using namespace DIS; - - -PduHeader::PduHeader(): - _protocolVersion(7), - _exerciseID(0), - _pduType(0), - _protocolFamily(0), - _timestamp(0), - _pduLength(0), - _pduStatus(0), - _padding(0) -{ -} - -PduHeader::~PduHeader() -{ -} - -unsigned char PduHeader::getProtocolVersion() const -{ - return _protocolVersion; -} - -void PduHeader::setProtocolVersion(unsigned char pX) -{ - _protocolVersion = pX; -} - -unsigned char PduHeader::getExerciseID() const -{ - return _exerciseID; -} - -void PduHeader::setExerciseID(unsigned char pX) -{ - _exerciseID = pX; -} - -unsigned char PduHeader::getPduType() const -{ - return _pduType; -} - -void PduHeader::setPduType(unsigned char pX) -{ - _pduType = pX; -} - -unsigned char PduHeader::getProtocolFamily() const -{ - return _protocolFamily; -} - -void PduHeader::setProtocolFamily(unsigned char pX) -{ - _protocolFamily = pX; -} - -unsigned int PduHeader::getTimestamp() const -{ - return _timestamp; -} - -void PduHeader::setTimestamp(unsigned int pX) -{ - _timestamp = pX; -} - -unsigned char PduHeader::getPduLength() const -{ - return _pduLength; -} - -void PduHeader::setPduLength(unsigned char pX) -{ - _pduLength = pX; -} - -unsigned short PduHeader::getPduStatus() const -{ - return _pduStatus; -} - -void PduHeader::setPduStatus(unsigned short pX) -{ - _pduStatus = pX; -} - -unsigned char PduHeader::getPadding() const -{ - return _padding; -} - -void PduHeader::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void PduHeader::marshal(DataStream& dataStream) const -{ - dataStream << _protocolVersion; - dataStream << _exerciseID; - dataStream << _pduType; - dataStream << _protocolFamily; - dataStream << _timestamp; - dataStream << _pduLength; - dataStream << _pduStatus; - dataStream << _padding; -} - -void PduHeader::unmarshal(DataStream& dataStream) -{ - dataStream >> _protocolVersion; - dataStream >> _exerciseID; - dataStream >> _pduType; - dataStream >> _protocolFamily; - dataStream >> _timestamp; - dataStream >> _pduLength; - dataStream >> _pduStatus; - dataStream >> _padding; -} - - -bool PduHeader::operator ==(const PduHeader& rhs) const - { - bool ivarsEqual = true; - - if( ! (_protocolVersion == rhs._protocolVersion) ) ivarsEqual = false; - if( ! (_exerciseID == rhs._exerciseID) ) ivarsEqual = false; - if( ! (_pduType == rhs._pduType) ) ivarsEqual = false; - if( ! (_protocolFamily == rhs._protocolFamily) ) ivarsEqual = false; - if( ! (_timestamp == rhs._timestamp) ) ivarsEqual = false; - if( ! (_pduLength == rhs._pduLength) ) ivarsEqual = false; - if( ! (_pduStatus == rhs._pduStatus) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int PduHeader::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _protocolVersion - marshalSize = marshalSize + 1; // _exerciseID - marshalSize = marshalSize + 1; // _pduType - marshalSize = marshalSize + 1; // _protocolFamily - marshalSize = marshalSize + 4; // _timestamp - marshalSize = marshalSize + 1; // _pduLength - marshalSize = marshalSize + 2; // _pduStatus - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PduHeader.h b/src/dis7/PduHeader.h deleted file mode 100644 index 63c8679a..00000000 --- a/src/dis7/PduHeader.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Not used. The PDU Header Record is directly incoroporated into the PDU class. Here for completness only. Section 6.2.66 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT PduHeader -{ -protected: - /** The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2009. */ - unsigned char _protocolVersion; - - /** Exercise ID */ - unsigned char _exerciseID; - - /** Type of pdu, unique for each PDU class */ - unsigned char _pduType; - - /** value that refers to the protocol family, eg SimulationManagement, etc */ - unsigned char _protocolFamily; - - /** Timestamp value */ - unsigned int _timestamp; - - /** Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word. */ - unsigned char _pduLength; - - /** PDU Status Record. Described in 6.2.67. This field is not present in earlier DIS versions */ - unsigned short _pduStatus; - - /** zero filled array of padding */ - unsigned char _padding; - - - public: - PduHeader(); - virtual ~PduHeader(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getProtocolVersion() const; - void setProtocolVersion(unsigned char pX); - - unsigned char getExerciseID() const; - void setExerciseID(unsigned char pX); - - unsigned char getPduType() const; - void setPduType(unsigned char pX); - - unsigned char getProtocolFamily() const; - void setProtocolFamily(unsigned char pX); - - unsigned int getTimestamp() const; - void setTimestamp(unsigned int pX); - - unsigned char getPduLength() const; - void setPduLength(unsigned char pX); - - unsigned short getPduStatus() const; - void setPduStatus(unsigned short pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const PduHeader& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PduStatus.cpp b/src/dis7/PduStatus.cpp deleted file mode 100644 index 16628ec4..00000000 --- a/src/dis7/PduStatus.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include - -using namespace DIS; - - -PduStatus::PduStatus(): - _pduStatus(0) -{ -} - -PduStatus::~PduStatus() -{ -} - -unsigned char PduStatus::getPduStatus() const -{ - return _pduStatus; -} - -void PduStatus::setPduStatus(unsigned char pX) -{ - _pduStatus = pX; -} - -void PduStatus::marshal(DataStream& dataStream) const -{ - dataStream << _pduStatus; -} - -void PduStatus::unmarshal(DataStream& dataStream) -{ - dataStream >> _pduStatus; -} - - -bool PduStatus::operator ==(const PduStatus& rhs) const - { - bool ivarsEqual = true; - - if( ! (_pduStatus == rhs._pduStatus) ) ivarsEqual = false; - - return ivarsEqual; - } - -int PduStatus::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _pduStatus - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PduSuperclass.cpp b/src/dis7/PduSuperclass.cpp deleted file mode 100644 index 87a5ebb1..00000000 --- a/src/dis7/PduSuperclass.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -PduSuperclass::PduSuperclass(): - _protocolVersion(7), - _exerciseID(0), - _pduType(0), - _protocolFamily(0), - _timestamp(0), - _length(0) -{ -} - -PduSuperclass::~PduSuperclass() -{ -} - -unsigned char PduSuperclass::getProtocolVersion() const -{ - return _protocolVersion; -} - -void PduSuperclass::setProtocolVersion(unsigned char pX) -{ - _protocolVersion = pX; -} - -unsigned char PduSuperclass::getExerciseID() const -{ - return _exerciseID; -} - -void PduSuperclass::setExerciseID(unsigned char pX) -{ - _exerciseID = pX; -} - -unsigned char PduSuperclass::getPduType() const -{ - return _pduType; -} - -void PduSuperclass::setPduType(unsigned char pX) -{ - _pduType = pX; -} - -unsigned char PduSuperclass::getProtocolFamily() const -{ - return _protocolFamily; -} - -void PduSuperclass::setProtocolFamily(unsigned char pX) -{ - _protocolFamily = pX; -} - -unsigned int PduSuperclass::getTimestamp() const -{ - return _timestamp; -} - -void PduSuperclass::setTimestamp(unsigned int pX) -{ - _timestamp = pX; -} - -unsigned short PduSuperclass::getLength() const -{ - return _length; -} - -void PduSuperclass::setLength(unsigned short pX) -{ - _length = pX; -} - -void PduSuperclass::marshal(DataStream& dataStream) const -{ - dataStream << _protocolVersion; - dataStream << _exerciseID; - dataStream << _pduType; - dataStream << _protocolFamily; - dataStream << _timestamp; - dataStream << _length; -} - -void PduSuperclass::unmarshal(DataStream& dataStream) -{ - dataStream >> _protocolVersion; - dataStream >> _exerciseID; - dataStream >> _pduType; - dataStream >> _protocolFamily; - dataStream >> _timestamp; - dataStream >> _length; -} - - -bool PduSuperclass::operator ==(const PduSuperclass& rhs) const - { - bool ivarsEqual = true; - - if( ! (_protocolVersion == rhs._protocolVersion) ) ivarsEqual = false; - if( ! (_exerciseID == rhs._exerciseID) ) ivarsEqual = false; - if( ! (_pduType == rhs._pduType) ) ivarsEqual = false; - if( ! (_protocolFamily == rhs._protocolFamily) ) ivarsEqual = false; - if( ! (_timestamp == rhs._timestamp) ) ivarsEqual = false; - if( ! (_length == rhs._length) ) ivarsEqual = false; - - return ivarsEqual; - } - -int PduSuperclass::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _protocolVersion - marshalSize = marshalSize + 1; // _exerciseID - marshalSize = marshalSize + 1; // _pduType - marshalSize = marshalSize + 1; // _protocolFamily - marshalSize = marshalSize + 4; // _timestamp - marshalSize = marshalSize + 2; // _length - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PduSuperclass.h b/src/dis7/PduSuperclass.h deleted file mode 100644 index 8ef20884..00000000 --- a/src/dis7/PduSuperclass.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The superclass for all PDUs, including classic and Live Entity (LE) PDUs. This incorporates the PduHeader record, section 7.2.2 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT PduSuperclass -{ -protected: - /** The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2009. */ - unsigned char _protocolVersion; - - /** Exercise ID */ - unsigned char _exerciseID; - - /** Type of pdu, unique for each PDU class */ - unsigned char _pduType; - - /** value that refers to the protocol family, eg SimulationManagement, et */ - unsigned char _protocolFamily; - - /** Timestamp value */ - unsigned int _timestamp; - - /** Length, in bytes, of the PDU */ - unsigned short _length; - - - public: - PduSuperclass(); - virtual ~PduSuperclass(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getProtocolVersion() const; - void setProtocolVersion(unsigned char pX); - - unsigned char getExerciseID() const; - void setExerciseID(unsigned char pX); - - unsigned char getPduType() const; - void setPduType(unsigned char pX); - - unsigned char getProtocolFamily() const; - void setProtocolFamily(unsigned char pX); - - unsigned int getTimestamp() const; - void setTimestamp(unsigned int pX); - - unsigned short getLength() const; - void setLength(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const PduSuperclass& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PointObjectStatePdu.cpp b/src/dis7/PointObjectStatePdu.cpp deleted file mode 100644 index ffdb8d08..00000000 --- a/src/dis7/PointObjectStatePdu.cpp +++ /dev/null @@ -1,288 +0,0 @@ -#include - -using namespace DIS; - - -PointObjectStatePdu::PointObjectStatePdu() : SyntheticEnvironmentFamilyPdu(), - _objectID(), - _referencedObjectID(), - _updateNumber(0), - _forceID(0), - _modifications(0), - _objectType(), - _objectLocation(), - _objectOrientation(), - _objectAppearance(0.0), - _requesterID(), - _receivingID(), - _pad2(0) -{ - setPduType( 43 ); -} - -PointObjectStatePdu::~PointObjectStatePdu() -{ -} - -EntityID& PointObjectStatePdu::getObjectID() -{ - return _objectID; -} - -const EntityID& PointObjectStatePdu::getObjectID() const -{ - return _objectID; -} - -void PointObjectStatePdu::setObjectID(const EntityID &pX) -{ - _objectID = pX; -} - -EntityID& PointObjectStatePdu::getReferencedObjectID() -{ - return _referencedObjectID; -} - -const EntityID& PointObjectStatePdu::getReferencedObjectID() const -{ - return _referencedObjectID; -} - -void PointObjectStatePdu::setReferencedObjectID(const EntityID &pX) -{ - _referencedObjectID = pX; -} - -unsigned short PointObjectStatePdu::getUpdateNumber() const -{ - return _updateNumber; -} - -void PointObjectStatePdu::setUpdateNumber(unsigned short pX) -{ - _updateNumber = pX; -} - -unsigned char PointObjectStatePdu::getForceID() const -{ - return _forceID; -} - -void PointObjectStatePdu::setForceID(unsigned char pX) -{ - _forceID = pX; -} - -unsigned char PointObjectStatePdu::getModifications() const -{ - return _modifications; -} - -void PointObjectStatePdu::setModifications(unsigned char pX) -{ - _modifications = pX; -} - -ObjectType& PointObjectStatePdu::getObjectType() -{ - return _objectType; -} - -const ObjectType& PointObjectStatePdu::getObjectType() const -{ - return _objectType; -} - -void PointObjectStatePdu::setObjectType(const ObjectType &pX) -{ - _objectType = pX; -} - -Vector3Double& PointObjectStatePdu::getObjectLocation() -{ - return _objectLocation; -} - -const Vector3Double& PointObjectStatePdu::getObjectLocation() const -{ - return _objectLocation; -} - -void PointObjectStatePdu::setObjectLocation(const Vector3Double &pX) -{ - _objectLocation = pX; -} - -EulerAngles& PointObjectStatePdu::getObjectOrientation() -{ - return _objectOrientation; -} - -const EulerAngles& PointObjectStatePdu::getObjectOrientation() const -{ - return _objectOrientation; -} - -void PointObjectStatePdu::setObjectOrientation(const EulerAngles &pX) -{ - _objectOrientation = pX; -} - -double PointObjectStatePdu::getObjectAppearance() const -{ - return _objectAppearance; -} - -void PointObjectStatePdu::setObjectAppearance(double pX) -{ - _objectAppearance = pX; -} - -SimulationAddress& PointObjectStatePdu::getRequesterID() -{ - return _requesterID; -} - -const SimulationAddress& PointObjectStatePdu::getRequesterID() const -{ - return _requesterID; -} - -void PointObjectStatePdu::setRequesterID(const SimulationAddress &pX) -{ - _requesterID = pX; -} - -SimulationAddress& PointObjectStatePdu::getReceivingID() -{ - return _receivingID; -} - -const SimulationAddress& PointObjectStatePdu::getReceivingID() const -{ - return _receivingID; -} - -void PointObjectStatePdu::setReceivingID(const SimulationAddress &pX) -{ - _receivingID = pX; -} - -unsigned int PointObjectStatePdu::getPad2() const -{ - return _pad2; -} - -void PointObjectStatePdu::setPad2(unsigned int pX) -{ - _pad2 = pX; -} - -void PointObjectStatePdu::marshal(DataStream& dataStream) const -{ - SyntheticEnvironmentFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _objectID.marshal(dataStream); - _referencedObjectID.marshal(dataStream); - dataStream << _updateNumber; - dataStream << _forceID; - dataStream << _modifications; - _objectType.marshal(dataStream); - _objectLocation.marshal(dataStream); - _objectOrientation.marshal(dataStream); - dataStream << _objectAppearance; - _requesterID.marshal(dataStream); - _receivingID.marshal(dataStream); - dataStream << _pad2; -} - -void PointObjectStatePdu::unmarshal(DataStream& dataStream) -{ - SyntheticEnvironmentFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _objectID.unmarshal(dataStream); - _referencedObjectID.unmarshal(dataStream); - dataStream >> _updateNumber; - dataStream >> _forceID; - dataStream >> _modifications; - _objectType.unmarshal(dataStream); - _objectLocation.unmarshal(dataStream); - _objectOrientation.unmarshal(dataStream); - dataStream >> _objectAppearance; - _requesterID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - dataStream >> _pad2; -} - - -bool PointObjectStatePdu::operator ==(const PointObjectStatePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); - - if( ! (_objectID == rhs._objectID) ) ivarsEqual = false; - if( ! (_referencedObjectID == rhs._referencedObjectID) ) ivarsEqual = false; - if( ! (_updateNumber == rhs._updateNumber) ) ivarsEqual = false; - if( ! (_forceID == rhs._forceID) ) ivarsEqual = false; - if( ! (_modifications == rhs._modifications) ) ivarsEqual = false; - if( ! (_objectType == rhs._objectType) ) ivarsEqual = false; - if( ! (_objectLocation == rhs._objectLocation) ) ivarsEqual = false; - if( ! (_objectOrientation == rhs._objectOrientation) ) ivarsEqual = false; - if( ! (_objectAppearance == rhs._objectAppearance) ) ivarsEqual = false; - if( ! (_requesterID == rhs._requesterID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - - return ivarsEqual; - } - -int PointObjectStatePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID - marshalSize = marshalSize + _referencedObjectID.getMarshalledSize(); // _referencedObjectID - marshalSize = marshalSize + 2; // _updateNumber - marshalSize = marshalSize + 1; // _forceID - marshalSize = marshalSize + 1; // _modifications - marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType - marshalSize = marshalSize + _objectLocation.getMarshalledSize(); // _objectLocation - marshalSize = marshalSize + _objectOrientation.getMarshalledSize(); // _objectOrientation - marshalSize = marshalSize + 8; // _objectAppearance - marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + 4; // _pad2 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PointObjectStatePdu.h b/src/dis7/PointObjectStatePdu.h deleted file mode 100644 index a86bd8ef..00000000 --- a/src/dis7/PointObjectStatePdu.h +++ /dev/null @@ -1,149 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// : Inormation abut the addition or modification of a synthecic enviroment object that is anchored to the terrain with a single point. Section 7.10.4 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT PointObjectStatePdu : public SyntheticEnvironmentFamilyPdu -{ -protected: - /** Object in synthetic environment */ - EntityID _objectID; - - /** Object with which this point object is associated */ - EntityID _referencedObjectID; - - /** unique update number of each state transition of an object */ - unsigned short _updateNumber; - - /** force ID */ - unsigned char _forceID; - - /** modifications */ - unsigned char _modifications; - - /** Object type */ - ObjectType _objectType; - - /** Object location */ - Vector3Double _objectLocation; - - /** Object orientation */ - EulerAngles _objectOrientation; - - /** Object apperance */ - double _objectAppearance; - - /** requesterID */ - SimulationAddress _requesterID; - - /** receiver ID */ - SimulationAddress _receivingID; - - /** padding */ - unsigned int _pad2; - - - public: - PointObjectStatePdu(); - virtual ~PointObjectStatePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getObjectID(); - const EntityID& getObjectID() const; - void setObjectID(const EntityID &pX); - - EntityID& getReferencedObjectID(); - const EntityID& getReferencedObjectID() const; - void setReferencedObjectID(const EntityID &pX); - - unsigned short getUpdateNumber() const; - void setUpdateNumber(unsigned short pX); - - unsigned char getForceID() const; - void setForceID(unsigned char pX); - - unsigned char getModifications() const; - void setModifications(unsigned char pX); - - ObjectType& getObjectType(); - const ObjectType& getObjectType() const; - void setObjectType(const ObjectType &pX); - - Vector3Double& getObjectLocation(); - const Vector3Double& getObjectLocation() const; - void setObjectLocation(const Vector3Double &pX); - - EulerAngles& getObjectOrientation(); - const EulerAngles& getObjectOrientation() const; - void setObjectOrientation(const EulerAngles &pX); - - double getObjectAppearance() const; - void setObjectAppearance(double pX); - - SimulationAddress& getRequesterID(); - const SimulationAddress& getRequesterID() const; - void setRequesterID(const SimulationAddress &pX); - - SimulationAddress& getReceivingID(); - const SimulationAddress& getReceivingID() const; - void setReceivingID(const SimulationAddress &pX); - - unsigned int getPad2() const; - void setPad2(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const PointObjectStatePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PropulsionSystemData.cpp b/src/dis7/PropulsionSystemData.cpp deleted file mode 100644 index bb43ad23..00000000 --- a/src/dis7/PropulsionSystemData.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -PropulsionSystemData::PropulsionSystemData(): - _powerSetting(0.0), - _engineRpm(0.0) -{ -} - -PropulsionSystemData::~PropulsionSystemData() -{ -} - -float PropulsionSystemData::getPowerSetting() const -{ - return _powerSetting; -} - -void PropulsionSystemData::setPowerSetting(float pX) -{ - _powerSetting = pX; -} - -float PropulsionSystemData::getEngineRpm() const -{ - return _engineRpm; -} - -void PropulsionSystemData::setEngineRpm(float pX) -{ - _engineRpm = pX; -} - -void PropulsionSystemData::marshal(DataStream& dataStream) const -{ - dataStream << _powerSetting; - dataStream << _engineRpm; -} - -void PropulsionSystemData::unmarshal(DataStream& dataStream) -{ - dataStream >> _powerSetting; - dataStream >> _engineRpm; -} - - -bool PropulsionSystemData::operator ==(const PropulsionSystemData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_powerSetting == rhs._powerSetting) ) ivarsEqual = false; - if( ! (_engineRpm == rhs._engineRpm) ) ivarsEqual = false; - - return ivarsEqual; - } - -int PropulsionSystemData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _powerSetting - marshalSize = marshalSize + 4; // _engineRpm - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PropulsionSystemData.h b/src/dis7/PropulsionSystemData.h deleted file mode 100644 index 5eb72759..00000000 --- a/src/dis7/PropulsionSystemData.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// contains information describing the propulsion systems of the entity. This information shall be provided for each active propulsion system defined. Section 6.2.68 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT PropulsionSystemData -{ -protected: - /** powerSetting */ - float _powerSetting; - - /** engine RPMs */ - float _engineRpm; - - - public: - PropulsionSystemData(); - virtual ~PropulsionSystemData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getPowerSetting() const; - void setPowerSetting(float pX); - - float getEngineRpm() const; - void setEngineRpm(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const PropulsionSystemData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RadioCommunicationsFamilyPdu.cpp b/src/dis7/RadioCommunicationsFamilyPdu.cpp deleted file mode 100644 index ddf8c28a..00000000 --- a/src/dis7/RadioCommunicationsFamilyPdu.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include - -using namespace DIS; - - -RadioCommunicationsFamilyPdu::RadioCommunicationsFamilyPdu() : Pdu(), - _entityId(), - _radioId(0) -{ - setProtocolFamily( 4 ); -} - -RadioCommunicationsFamilyPdu::~RadioCommunicationsFamilyPdu() -{ -} - -EntityID& RadioCommunicationsFamilyPdu::getEntityId() -{ - return _entityId; -} - -const EntityID& RadioCommunicationsFamilyPdu::getEntityId() const -{ - return _entityId; -} - -void RadioCommunicationsFamilyPdu::setEntityId(const EntityID &pX) -{ - _entityId = pX; -} - -unsigned short RadioCommunicationsFamilyPdu::getRadioId() const -{ - return _radioId; -} - -void RadioCommunicationsFamilyPdu::setRadioId(unsigned short pX) -{ - _radioId = pX; -} - -void RadioCommunicationsFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first - _entityId.marshal(dataStream); - dataStream << _radioId; -} - -void RadioCommunicationsFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _entityId.unmarshal(dataStream); - dataStream >> _radioId; -} - - -bool RadioCommunicationsFamilyPdu::operator ==(const RadioCommunicationsFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - if( ! (_entityId == rhs._entityId) ) ivarsEqual = false; - if( ! (_radioId == rhs._radioId) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RadioCommunicationsFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - marshalSize = marshalSize + _entityId.getMarshalledSize(); // _entityId - marshalSize = marshalSize + 2; // _radioId - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RadioCommunicationsFamilyPdu.h b/src/dis7/RadioCommunicationsFamilyPdu.h deleted file mode 100644 index 14c441a4..00000000 --- a/src/dis7/RadioCommunicationsFamilyPdu.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Abstract superclass for radio communications PDUs. Section 7.7 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RadioCommunicationsFamilyPdu : public Pdu -{ -protected: - /** ID of the entitythat is the source of the communication */ - EntityID _entityId; - - /** particular radio within an entity */ - unsigned short _radioId; - - - public: - RadioCommunicationsFamilyPdu(); - virtual ~RadioCommunicationsFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityId(); - const EntityID& getEntityId() const; - void setEntityId(const EntityID &pX); - - unsigned short getRadioId() const; - void setRadioId(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RadioCommunicationsFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RadioIdentifier.cpp b/src/dis7/RadioIdentifier.cpp deleted file mode 100644 index 61c50b03..00000000 --- a/src/dis7/RadioIdentifier.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -RadioIdentifier::RadioIdentifier(): - _siteNumber(0), - _applicationNumber(0), - _referenceNumber(0), - _radioNumber(0) -{ -} - -RadioIdentifier::~RadioIdentifier() -{ -} - -unsigned short RadioIdentifier::getSiteNumber() const -{ - return _siteNumber; -} - -void RadioIdentifier::setSiteNumber(unsigned short pX) -{ - _siteNumber = pX; -} - -unsigned short RadioIdentifier::getApplicationNumber() const -{ - return _applicationNumber; -} - -void RadioIdentifier::setApplicationNumber(unsigned short pX) -{ - _applicationNumber = pX; -} - -unsigned short RadioIdentifier::getReferenceNumber() const -{ - return _referenceNumber; -} - -void RadioIdentifier::setReferenceNumber(unsigned short pX) -{ - _referenceNumber = pX; -} - -unsigned short RadioIdentifier::getRadioNumber() const -{ - return _radioNumber; -} - -void RadioIdentifier::setRadioNumber(unsigned short pX) -{ - _radioNumber = pX; -} - -void RadioIdentifier::marshal(DataStream& dataStream) const -{ - dataStream << _siteNumber; - dataStream << _applicationNumber; - dataStream << _referenceNumber; - dataStream << _radioNumber; -} - -void RadioIdentifier::unmarshal(DataStream& dataStream) -{ - dataStream >> _siteNumber; - dataStream >> _applicationNumber; - dataStream >> _referenceNumber; - dataStream >> _radioNumber; -} - - -bool RadioIdentifier::operator ==(const RadioIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_siteNumber == rhs._siteNumber) ) ivarsEqual = false; - if( ! (_applicationNumber == rhs._applicationNumber) ) ivarsEqual = false; - if( ! (_referenceNumber == rhs._referenceNumber) ) ivarsEqual = false; - if( ! (_radioNumber == rhs._radioNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RadioIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _siteNumber - marshalSize = marshalSize + 2; // _applicationNumber - marshalSize = marshalSize + 2; // _referenceNumber - marshalSize = marshalSize + 2; // _radioNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RadioIdentifier.h b/src/dis7/RadioIdentifier.h deleted file mode 100644 index 2fa885f2..00000000 --- a/src/dis7/RadioIdentifier.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The unique designation of an attached or unattached radio in an event or exercise Section 6.2.69 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RadioIdentifier -{ -protected: - /** site */ - unsigned short _siteNumber; - - /** application number */ - unsigned short _applicationNumber; - - /** reference number */ - unsigned short _referenceNumber; - - /** Radio number */ - unsigned short _radioNumber; - - - public: - RadioIdentifier(); - virtual ~RadioIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSiteNumber() const; - void setSiteNumber(unsigned short pX); - - unsigned short getApplicationNumber() const; - void setApplicationNumber(unsigned short pX); - - unsigned short getReferenceNumber() const; - void setReferenceNumber(unsigned short pX); - - unsigned short getRadioNumber() const; - void setRadioNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RadioIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RadioType.cpp b/src/dis7/RadioType.cpp deleted file mode 100644 index 4e26e9ae..00000000 --- a/src/dis7/RadioType.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include - -using namespace DIS; - - -RadioType::RadioType(): - _entityKind(0), - _domain(0), - _country(0), - _category(0), - _subcategory(0), - _specific(0), - _extra(0) -{ -} - -RadioType::~RadioType() -{ -} - -unsigned char RadioType::getEntityKind() const -{ - return _entityKind; -} - -void RadioType::setEntityKind(unsigned char pX) -{ - _entityKind = pX; -} - -unsigned char RadioType::getDomain() const -{ - return _domain; -} - -void RadioType::setDomain(unsigned char pX) -{ - _domain = pX; -} - -unsigned short RadioType::getCountry() const -{ - return _country; -} - -void RadioType::setCountry(unsigned short pX) -{ - _country = pX; -} - -unsigned char RadioType::getCategory() const -{ - return _category; -} - -void RadioType::setCategory(unsigned char pX) -{ - _category = pX; -} - -unsigned char RadioType::getSubcategory() const -{ - return _subcategory; -} - -void RadioType::setSubcategory(unsigned char pX) -{ - _subcategory = pX; -} - -unsigned char RadioType::getSpecific() const -{ - return _specific; -} - -void RadioType::setSpecific(unsigned char pX) -{ - _specific = pX; -} - -unsigned char RadioType::getExtra() const -{ - return _extra; -} - -void RadioType::setExtra(unsigned char pX) -{ - _extra = pX; -} - -void RadioType::marshal(DataStream& dataStream) const -{ - dataStream << _entityKind; - dataStream << _domain; - dataStream << _country; - dataStream << _category; - dataStream << _subcategory; - dataStream << _specific; - dataStream << _extra; -} - -void RadioType::unmarshal(DataStream& dataStream) -{ - dataStream >> _entityKind; - dataStream >> _domain; - dataStream >> _country; - dataStream >> _category; - dataStream >> _subcategory; - dataStream >> _specific; - dataStream >> _extra; -} - - -bool RadioType::operator ==(const RadioType& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityKind == rhs._entityKind) ) ivarsEqual = false; - if( ! (_domain == rhs._domain) ) ivarsEqual = false; - if( ! (_country == rhs._country) ) ivarsEqual = false; - if( ! (_category == rhs._category) ) ivarsEqual = false; - if( ! (_subcategory == rhs._subcategory) ) ivarsEqual = false; - if( ! (_specific == rhs._specific) ) ivarsEqual = false; - if( ! (_extra == rhs._extra) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RadioType::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _entityKind - marshalSize = marshalSize + 1; // _domain - marshalSize = marshalSize + 2; // _country - marshalSize = marshalSize + 1; // _category - marshalSize = marshalSize + 1; // _subcategory - marshalSize = marshalSize + 1; // _specific - marshalSize = marshalSize + 1; // _extra - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RadioType.h b/src/dis7/RadioType.h deleted file mode 100644 index a210a7dc..00000000 --- a/src/dis7/RadioType.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Identifies the type of radio. Section 6.2.70 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RadioType -{ -protected: - /** Kind of entity */ - unsigned char _entityKind; - - /** Domain of entity (air, surface, subsurface, space, etc) */ - unsigned char _domain; - - /** country to which the design of the entity is attributed */ - unsigned short _country; - - /** category of entity */ - unsigned char _category; - - /** specific info based on subcategory field */ - unsigned char _subcategory; - - unsigned char _specific; - - unsigned char _extra; - - - public: - RadioType(); - virtual ~RadioType(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getEntityKind() const; - void setEntityKind(unsigned char pX); - - unsigned char getDomain() const; - void setDomain(unsigned char pX); - - unsigned short getCountry() const; - void setCountry(unsigned short pX); - - unsigned char getCategory() const; - void setCategory(unsigned char pX); - - unsigned char getSubcategory() const; - void setSubcategory(unsigned char pX); - - unsigned char getSpecific() const; - void setSpecific(unsigned char pX); - - unsigned char getExtra() const; - void setExtra(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RadioType& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ReceiverPdu.cpp b/src/dis7/ReceiverPdu.cpp deleted file mode 100644 index da80beb5..00000000 --- a/src/dis7/ReceiverPdu.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include - -using namespace DIS; - - -ReceiverPdu::ReceiverPdu() : RadioCommunicationsFamilyPdu(), - _receiverState(0), - _padding1(0), - _receivedPower(0.0), - _transmitterEntityId(), - _transmitterRadioId(0) -{ - setPduType( 27 ); -} - -ReceiverPdu::~ReceiverPdu() -{ -} - -unsigned short ReceiverPdu::getReceiverState() const -{ - return _receiverState; -} - -void ReceiverPdu::setReceiverState(unsigned short pX) -{ - _receiverState = pX; -} - -unsigned short ReceiverPdu::getPadding1() const -{ - return _padding1; -} - -void ReceiverPdu::setPadding1(unsigned short pX) -{ - _padding1 = pX; -} - -float ReceiverPdu::getReceivedPower() const -{ - return _receivedPower; -} - -void ReceiverPdu::setReceivedPower(float pX) -{ - _receivedPower = pX; -} - -EntityID& ReceiverPdu::getTransmitterEntityId() -{ - return _transmitterEntityId; -} - -const EntityID& ReceiverPdu::getTransmitterEntityId() const -{ - return _transmitterEntityId; -} - -void ReceiverPdu::setTransmitterEntityId(const EntityID &pX) -{ - _transmitterEntityId = pX; -} - -unsigned short ReceiverPdu::getTransmitterRadioId() const -{ - return _transmitterRadioId; -} - -void ReceiverPdu::setTransmitterRadioId(unsigned short pX) -{ - _transmitterRadioId = pX; -} - -void ReceiverPdu::marshal(DataStream& dataStream) const -{ - RadioCommunicationsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _receiverState; - dataStream << _padding1; - dataStream << _receivedPower; - _transmitterEntityId.marshal(dataStream); - dataStream << _transmitterRadioId; -} - -void ReceiverPdu::unmarshal(DataStream& dataStream) -{ - RadioCommunicationsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _receiverState; - dataStream >> _padding1; - dataStream >> _receivedPower; - _transmitterEntityId.unmarshal(dataStream); - dataStream >> _transmitterRadioId; -} - - -bool ReceiverPdu::operator ==(const ReceiverPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); - - if( ! (_receiverState == rhs._receiverState) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_receivedPower == rhs._receivedPower) ) ivarsEqual = false; - if( ! (_transmitterEntityId == rhs._transmitterEntityId) ) ivarsEqual = false; - if( ! (_transmitterRadioId == rhs._transmitterRadioId) ) ivarsEqual = false; - - return ivarsEqual; - } - -int ReceiverPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 2; // _receiverState - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 4; // _receivedPoser - marshalSize = marshalSize + _transmitterEntityId.getMarshalledSize(); // _transmitterEntityId - marshalSize = marshalSize + 2; // _transmitterRadioId - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ReceiverPdu.h b/src/dis7/ReceiverPdu.h deleted file mode 100644 index 86a64f9e..00000000 --- a/src/dis7/ReceiverPdu.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Communication of a receiver state. Section 7.7.4 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ReceiverPdu : public RadioCommunicationsFamilyPdu -{ -protected: - /** encoding scheme used, and enumeration */ - unsigned short _receiverState; - - /** padding */ - unsigned short _padding1; - - /** received power */ - float _receivedPower; - - /** ID of transmitter */ - EntityID _transmitterEntityId; - - /** ID of transmitting radio */ - unsigned short _transmitterRadioId; - - - public: - ReceiverPdu(); - virtual ~ReceiverPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getReceiverState() const; - void setReceiverState(unsigned short pX); - - unsigned short getPadding1() const; - void setPadding1(unsigned short pX); - - float getReceivedPower() const; - void setReceivedPower(float pX); - - EntityID& getTransmitterEntityId(); - const EntityID& getTransmitterEntityId() const; - void setTransmitterEntityId(const EntityID &pX); - - unsigned short getTransmitterRadioId() const; - void setTransmitterRadioId(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ReceiverPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RecordQueryReliablePdu.cpp b/src/dis7/RecordQueryReliablePdu.cpp deleted file mode 100644 index 2dba5903..00000000 --- a/src/dis7/RecordQueryReliablePdu.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include - -using namespace DIS; - - -RecordQueryReliablePdu::RecordQueryReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requestID(0), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _eventType(0), - _time(0), - _numberOfRecords(0) -{ - setPduType( 63 ); -} - -RecordQueryReliablePdu::~RecordQueryReliablePdu() -{ - _recordIDs.clear(); -} - -unsigned int RecordQueryReliablePdu::getRequestID() const -{ - return _requestID; -} - -void RecordQueryReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned char RecordQueryReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void RecordQueryReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short RecordQueryReliablePdu::getPad1() const -{ - return _pad1; -} - -void RecordQueryReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char RecordQueryReliablePdu::getPad2() const -{ - return _pad2; -} - -void RecordQueryReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned short RecordQueryReliablePdu::getEventType() const -{ - return _eventType; -} - -void RecordQueryReliablePdu::setEventType(unsigned short pX) -{ - _eventType = pX; -} - -unsigned int RecordQueryReliablePdu::getTime() const -{ - return _time; -} - -void RecordQueryReliablePdu::setTime(unsigned int pX) -{ - _time = pX; -} - -unsigned int RecordQueryReliablePdu::getNumberOfRecords() const -{ - return _recordIDs.size(); -} - -std::vector& RecordQueryReliablePdu::getRecordIDs() -{ - return _recordIDs; -} - -const std::vector& RecordQueryReliablePdu::getRecordIDs() const -{ - return _recordIDs; -} - -void RecordQueryReliablePdu::setRecordIDs(const std::vector& pX) -{ - _recordIDs = pX; -} - -void RecordQueryReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _eventType; - dataStream << _time; - dataStream << ( unsigned int )_recordIDs.size(); - - for(size_t idx = 0; idx < _recordIDs.size(); idx++) - { - FourByteChunk x = _recordIDs[idx]; - x.marshal(dataStream); - } - -} - -void RecordQueryReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _eventType; - dataStream >> _time; - dataStream >> _numberOfRecords; - - _recordIDs.clear(); - for(size_t idx = 0; idx < _numberOfRecords; idx++) - { - FourByteChunk x; - x.unmarshal(dataStream); - _recordIDs.push_back(x); - } -} - - -bool RecordQueryReliablePdu::operator ==(const RecordQueryReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_eventType == rhs._eventType) ) ivarsEqual = false; - if( ! (_time == rhs._time) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _recordIDs.size(); idx++) - { - if( ! ( _recordIDs[idx] == rhs._recordIDs[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int RecordQueryReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 2; // _eventType - marshalSize = marshalSize + 4; // _time - marshalSize = marshalSize + 4; // _numberOfRecords - - for(unsigned long long idx=0; idx < _recordIDs.size(); idx++) - { - FourByteChunk listElement = _recordIDs[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RecordQueryReliablePdu.h b/src/dis7/RecordQueryReliablePdu.h deleted file mode 100644 index 20bb547b..00000000 --- a/src/dis7/RecordQueryReliablePdu.h +++ /dev/null @@ -1,113 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.13: A request for one or more records of data from an entity. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RecordQueryReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** request ID */ - unsigned int _requestID; - - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding. The spec is unclear and contradictory here. */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** event type */ - unsigned short _eventType; - - /** time */ - unsigned int _time; - - /** numberOfRecords */ - unsigned int _numberOfRecords; - - /** record IDs */ - std::vector _recordIDs; - - - public: - RecordQueryReliablePdu(); - virtual ~RecordQueryReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned short getEventType() const; - void setEventType(unsigned short pX); - - unsigned int getTime() const; - void setTime(unsigned int pX); - - unsigned int getNumberOfRecords() const; - - std::vector& getRecordIDs(); - const std::vector& getRecordIDs() const; - void setRecordIDs(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RecordQueryReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RecordQuerySpecification.cpp b/src/dis7/RecordQuerySpecification.cpp deleted file mode 100644 index 0096197c..00000000 --- a/src/dis7/RecordQuerySpecification.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include - -using namespace DIS; - - -RecordQuerySpecification::RecordQuerySpecification(): - _numberOfRecords(0) -{ -} - -RecordQuerySpecification::~RecordQuerySpecification() -{ - _records.clear(); -} - -unsigned int RecordQuerySpecification::getNumberOfRecords() const -{ - return _records.size(); -} - -std::vector& RecordQuerySpecification::getRecords() -{ - return _records; -} - -const std::vector& RecordQuerySpecification::getRecords() const -{ - return _records; -} - -void RecordQuerySpecification::setRecords(const std::vector& pX) -{ - _records = pX; -} - -void RecordQuerySpecification::marshal(DataStream& dataStream) const -{ - dataStream << ( unsigned int )_records.size(); - - for(size_t idx = 0; idx < _records.size(); idx++) - { - FourByteChunk x = _records[idx]; - x.marshal(dataStream); - } - -} - -void RecordQuerySpecification::unmarshal(DataStream& dataStream) -{ - dataStream >> _numberOfRecords; - - _records.clear(); - for(size_t idx = 0; idx < _numberOfRecords; idx++) - { - FourByteChunk x; - x.unmarshal(dataStream); - _records.push_back(x); - } -} - - -bool RecordQuerySpecification::operator ==(const RecordQuerySpecification& rhs) const - { - bool ivarsEqual = true; - - - for(size_t idx = 0; idx < _records.size(); idx++) - { - if( ! ( _records[idx] == rhs._records[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int RecordQuerySpecification::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _numberOfRecords - - for(unsigned long long idx=0; idx < _records.size(); idx++) - { - FourByteChunk listElement = _records[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RecordQuerySpecification.h b/src/dis7/RecordQuerySpecification.h deleted file mode 100644 index b4b03150..00000000 --- a/src/dis7/RecordQuerySpecification.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// The identification of the records being queried 6.2.71 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RecordQuerySpecification -{ -protected: - unsigned int _numberOfRecords; - - /** variable length list of 32 bit records */ - std::vector _records; - - - public: - RecordQuerySpecification(); - virtual ~RecordQuerySpecification(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfRecords() const; - - std::vector& getRecords(); - const std::vector& getRecords() const; - void setRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RecordQuerySpecification& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RecordSpecification.cpp b/src/dis7/RecordSpecification.cpp deleted file mode 100644 index dc74dd5c..00000000 --- a/src/dis7/RecordSpecification.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include - -using namespace DIS; - - -RecordSpecification::RecordSpecification(): - _numberOfRecordSets(0) -{ -} - -RecordSpecification::~RecordSpecification() -{ - _recordSets.clear(); -} - -unsigned int RecordSpecification::getNumberOfRecordSets() const -{ - return _recordSets.size(); -} - -std::vector& RecordSpecification::getRecordSets() -{ - return _recordSets; -} - -const std::vector& RecordSpecification::getRecordSets() const -{ - return _recordSets; -} - -void RecordSpecification::setRecordSets(const std::vector& pX) -{ - _recordSets = pX; -} - -void RecordSpecification::marshal(DataStream& dataStream) const -{ - dataStream << ( unsigned int )_recordSets.size(); - - for(size_t idx = 0; idx < _recordSets.size(); idx++) - { - RecordSpecificationElement x = _recordSets[idx]; - x.marshal(dataStream); - } - -} - -void RecordSpecification::unmarshal(DataStream& dataStream) -{ - dataStream >> _numberOfRecordSets; - - _recordSets.clear(); - for(size_t idx = 0; idx < _numberOfRecordSets; idx++) - { - RecordSpecificationElement x; - x.unmarshal(dataStream); - _recordSets.push_back(x); - } -} - - -bool RecordSpecification::operator ==(const RecordSpecification& rhs) const - { - bool ivarsEqual = true; - - - for(size_t idx = 0; idx < _recordSets.size(); idx++) - { - if( ! ( _recordSets[idx] == rhs._recordSets[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int RecordSpecification::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _numberOfRecordSets - - for(unsigned long long idx=0; idx < _recordSets.size(); idx++) - { - RecordSpecificationElement listElement = _recordSets[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RecordSpecification.h b/src/dis7/RecordSpecification.h deleted file mode 100644 index 7100b47c..00000000 --- a/src/dis7/RecordSpecification.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// This record shall specify the number of record sets contained in the Record Specification record and the record details. Section 6.2.72. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RecordSpecification -{ -protected: - /** The number of record sets */ - unsigned int _numberOfRecordSets; - - /** variable length list record specifications. */ - std::vector _recordSets; - - - public: - RecordSpecification(); - virtual ~RecordSpecification(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getNumberOfRecordSets() const; - - std::vector& getRecordSets(); - const std::vector& getRecordSets() const; - void setRecordSets(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RecordSpecification& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RecordSpecificationElement.cpp b/src/dis7/RecordSpecificationElement.cpp deleted file mode 100644 index 3dadceab..00000000 --- a/src/dis7/RecordSpecificationElement.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -RecordSpecificationElement::RecordSpecificationElement(): - _recordID(0), - _recordSetSerialNumber(0), - _recordLength(0), - _recordCount(0), - _recordValues(0), - _pad4(0) -{ -} - -RecordSpecificationElement::~RecordSpecificationElement() -{ -} - -unsigned int RecordSpecificationElement::getRecordID() const -{ - return _recordID; -} - -void RecordSpecificationElement::setRecordID(unsigned int pX) -{ - _recordID = pX; -} - -unsigned int RecordSpecificationElement::getRecordSetSerialNumber() const -{ - return _recordSetSerialNumber; -} - -void RecordSpecificationElement::setRecordSetSerialNumber(unsigned int pX) -{ - _recordSetSerialNumber = pX; -} - -unsigned short RecordSpecificationElement::getRecordLength() const -{ - return _recordLength; -} - -void RecordSpecificationElement::setRecordLength(unsigned short pX) -{ - _recordLength = pX; -} - -unsigned short RecordSpecificationElement::getRecordCount() const -{ - return _recordCount; -} - -void RecordSpecificationElement::setRecordCount(unsigned short pX) -{ - _recordCount = pX; -} - -unsigned short RecordSpecificationElement::getRecordValues() const -{ - return _recordValues; -} - -void RecordSpecificationElement::setRecordValues(unsigned short pX) -{ - _recordValues = pX; -} - -unsigned char RecordSpecificationElement::getPad4() const -{ - return _pad4; -} - -void RecordSpecificationElement::setPad4(unsigned char pX) -{ - _pad4 = pX; -} - -void RecordSpecificationElement::marshal(DataStream& dataStream) const -{ - dataStream << _recordID; - dataStream << _recordSetSerialNumber; - dataStream << _recordLength; - dataStream << _recordCount; - dataStream << _recordValues; - dataStream << _pad4; -} - -void RecordSpecificationElement::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordID; - dataStream >> _recordSetSerialNumber; - dataStream >> _recordLength; - dataStream >> _recordCount; - dataStream >> _recordValues; - dataStream >> _pad4; -} - - -bool RecordSpecificationElement::operator ==(const RecordSpecificationElement& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordID == rhs._recordID) ) ivarsEqual = false; - if( ! (_recordSetSerialNumber == rhs._recordSetSerialNumber) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - if( ! (_recordCount == rhs._recordCount) ) ivarsEqual = false; - if( ! (_recordValues == rhs._recordValues) ) ivarsEqual = false; - if( ! (_pad4 == rhs._pad4) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RecordSpecificationElement::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordID - marshalSize = marshalSize + 4; // _recordSetSerialNumber - marshalSize = marshalSize + 2; // _recordLength - marshalSize = marshalSize + 2; // _recordCount - marshalSize = marshalSize + 2; // _recordValues - marshalSize = marshalSize + 1; // _pad4 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RecordSpecificationElement.h b/src/dis7/RecordSpecificationElement.h deleted file mode 100644 index aea03050..00000000 --- a/src/dis7/RecordSpecificationElement.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Synthetic record, made up from section 6.2.72. This is used to acheive a repeating variable list element. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RecordSpecificationElement -{ -protected: - /** the data structure used to convey the parameter values of the record for each record. 32 bit enumeration. */ - unsigned int _recordID; - - /** the serial number of the first record in the block of records */ - unsigned int _recordSetSerialNumber; - - /** the length, in bits, of the record. Note, bits, not bytes. */ - unsigned short _recordLength; - - /** the number of records included in the record set */ - unsigned short _recordCount; - - /** the concatenated records of the format specified by the Record ID field. The length of this field is the Record Length multiplied by the Record Count, in units of bits. ^^^This is wrong--variable sized data records, bit values. THis MUST be patched after generation. */ - unsigned short _recordValues; - - /** Padding of 0 to 31 unused bits as required for 32-bit alignment of the Record Set field. ^^^This is wrong--variable sized padding. MUST be patched post-code generation */ - unsigned char _pad4; - - - public: - RecordSpecificationElement(); - virtual ~RecordSpecificationElement(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordID() const; - void setRecordID(unsigned int pX); - - unsigned int getRecordSetSerialNumber() const; - void setRecordSetSerialNumber(unsigned int pX); - - unsigned short getRecordLength() const; - void setRecordLength(unsigned short pX); - - unsigned short getRecordCount() const; - void setRecordCount(unsigned short pX); - - unsigned short getRecordValues() const; - void setRecordValues(unsigned short pX); - - unsigned char getPad4() const; - void setPad4(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RecordSpecificationElement& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Relationship.cpp b/src/dis7/Relationship.cpp deleted file mode 100644 index bb4bcd7e..00000000 --- a/src/dis7/Relationship.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -Relationship::Relationship(): - _nature(0), - _position(0) -{ -} - -Relationship::~Relationship() -{ -} - -unsigned short Relationship::getNature() const -{ - return _nature; -} - -void Relationship::setNature(unsigned short pX) -{ - _nature = pX; -} - -unsigned short Relationship::getPosition() const -{ - return _position; -} - -void Relationship::setPosition(unsigned short pX) -{ - _position = pX; -} - -void Relationship::marshal(DataStream& dataStream) const -{ - dataStream << _nature; - dataStream << _position; -} - -void Relationship::unmarshal(DataStream& dataStream) -{ - dataStream >> _nature; - dataStream >> _position; -} - - -bool Relationship::operator ==(const Relationship& rhs) const - { - bool ivarsEqual = true; - - if( ! (_nature == rhs._nature) ) ivarsEqual = false; - if( ! (_position == rhs._position) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Relationship::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _nature - marshalSize = marshalSize + 2; // _position - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Relationship.h b/src/dis7/Relationship.h deleted file mode 100644 index 69e834ce..00000000 --- a/src/dis7/Relationship.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The relationship of the part entity to its host entity. Section 6.2.73. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Relationship -{ -protected: - /** the nature or purpose for joining of the part entity to the host entity and shall be represented by a 16-bit enumeration */ - unsigned short _nature; - - /** the position of the part entity with respect to the host entity and shall be represented by a 16-bit enumeration */ - unsigned short _position; - - - public: - Relationship(); - virtual ~Relationship(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getNature() const; - void setNature(unsigned short pX); - - unsigned short getPosition() const; - void setPosition(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Relationship& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RemoveEntityPdu.cpp b/src/dis7/RemoveEntityPdu.cpp deleted file mode 100644 index d54df389..00000000 --- a/src/dis7/RemoveEntityPdu.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include - -using namespace DIS; - - -RemoveEntityPdu::RemoveEntityPdu() : SimulationManagementFamilyPdu(), - _originatingID(), - _receivingID(), - _requestID(0) -{ - setPduType( 12 ); -} - -RemoveEntityPdu::~RemoveEntityPdu() -{ -} - -EntityID& RemoveEntityPdu::getOriginatingID() -{ - return _originatingID; -} - -const EntityID& RemoveEntityPdu::getOriginatingID() const -{ - return _originatingID; -} - -void RemoveEntityPdu::setOriginatingID(const EntityID &pX) -{ - _originatingID = pX; -} - -EntityID& RemoveEntityPdu::getReceivingID() -{ - return _receivingID; -} - -const EntityID& RemoveEntityPdu::getReceivingID() const -{ - return _receivingID; -} - -void RemoveEntityPdu::setReceivingID(const EntityID &pX) -{ - _receivingID = pX; -} - -unsigned int RemoveEntityPdu::getRequestID() const -{ - return _requestID; -} - -void RemoveEntityPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void RemoveEntityPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _originatingID.marshal(dataStream); - _receivingID.marshal(dataStream); - dataStream << _requestID; -} - -void RemoveEntityPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - dataStream >> _requestID; -} - - -bool RemoveEntityPdu::operator ==(const RemoveEntityPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_originatingID == rhs._originatingID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RemoveEntityPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingID.getMarshalledSize(); // _originatingID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RemoveEntityPdu.h b/src/dis7/RemoveEntityPdu.h deleted file mode 100644 index c21aa3be..00000000 --- a/src/dis7/RemoveEntityPdu.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.3 The removal of an entity from an exercise shall be communicated with a Remove Entity PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RemoveEntityPdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for originating entity(or simulation) */ - EntityID _originatingID; - - /** Identifier for the receiving entity(or simulation) */ - EntityID _receivingID; - - /** This field shall identify the specific and unique start/resume request being made by the SM */ - unsigned int _requestID; - - - public: - RemoveEntityPdu(); - virtual ~RemoveEntityPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingID(); - const EntityID& getOriginatingID() const; - void setOriginatingID(const EntityID &pX); - - EntityID& getReceivingID(); - const EntityID& getReceivingID() const; - void setReceivingID(const EntityID &pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RemoveEntityPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RemoveEntityReliablePdu.cpp b/src/dis7/RemoveEntityReliablePdu.cpp deleted file mode 100644 index c1934ffe..00000000 --- a/src/dis7/RemoveEntityReliablePdu.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include - -using namespace DIS; - - -RemoveEntityReliablePdu::RemoveEntityReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0) -{ - setPduType( 52 ); -} - -RemoveEntityReliablePdu::~RemoveEntityReliablePdu() -{ -} - -unsigned char RemoveEntityReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void RemoveEntityReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short RemoveEntityReliablePdu::getPad1() const -{ - return _pad1; -} - -void RemoveEntityReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char RemoveEntityReliablePdu::getPad2() const -{ - return _pad2; -} - -void RemoveEntityReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int RemoveEntityReliablePdu::getRequestID() const -{ - return _requestID; -} - -void RemoveEntityReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void RemoveEntityReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; -} - -void RemoveEntityReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; -} - - -bool RemoveEntityReliablePdu::operator ==(const RemoveEntityReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RemoveEntityReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RemoveEntityReliablePdu.h b/src/dis7/RemoveEntityReliablePdu.h deleted file mode 100644 index d5f74fa8..00000000 --- a/src/dis7/RemoveEntityReliablePdu.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.2: Removal of an entity , reliable. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RemoveEntityReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Request ID */ - unsigned int _requestID; - - - public: - RemoveEntityReliablePdu(); - virtual ~RemoveEntityReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RemoveEntityReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RepairCompletePdu.cpp b/src/dis7/RepairCompletePdu.cpp deleted file mode 100644 index d203a1ff..00000000 --- a/src/dis7/RepairCompletePdu.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include - -using namespace DIS; - - -RepairCompletePdu::RepairCompletePdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _repairingEntityID(), - _repair(0), - _padding4(0) -{ - setPduType( 9 ); -} - -RepairCompletePdu::~RepairCompletePdu() -{ -} - -EntityID& RepairCompletePdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& RepairCompletePdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void RepairCompletePdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& RepairCompletePdu::getRepairingEntityID() -{ - return _repairingEntityID; -} - -const EntityID& RepairCompletePdu::getRepairingEntityID() const -{ - return _repairingEntityID; -} - -void RepairCompletePdu::setRepairingEntityID(const EntityID &pX) -{ - _repairingEntityID = pX; -} - -unsigned short RepairCompletePdu::getRepair() const -{ - return _repair; -} - -void RepairCompletePdu::setRepair(unsigned short pX) -{ - _repair = pX; -} - -short RepairCompletePdu::getPadding4() const -{ - return _padding4; -} - -void RepairCompletePdu::setPadding4(short pX) -{ - _padding4 = pX; -} - -void RepairCompletePdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _repairingEntityID.marshal(dataStream); - dataStream << _repair; - dataStream << _padding4; -} - -void RepairCompletePdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _repairingEntityID.unmarshal(dataStream); - dataStream >> _repair; - dataStream >> _padding4; -} - - -bool RepairCompletePdu::operator ==(const RepairCompletePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_repairingEntityID == rhs._repairingEntityID) ) ivarsEqual = false; - if( ! (_repair == rhs._repair) ) ivarsEqual = false; - if( ! (_padding4 == rhs._padding4) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RepairCompletePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _repairingEntityID.getMarshalledSize(); // _repairingEntityID - marshalSize = marshalSize + 2; // _repair - marshalSize = marshalSize + 2; // _padding4 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RepairCompletePdu.h b/src/dis7/RepairCompletePdu.h deleted file mode 100644 index c5822edb..00000000 --- a/src/dis7/RepairCompletePdu.h +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.4.6. Service Request PDU is received and repair is complete. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RepairCompletePdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is receiving service. See 6.2.28 */ - EntityID _receivingEntityID; - - /** Entity that is supplying. See 6.2.28 */ - EntityID _repairingEntityID; - - /** Enumeration for type of repair. See 6.2.74 */ - unsigned short _repair; - - /** padding, number prevents conflict with superclass ivar name */ - short _padding4; - - - public: - RepairCompletePdu(); - virtual ~RepairCompletePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getRepairingEntityID(); - const EntityID& getRepairingEntityID() const; - void setRepairingEntityID(const EntityID &pX); - - unsigned short getRepair() const; - void setRepair(unsigned short pX); - - short getPadding4() const; - void setPadding4(short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RepairCompletePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RepairResponsePdu.cpp b/src/dis7/RepairResponsePdu.cpp deleted file mode 100644 index d78b636c..00000000 --- a/src/dis7/RepairResponsePdu.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include - -using namespace DIS; - - -RepairResponsePdu::RepairResponsePdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _repairingEntityID(), - _repairResult(0), - _padding1(0), - _padding2(0) -{ - setPduType( 10 ); -} - -RepairResponsePdu::~RepairResponsePdu() -{ -} - -EntityID& RepairResponsePdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& RepairResponsePdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void RepairResponsePdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& RepairResponsePdu::getRepairingEntityID() -{ - return _repairingEntityID; -} - -const EntityID& RepairResponsePdu::getRepairingEntityID() const -{ - return _repairingEntityID; -} - -void RepairResponsePdu::setRepairingEntityID(const EntityID &pX) -{ - _repairingEntityID = pX; -} - -unsigned char RepairResponsePdu::getRepairResult() const -{ - return _repairResult; -} - -void RepairResponsePdu::setRepairResult(unsigned char pX) -{ - _repairResult = pX; -} - -short RepairResponsePdu::getPadding1() const -{ - return _padding1; -} - -void RepairResponsePdu::setPadding1(short pX) -{ - _padding1 = pX; -} - -char RepairResponsePdu::getPadding2() const -{ - return _padding2; -} - -void RepairResponsePdu::setPadding2(char pX) -{ - _padding2 = pX; -} - -void RepairResponsePdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _repairingEntityID.marshal(dataStream); - dataStream << _repairResult; - dataStream << _padding1; - dataStream << _padding2; -} - -void RepairResponsePdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _repairingEntityID.unmarshal(dataStream); - dataStream >> _repairResult; - dataStream >> _padding1; - dataStream >> _padding2; -} - - -bool RepairResponsePdu::operator ==(const RepairResponsePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_repairingEntityID == rhs._repairingEntityID) ) ivarsEqual = false; - if( ! (_repairResult == rhs._repairResult) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - return ivarsEqual; - } - -int RepairResponsePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _repairingEntityID.getMarshalledSize(); // _repairingEntityID - marshalSize = marshalSize + 1; // _repairResult - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/RepairResponsePdu.h b/src/dis7/RepairResponsePdu.h deleted file mode 100644 index c73d32b9..00000000 --- a/src/dis7/RepairResponsePdu.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.4.7. Sent after repair complete PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT RepairResponsePdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that requested repairs. See 6.2.28 */ - EntityID _receivingEntityID; - - /** Entity that is repairing. See 6.2.28 */ - EntityID _repairingEntityID; - - /** Result of repair operation */ - unsigned char _repairResult; - - /** padding */ - short _padding1; - - /** padding */ - char _padding2; - - - public: - RepairResponsePdu(); - virtual ~RepairResponsePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getRepairingEntityID(); - const EntityID& getRepairingEntityID() const; - void setRepairingEntityID(const EntityID &pX); - - unsigned char getRepairResult() const; - void setRepairResult(unsigned char pX); - - short getPadding1() const; - void setPadding1(short pX); - - char getPadding2() const; - void setPadding2(char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const RepairResponsePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ResupplyOfferPdu.cpp b/src/dis7/ResupplyOfferPdu.cpp deleted file mode 100644 index e6660c46..00000000 --- a/src/dis7/ResupplyOfferPdu.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include - -using namespace DIS; - - -ResupplyOfferPdu::ResupplyOfferPdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _supplyingEntityID(), - _numberOfSupplyTypes(0), - _padding1(0), - _padding2(0) -{ - setPduType( 6 ); -} - -ResupplyOfferPdu::~ResupplyOfferPdu() -{ - _supplies.clear(); -} - -EntityID& ResupplyOfferPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& ResupplyOfferPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void ResupplyOfferPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& ResupplyOfferPdu::getSupplyingEntityID() -{ - return _supplyingEntityID; -} - -const EntityID& ResupplyOfferPdu::getSupplyingEntityID() const -{ - return _supplyingEntityID; -} - -void ResupplyOfferPdu::setSupplyingEntityID(const EntityID &pX) -{ - _supplyingEntityID = pX; -} - -unsigned char ResupplyOfferPdu::getNumberOfSupplyTypes() const -{ - return _supplies.size(); -} - -char ResupplyOfferPdu::getPadding1() const -{ - return _padding1; -} - -void ResupplyOfferPdu::setPadding1(char pX) -{ - _padding1 = pX; -} - -short ResupplyOfferPdu::getPadding2() const -{ - return _padding2; -} - -void ResupplyOfferPdu::setPadding2(short pX) -{ - _padding2 = pX; -} - -std::vector& ResupplyOfferPdu::getSupplies() -{ - return _supplies; -} - -const std::vector& ResupplyOfferPdu::getSupplies() const -{ - return _supplies; -} - -void ResupplyOfferPdu::setSupplies(const std::vector& pX) -{ - _supplies = pX; -} - -void ResupplyOfferPdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _supplyingEntityID.marshal(dataStream); - dataStream << ( unsigned char )_supplies.size(); - dataStream << _padding1; - dataStream << _padding2; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - SupplyQuantity x = _supplies[idx]; - x.marshal(dataStream); - } - -} - -void ResupplyOfferPdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _supplyingEntityID.unmarshal(dataStream); - dataStream >> _numberOfSupplyTypes; - dataStream >> _padding1; - dataStream >> _padding2; - - _supplies.clear(); - for(size_t idx = 0; idx < _numberOfSupplyTypes; idx++) - { - SupplyQuantity x; - x.unmarshal(dataStream); - _supplies.push_back(x); - } -} - - -bool ResupplyOfferPdu::operator ==(const ResupplyOfferPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_supplyingEntityID == rhs._supplyingEntityID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - if( ! ( _supplies[idx] == rhs._supplies[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ResupplyOfferPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID - marshalSize = marshalSize + 1; // _numberOfSupplyTypes - marshalSize = marshalSize + 1; // _padding1 - marshalSize = marshalSize + 2; // _padding2 - - for(unsigned long long idx=0; idx < _supplies.size(); idx++) - { - SupplyQuantity listElement = _supplies[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ResupplyOfferPdu.h b/src/dis7/ResupplyOfferPdu.h deleted file mode 100644 index 87df26d3..00000000 --- a/src/dis7/ResupplyOfferPdu.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Information used to communicate the offer of supplies by a supplying entity to a receiving entity. Section 7.4.3 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ResupplyOfferPdu : public LogisticsFamilyPdu -{ -protected: - /** Field identifies the Entity and respective Entity Record ID that is receiving service (see 6.2.28), Section 7.4.3 */ - EntityID _receivingEntityID; - - /** Identifies the Entity and respective Entity ID Record that is supplying (see 6.2.28), Section 7.4.3 */ - EntityID _supplyingEntityID; - - /** How many supplies types are being offered, Section 7.4.3 */ - unsigned char _numberOfSupplyTypes; - - /** padding */ - char _padding1; - - /** padding */ - short _padding2; - - /** A Reord that Specifies the type of supply and the amount of that supply for each of the supply types in numberOfSupplyTypes (see 6.2.85), Section 7.4.3 */ - std::vector _supplies; - - - public: - ResupplyOfferPdu(); - virtual ~ResupplyOfferPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getSupplyingEntityID(); - const EntityID& getSupplyingEntityID() const; - void setSupplyingEntityID(const EntityID &pX); - - unsigned char getNumberOfSupplyTypes() const; - - char getPadding1() const; - void setPadding1(char pX); - - short getPadding2() const; - void setPadding2(short pX); - - std::vector& getSupplies(); - const std::vector& getSupplies() const; - void setSupplies(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ResupplyOfferPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ResupplyReceivedPdu.cpp b/src/dis7/ResupplyReceivedPdu.cpp deleted file mode 100644 index bce99a5c..00000000 --- a/src/dis7/ResupplyReceivedPdu.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include - -using namespace DIS; - - -ResupplyReceivedPdu::ResupplyReceivedPdu() : LogisticsFamilyPdu(), - _receivingEntityID(), - _supplyingEntityID(), - _numberOfSupplyTypes(0), - _padding1(0), - _padding2(0) -{ - setPduType( 7 ); -} - -ResupplyReceivedPdu::~ResupplyReceivedPdu() -{ - _supplies.clear(); -} - -EntityID& ResupplyReceivedPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& ResupplyReceivedPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void ResupplyReceivedPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -EntityID& ResupplyReceivedPdu::getSupplyingEntityID() -{ - return _supplyingEntityID; -} - -const EntityID& ResupplyReceivedPdu::getSupplyingEntityID() const -{ - return _supplyingEntityID; -} - -void ResupplyReceivedPdu::setSupplyingEntityID(const EntityID &pX) -{ - _supplyingEntityID = pX; -} - -unsigned char ResupplyReceivedPdu::getNumberOfSupplyTypes() const -{ - return _supplies.size(); -} - -short ResupplyReceivedPdu::getPadding1() const -{ - return _padding1; -} - -void ResupplyReceivedPdu::setPadding1(short pX) -{ - _padding1 = pX; -} - -char ResupplyReceivedPdu::getPadding2() const -{ - return _padding2; -} - -void ResupplyReceivedPdu::setPadding2(char pX) -{ - _padding2 = pX; -} - -std::vector& ResupplyReceivedPdu::getSupplies() -{ - return _supplies; -} - -const std::vector& ResupplyReceivedPdu::getSupplies() const -{ - return _supplies; -} - -void ResupplyReceivedPdu::setSupplies(const std::vector& pX) -{ - _supplies = pX; -} - -void ResupplyReceivedPdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _receivingEntityID.marshal(dataStream); - _supplyingEntityID.marshal(dataStream); - dataStream << ( unsigned char )_supplies.size(); - dataStream << _padding1; - dataStream << _padding2; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - SupplyQuantity x = _supplies[idx]; - x.marshal(dataStream); - } - -} - -void ResupplyReceivedPdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _receivingEntityID.unmarshal(dataStream); - _supplyingEntityID.unmarshal(dataStream); - dataStream >> _numberOfSupplyTypes; - dataStream >> _padding1; - dataStream >> _padding2; - - _supplies.clear(); - for(size_t idx = 0; idx < _numberOfSupplyTypes; idx++) - { - SupplyQuantity x; - x.unmarshal(dataStream); - _supplies.push_back(x); - } -} - - -bool ResupplyReceivedPdu::operator ==(const ResupplyReceivedPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - if( ! (_supplyingEntityID == rhs._supplyingEntityID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - if( ! ( _supplies[idx] == rhs._supplies[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ResupplyReceivedPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - marshalSize = marshalSize + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID - marshalSize = marshalSize + 1; // _numberOfSupplyTypes - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 1; // _padding2 - - for(unsigned long long idx=0; idx < _supplies.size(); idx++) - { - SupplyQuantity listElement = _supplies[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ResupplyReceivedPdu.h b/src/dis7/ResupplyReceivedPdu.h deleted file mode 100644 index f1e001b3..00000000 --- a/src/dis7/ResupplyReceivedPdu.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.4.4. Receipt of supplies is communicated by issuing Resupply Received PDU. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ResupplyReceivedPdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is receiving service. Shall be represented by Entity Identifier record (see 6.2.28) */ - EntityID _receivingEntityID; - - /** Entity that is supplying. Shall be represented by Entity Identifier record (see 6.2.28) */ - EntityID _supplyingEntityID; - - /** How many supplies are taken by receiving entity */ - unsigned char _numberOfSupplyTypes; - - /** padding */ - short _padding1; - - /** padding */ - char _padding2; - - /** Type and amount of supplies for each specified supply type. See 6.2.85 for supply quantity record. */ - std::vector _supplies; - - - public: - ResupplyReceivedPdu(); - virtual ~ResupplyReceivedPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - EntityID& getSupplyingEntityID(); - const EntityID& getSupplyingEntityID() const; - void setSupplyingEntityID(const EntityID &pX); - - unsigned char getNumberOfSupplyTypes() const; - - short getPadding1() const; - void setPadding1(short pX); - - char getPadding2() const; - void setPadding2(char pX); - - std::vector& getSupplies(); - const std::vector& getSupplies() const; - void setSupplies(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ResupplyReceivedPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SecondaryOperationalData.cpp b/src/dis7/SecondaryOperationalData.cpp deleted file mode 100644 index bc65be17..00000000 --- a/src/dis7/SecondaryOperationalData.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -SecondaryOperationalData::SecondaryOperationalData(): - _operationalData1(0), - _operationalData2(0), - _numberOfIFFFundamentalParameterRecords(0) -{ -} - -SecondaryOperationalData::~SecondaryOperationalData() -{ -} - -unsigned char SecondaryOperationalData::getOperationalData1() const -{ - return _operationalData1; -} - -void SecondaryOperationalData::setOperationalData1(unsigned char pX) -{ - _operationalData1 = pX; -} - -unsigned char SecondaryOperationalData::getOperationalData2() const -{ - return _operationalData2; -} - -void SecondaryOperationalData::setOperationalData2(unsigned char pX) -{ - _operationalData2 = pX; -} - -unsigned short SecondaryOperationalData::getNumberOfIFFFundamentalParameterRecords() const -{ - return _numberOfIFFFundamentalParameterRecords; -} - -void SecondaryOperationalData::setNumberOfIFFFundamentalParameterRecords(unsigned short pX) -{ - _numberOfIFFFundamentalParameterRecords = pX; -} - -void SecondaryOperationalData::marshal(DataStream& dataStream) const -{ - dataStream << _operationalData1; - dataStream << _operationalData2; - dataStream << _numberOfIFFFundamentalParameterRecords; -} - -void SecondaryOperationalData::unmarshal(DataStream& dataStream) -{ - dataStream >> _operationalData1; - dataStream >> _operationalData2; - dataStream >> _numberOfIFFFundamentalParameterRecords; -} - - -bool SecondaryOperationalData::operator ==(const SecondaryOperationalData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_operationalData1 == rhs._operationalData1) ) ivarsEqual = false; - if( ! (_operationalData2 == rhs._operationalData2) ) ivarsEqual = false; - if( ! (_numberOfIFFFundamentalParameterRecords == rhs._numberOfIFFFundamentalParameterRecords) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SecondaryOperationalData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _operationalData1 - marshalSize = marshalSize + 1; // _operationalData2 - marshalSize = marshalSize + 2; // _numberOfIFFFundamentalParameterRecords - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SecondaryOperationalData.h b/src/dis7/SecondaryOperationalData.h deleted file mode 100644 index 8f3dd7cd..00000000 --- a/src/dis7/SecondaryOperationalData.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Additional operational data for an IFF emitting system and the number of IFF Fundamental Parameter Data records Section 6.2.76. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SecondaryOperationalData -{ -protected: - /** additional operational characteristics of the IFF emitting system. Each 8-bit field will vary depending on the system type. */ - unsigned char _operationalData1; - - /** additional operational characteristics of the IFF emitting system. Each 8-bit field will vary depending on the system type. */ - unsigned char _operationalData2; - - /** the number of IFF Fundamental Parameter Data records that follow */ - unsigned short _numberOfIFFFundamentalParameterRecords; - - - public: - SecondaryOperationalData(); - virtual ~SecondaryOperationalData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getOperationalData1() const; - void setOperationalData1(unsigned char pX); - - unsigned char getOperationalData2() const; - void setOperationalData2(unsigned char pX); - - unsigned short getNumberOfIFFFundamentalParameterRecords() const; - void setNumberOfIFFFundamentalParameterRecords(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SecondaryOperationalData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SeesPdu.cpp b/src/dis7/SeesPdu.cpp deleted file mode 100644 index e5a4c0ea..00000000 --- a/src/dis7/SeesPdu.cpp +++ /dev/null @@ -1,244 +0,0 @@ -#include - -using namespace DIS; - - -SeesPdu::SeesPdu() : DistributedEmissionsFamilyPdu(), - _orginatingEntityID(), - _infraredSignatureRepresentationIndex(0), - _acousticSignatureRepresentationIndex(0), - _radarCrossSectionSignatureRepresentationIndex(0), - _numberOfPropulsionSystems(0), - _numberOfVectoringNozzleSystems(0) -{ - setPduType( 30 ); -} - -SeesPdu::~SeesPdu() -{ - _propulsionSystemData.clear(); - _vectoringSystemData.clear(); -} - -EntityID& SeesPdu::getOrginatingEntityID() -{ - return _orginatingEntityID; -} - -const EntityID& SeesPdu::getOrginatingEntityID() const -{ - return _orginatingEntityID; -} - -void SeesPdu::setOrginatingEntityID(const EntityID &pX) -{ - _orginatingEntityID = pX; -} - -unsigned short SeesPdu::getInfraredSignatureRepresentationIndex() const -{ - return _infraredSignatureRepresentationIndex; -} - -void SeesPdu::setInfraredSignatureRepresentationIndex(unsigned short pX) -{ - _infraredSignatureRepresentationIndex = pX; -} - -unsigned short SeesPdu::getAcousticSignatureRepresentationIndex() const -{ - return _acousticSignatureRepresentationIndex; -} - -void SeesPdu::setAcousticSignatureRepresentationIndex(unsigned short pX) -{ - _acousticSignatureRepresentationIndex = pX; -} - -unsigned short SeesPdu::getRadarCrossSectionSignatureRepresentationIndex() const -{ - return _radarCrossSectionSignatureRepresentationIndex; -} - -void SeesPdu::setRadarCrossSectionSignatureRepresentationIndex(unsigned short pX) -{ - _radarCrossSectionSignatureRepresentationIndex = pX; -} - -unsigned short SeesPdu::getNumberOfPropulsionSystems() const -{ - return _propulsionSystemData.size(); -} - -unsigned short SeesPdu::getNumberOfVectoringNozzleSystems() const -{ - return _vectoringSystemData.size(); -} - -std::vector& SeesPdu::getPropulsionSystemData() -{ - return _propulsionSystemData; -} - -const std::vector& SeesPdu::getPropulsionSystemData() const -{ - return _propulsionSystemData; -} - -void SeesPdu::setPropulsionSystemData(const std::vector& pX) -{ - _propulsionSystemData = pX; -} - -std::vector& SeesPdu::getVectoringSystemData() -{ - return _vectoringSystemData; -} - -const std::vector& SeesPdu::getVectoringSystemData() const -{ - return _vectoringSystemData; -} - -void SeesPdu::setVectoringSystemData(const std::vector& pX) -{ - _vectoringSystemData = pX; -} - -void SeesPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _orginatingEntityID.marshal(dataStream); - dataStream << _infraredSignatureRepresentationIndex; - dataStream << _acousticSignatureRepresentationIndex; - dataStream << _radarCrossSectionSignatureRepresentationIndex; - dataStream << ( unsigned short )_propulsionSystemData.size(); - dataStream << ( unsigned short )_vectoringSystemData.size(); - - for(size_t idx = 0; idx < _propulsionSystemData.size(); idx++) - { - PropulsionSystemData x = _propulsionSystemData[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _vectoringSystemData.size(); idx++) - { - VectoringNozzleSystem x = _vectoringSystemData[idx]; - x.marshal(dataStream); - } - -} - -void SeesPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _orginatingEntityID.unmarshal(dataStream); - dataStream >> _infraredSignatureRepresentationIndex; - dataStream >> _acousticSignatureRepresentationIndex; - dataStream >> _radarCrossSectionSignatureRepresentationIndex; - dataStream >> _numberOfPropulsionSystems; - dataStream >> _numberOfVectoringNozzleSystems; - - _propulsionSystemData.clear(); - for(size_t idx = 0; idx < _numberOfPropulsionSystems; idx++) - { - PropulsionSystemData x; - x.unmarshal(dataStream); - _propulsionSystemData.push_back(x); - } - - _vectoringSystemData.clear(); - for(size_t idx = 0; idx < _numberOfVectoringNozzleSystems; idx++) - { - VectoringNozzleSystem x; - x.unmarshal(dataStream); - _vectoringSystemData.push_back(x); - } -} - - -bool SeesPdu::operator ==(const SeesPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_orginatingEntityID == rhs._orginatingEntityID) ) ivarsEqual = false; - if( ! (_infraredSignatureRepresentationIndex == rhs._infraredSignatureRepresentationIndex) ) ivarsEqual = false; - if( ! (_acousticSignatureRepresentationIndex == rhs._acousticSignatureRepresentationIndex) ) ivarsEqual = false; - if( ! (_radarCrossSectionSignatureRepresentationIndex == rhs._radarCrossSectionSignatureRepresentationIndex) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _propulsionSystemData.size(); idx++) - { - if( ! ( _propulsionSystemData[idx] == rhs._propulsionSystemData[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _vectoringSystemData.size(); idx++) - { - if( ! ( _vectoringSystemData[idx] == rhs._vectoringSystemData[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int SeesPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID - marshalSize = marshalSize + 2; // _infraredSignatureRepresentationIndex - marshalSize = marshalSize + 2; // _acousticSignatureRepresentationIndex - marshalSize = marshalSize + 2; // _radarCrossSectionSignatureRepresentationIndex - marshalSize = marshalSize + 2; // _numberOfPropulsionSystems - marshalSize = marshalSize + 2; // _numberOfVectoringNozzleSystems - - for(unsigned long long idx=0; idx < _propulsionSystemData.size(); idx++) - { - PropulsionSystemData listElement = _propulsionSystemData[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _vectoringSystemData.size(); idx++) - { - VectoringNozzleSystem listElement = _vectoringSystemData[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SeesPdu.h b/src/dis7/SeesPdu.h deleted file mode 100644 index e8e1576d..00000000 --- a/src/dis7/SeesPdu.h +++ /dev/null @@ -1,116 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// SEES PDU, supplemental emissions entity state information. Section 7.6.6 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SeesPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** Originating entity ID */ - EntityID _orginatingEntityID; - - /** IR Signature representation index */ - unsigned short _infraredSignatureRepresentationIndex; - - /** acoustic Signature representation index */ - unsigned short _acousticSignatureRepresentationIndex; - - /** radar cross section representation index */ - unsigned short _radarCrossSectionSignatureRepresentationIndex; - - /** how many propulsion systems */ - unsigned short _numberOfPropulsionSystems; - - /** how many vectoring nozzle systems */ - unsigned short _numberOfVectoringNozzleSystems; - - /** variable length list of propulsion system data */ - std::vector _propulsionSystemData; - - /** variable length list of vectoring system data */ - std::vector _vectoringSystemData; - - - public: - SeesPdu(); - virtual ~SeesPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOrginatingEntityID(); - const EntityID& getOrginatingEntityID() const; - void setOrginatingEntityID(const EntityID &pX); - - unsigned short getInfraredSignatureRepresentationIndex() const; - void setInfraredSignatureRepresentationIndex(unsigned short pX); - - unsigned short getAcousticSignatureRepresentationIndex() const; - void setAcousticSignatureRepresentationIndex(unsigned short pX); - - unsigned short getRadarCrossSectionSignatureRepresentationIndex() const; - void setRadarCrossSectionSignatureRepresentationIndex(unsigned short pX); - - unsigned short getNumberOfPropulsionSystems() const; - - unsigned short getNumberOfVectoringNozzleSystems() const; - - std::vector& getPropulsionSystemData(); - const std::vector& getPropulsionSystemData() const; - void setPropulsionSystemData(const std::vector& pX); - - std::vector& getVectoringSystemData(); - const std::vector& getVectoringSystemData() const; - void setVectoringSystemData(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SeesPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Sensor.cpp b/src/dis7/Sensor.cpp deleted file mode 100644 index 6321be75..00000000 --- a/src/dis7/Sensor.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -Sensor::Sensor(): - _sensorTypeSource(0), - _sensorOnOffStatus(0), - _sensorType(0), - _station(0), - _quantity(0), - _padding(0) -{ -} - -Sensor::~Sensor() -{ -} - -unsigned char Sensor::getSensorTypeSource() const -{ - return _sensorTypeSource; -} - -void Sensor::setSensorTypeSource(unsigned char pX) -{ - _sensorTypeSource = pX; -} - -unsigned char Sensor::getSensorOnOffStatus() const -{ - return _sensorOnOffStatus; -} - -void Sensor::setSensorOnOffStatus(unsigned char pX) -{ - _sensorOnOffStatus = pX; -} - -unsigned short Sensor::getSensorType() const -{ - return _sensorType; -} - -void Sensor::setSensorType(unsigned short pX) -{ - _sensorType = pX; -} - -unsigned int Sensor::getStation() const -{ - return _station; -} - -void Sensor::setStation(unsigned int pX) -{ - _station = pX; -} - -unsigned short Sensor::getQuantity() const -{ - return _quantity; -} - -void Sensor::setQuantity(unsigned short pX) -{ - _quantity = pX; -} - -unsigned short Sensor::getPadding() const -{ - return _padding; -} - -void Sensor::setPadding(unsigned short pX) -{ - _padding = pX; -} - -void Sensor::marshal(DataStream& dataStream) const -{ - dataStream << _sensorTypeSource; - dataStream << _sensorOnOffStatus; - dataStream << _sensorType; - dataStream << _station; - dataStream << _quantity; - dataStream << _padding; -} - -void Sensor::unmarshal(DataStream& dataStream) -{ - dataStream >> _sensorTypeSource; - dataStream >> _sensorOnOffStatus; - dataStream >> _sensorType; - dataStream >> _station; - dataStream >> _quantity; - dataStream >> _padding; -} - - -bool Sensor::operator ==(const Sensor& rhs) const - { - bool ivarsEqual = true; - - if( ! (_sensorTypeSource == rhs._sensorTypeSource) ) ivarsEqual = false; - if( ! (_sensorOnOffStatus == rhs._sensorOnOffStatus) ) ivarsEqual = false; - if( ! (_sensorType == rhs._sensorType) ) ivarsEqual = false; - if( ! (_station == rhs._station) ) ivarsEqual = false; - if( ! (_quantity == rhs._quantity) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Sensor::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _sensorTypeSource - marshalSize = marshalSize + 1; // _sensorOnOffStatus - marshalSize = marshalSize + 2; // _sensorType - marshalSize = marshalSize + 4; // _station - marshalSize = marshalSize + 2; // _quantity - marshalSize = marshalSize + 2; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Sensor.h b/src/dis7/Sensor.h deleted file mode 100644 index 309a2647..00000000 --- a/src/dis7/Sensor.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// An entity's sensor information. Section 6.2.77. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Sensor -{ -protected: - /** the source of the Sensor Type field */ - unsigned char _sensorTypeSource; - - /** the on/off status of the sensor */ - unsigned char _sensorOnOffStatus; - - /** the sensor type and shall be represented by a 16-bit enumeration. */ - unsigned short _sensorType; - - /** the station to which the sensor is assigned. A zero value shall indi- cate that this Sensor record is not associated with any particular station and represents the total quan- tity of this sensor for this entity. If this field is non-zero, it shall either reference an attached part or an articulated part */ - unsigned int _station; - - /** quantity of the sensor */ - unsigned short _quantity; - - /** padding */ - unsigned short _padding; - - - public: - Sensor(); - virtual ~Sensor(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getSensorTypeSource() const; - void setSensorTypeSource(unsigned char pX); - - unsigned char getSensorOnOffStatus() const; - void setSensorOnOffStatus(unsigned char pX); - - unsigned short getSensorType() const; - void setSensorType(unsigned short pX); - - unsigned int getStation() const; - void setStation(unsigned int pX); - - unsigned short getQuantity() const; - void setQuantity(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Sensor& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SeparationVP.cpp b/src/dis7/SeparationVP.cpp deleted file mode 100644 index db496f38..00000000 --- a/src/dis7/SeparationVP.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include - -using namespace DIS; - - -SeparationVP::SeparationVP(): - _recordType(4), - _reasonForSeparation(0), - _preEntityIndicator(0), - _padding1(0), - _parentEntityID(), - _padding2(0), - _stationLocation(0) -{ -} - -SeparationVP::~SeparationVP() -{ -} - -unsigned char SeparationVP::getRecordType() const -{ - return _recordType; -} - -void SeparationVP::setRecordType(unsigned char pX) -{ - _recordType = pX; -} - -unsigned char SeparationVP::getReasonForSeparation() const -{ - return _reasonForSeparation; -} - -void SeparationVP::setReasonForSeparation(unsigned char pX) -{ - _reasonForSeparation = pX; -} - -unsigned char SeparationVP::getPreEntityIndicator() const -{ - return _preEntityIndicator; -} - -void SeparationVP::setPreEntityIndicator(unsigned char pX) -{ - _preEntityIndicator = pX; -} - -unsigned char SeparationVP::getPadding1() const -{ - return _padding1; -} - -void SeparationVP::setPadding1(unsigned char pX) -{ - _padding1 = pX; -} - -EntityID& SeparationVP::getParentEntityID() -{ - return _parentEntityID; -} - -const EntityID& SeparationVP::getParentEntityID() const -{ - return _parentEntityID; -} - -void SeparationVP::setParentEntityID(const EntityID &pX) -{ - _parentEntityID = pX; -} - -unsigned short SeparationVP::getPadding2() const -{ - return _padding2; -} - -void SeparationVP::setPadding2(unsigned short pX) -{ - _padding2 = pX; -} - -unsigned int SeparationVP::getStationLocation() const -{ - return _stationLocation; -} - -void SeparationVP::setStationLocation(unsigned int pX) -{ - _stationLocation = pX; -} - -void SeparationVP::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _reasonForSeparation; - dataStream << _preEntityIndicator; - dataStream << _padding1; - _parentEntityID.marshal(dataStream); - dataStream << _padding2; - dataStream << _stationLocation; -} - -void SeparationVP::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _reasonForSeparation; - dataStream >> _preEntityIndicator; - dataStream >> _padding1; - _parentEntityID.unmarshal(dataStream); - dataStream >> _padding2; - dataStream >> _stationLocation; -} - - -bool SeparationVP::operator ==(const SeparationVP& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_reasonForSeparation == rhs._reasonForSeparation) ) ivarsEqual = false; - if( ! (_preEntityIndicator == rhs._preEntityIndicator) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_parentEntityID == rhs._parentEntityID) ) ivarsEqual = false; - if( ! (_padding2 == rhs._padding2) ) ivarsEqual = false; - if( ! (_stationLocation == rhs._stationLocation) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SeparationVP::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _recordType - marshalSize = marshalSize + 1; // _reasonForSeparation - marshalSize = marshalSize + 1; // _preEntityIndicator - marshalSize = marshalSize + 1; // _padding1 - marshalSize = marshalSize + _parentEntityID.getMarshalledSize(); // _parentEntityID - marshalSize = marshalSize + 2; // _padding2 - marshalSize = marshalSize + 4; // _stationLocation - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SeparationVP.h b/src/dis7/SeparationVP.h deleted file mode 100644 index 900b35e1..00000000 --- a/src/dis7/SeparationVP.h +++ /dev/null @@ -1,106 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Physical separation of an entity from another entity. Section 6.2.93.6 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SeparationVP -{ -protected: - /** the identification of the Variable Parameter record. Enumeration from EBV */ - unsigned char _recordType; - - /** Reason for separation. EBV */ - unsigned char _reasonForSeparation; - - /** Whether the entity existed prior to separation EBV */ - unsigned char _preEntityIndicator; - - /** padding */ - unsigned char _padding1; - - /** ID of parent */ - EntityID _parentEntityID; - - /** padding */ - unsigned short _padding2; - - /** Station separated from */ - unsigned int _stationLocation; - - - public: - SeparationVP(); - virtual ~SeparationVP(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRecordType() const; - void setRecordType(unsigned char pX); - - unsigned char getReasonForSeparation() const; - void setReasonForSeparation(unsigned char pX); - - unsigned char getPreEntityIndicator() const; - void setPreEntityIndicator(unsigned char pX); - - unsigned char getPadding1() const; - void setPadding1(unsigned char pX); - - EntityID& getParentEntityID(); - const EntityID& getParentEntityID() const; - void setParentEntityID(const EntityID &pX); - - unsigned short getPadding2() const; - void setPadding2(unsigned short pX); - - unsigned int getStationLocation() const; - void setStationLocation(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SeparationVP& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ServiceRequestPdu.cpp b/src/dis7/ServiceRequestPdu.cpp deleted file mode 100644 index 265a4fc6..00000000 --- a/src/dis7/ServiceRequestPdu.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include - -using namespace DIS; - - -ServiceRequestPdu::ServiceRequestPdu() : LogisticsFamilyPdu(), - _requestingEntityID(), - _servicingEntityID(), - _serviceTypeRequested(0), - _numberOfSupplyTypes(0), - _serviceRequestPadding(0) -{ - setPduType( 5 ); -} - -ServiceRequestPdu::~ServiceRequestPdu() -{ - _supplies.clear(); -} - -EntityID& ServiceRequestPdu::getRequestingEntityID() -{ - return _requestingEntityID; -} - -const EntityID& ServiceRequestPdu::getRequestingEntityID() const -{ - return _requestingEntityID; -} - -void ServiceRequestPdu::setRequestingEntityID(const EntityID &pX) -{ - _requestingEntityID = pX; -} - -EntityID& ServiceRequestPdu::getServicingEntityID() -{ - return _servicingEntityID; -} - -const EntityID& ServiceRequestPdu::getServicingEntityID() const -{ - return _servicingEntityID; -} - -void ServiceRequestPdu::setServicingEntityID(const EntityID &pX) -{ - _servicingEntityID = pX; -} - -unsigned char ServiceRequestPdu::getServiceTypeRequested() const -{ - return _serviceTypeRequested; -} - -void ServiceRequestPdu::setServiceTypeRequested(unsigned char pX) -{ - _serviceTypeRequested = pX; -} - -unsigned char ServiceRequestPdu::getNumberOfSupplyTypes() const -{ - return _supplies.size(); -} - -short ServiceRequestPdu::getServiceRequestPadding() const -{ - return _serviceRequestPadding; -} - -void ServiceRequestPdu::setServiceRequestPadding(short pX) -{ - _serviceRequestPadding = pX; -} - -std::vector& ServiceRequestPdu::getSupplies() -{ - return _supplies; -} - -const std::vector& ServiceRequestPdu::getSupplies() const -{ - return _supplies; -} - -void ServiceRequestPdu::setSupplies(const std::vector& pX) -{ - _supplies = pX; -} - -void ServiceRequestPdu::marshal(DataStream& dataStream) const -{ - LogisticsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _requestingEntityID.marshal(dataStream); - _servicingEntityID.marshal(dataStream); - dataStream << _serviceTypeRequested; - dataStream << ( unsigned char )_supplies.size(); - dataStream << _serviceRequestPadding; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - SupplyQuantity x = _supplies[idx]; - x.marshal(dataStream); - } - -} - -void ServiceRequestPdu::unmarshal(DataStream& dataStream) -{ - LogisticsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _requestingEntityID.unmarshal(dataStream); - _servicingEntityID.unmarshal(dataStream); - dataStream >> _serviceTypeRequested; - dataStream >> _numberOfSupplyTypes; - dataStream >> _serviceRequestPadding; - - _supplies.clear(); - for(size_t idx = 0; idx < _numberOfSupplyTypes; idx++) - { - SupplyQuantity x; - x.unmarshal(dataStream); - _supplies.push_back(x); - } -} - - -bool ServiceRequestPdu::operator ==(const ServiceRequestPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = LogisticsFamilyPdu::operator==(rhs); - - if( ! (_requestingEntityID == rhs._requestingEntityID) ) ivarsEqual = false; - if( ! (_servicingEntityID == rhs._servicingEntityID) ) ivarsEqual = false; - if( ! (_serviceTypeRequested == rhs._serviceTypeRequested) ) ivarsEqual = false; - if( ! (_serviceRequestPadding == rhs._serviceRequestPadding) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _supplies.size(); idx++) - { - if( ! ( _supplies[idx] == rhs._supplies[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int ServiceRequestPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = LogisticsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _requestingEntityID.getMarshalledSize(); // _requestingEntityID - marshalSize = marshalSize + _servicingEntityID.getMarshalledSize(); // _servicingEntityID - marshalSize = marshalSize + 1; // _serviceTypeRequested - marshalSize = marshalSize + 1; // _numberOfSupplyTypes - marshalSize = marshalSize + 2; // _serviceRequestPadding - - for(unsigned long long idx=0; idx < _supplies.size(); idx++) - { - SupplyQuantity listElement = _supplies[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ServiceRequestPdu.h b/src/dis7/ServiceRequestPdu.h deleted file mode 100644 index 032ef706..00000000 --- a/src/dis7/ServiceRequestPdu.h +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Service Request PDU shall be used to communicate information associated with one entity requesting a service from another). Section 7.4.2 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT ServiceRequestPdu : public LogisticsFamilyPdu -{ -protected: - /** Entity that is requesting service (see 6.2.28), Section 7.4.2 */ - EntityID _requestingEntityID; - - /** Entity that is providing the service (see 6.2.28), Section 7.4.2 */ - EntityID _servicingEntityID; - - /** Type of service requested, Section 7.4.2 */ - unsigned char _serviceTypeRequested; - - /** How many requested, Section 7.4.2 */ - unsigned char _numberOfSupplyTypes; - - /** padding */ - short _serviceRequestPadding; - - std::vector _supplies; - - - public: - ServiceRequestPdu(); - virtual ~ServiceRequestPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getRequestingEntityID(); - const EntityID& getRequestingEntityID() const; - void setRequestingEntityID(const EntityID &pX); - - EntityID& getServicingEntityID(); - const EntityID& getServicingEntityID() const; - void setServicingEntityID(const EntityID &pX); - - unsigned char getServiceTypeRequested() const; - void setServiceTypeRequested(unsigned char pX); - - unsigned char getNumberOfSupplyTypes() const; - - short getServiceRequestPadding() const; - void setServiceRequestPadding(short pX); - - std::vector& getSupplies(); - const std::vector& getSupplies() const; - void setSupplies(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const ServiceRequestPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SetDataPdu.cpp b/src/dis7/SetDataPdu.cpp deleted file mode 100644 index df804dc7..00000000 --- a/src/dis7/SetDataPdu.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include - -using namespace DIS; - - -SetDataPdu::SetDataPdu() : SimulationManagementFamilyPdu(), - _requestID(0), - _padding1(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 19 ); -} - -SetDataPdu::~SetDataPdu() -{ - _fixedDatums.clear(); - _variableDatums.clear(); -} - -unsigned int SetDataPdu::getRequestID() const -{ - return _requestID; -} - -void SetDataPdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int SetDataPdu::getPadding1() const -{ - return _padding1; -} - -void SetDataPdu::setPadding1(unsigned int pX) -{ - _padding1 = pX; -} - -unsigned int SetDataPdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatums.size(); -} - -unsigned int SetDataPdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatums.size(); -} - -std::vector& SetDataPdu::getFixedDatums() -{ - return _fixedDatums; -} - -const std::vector& SetDataPdu::getFixedDatums() const -{ - return _fixedDatums; -} - -void SetDataPdu::setFixedDatums(const std::vector& pX) -{ - _fixedDatums = pX; -} - -std::vector& SetDataPdu::getVariableDatums() -{ - return _variableDatums; -} - -const std::vector& SetDataPdu::getVariableDatums() const -{ - return _variableDatums; -} - -void SetDataPdu::setVariableDatums(const std::vector& pX) -{ - _variableDatums = pX; -} - -void SetDataPdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requestID; - dataStream << _padding1; - dataStream << ( unsigned int )_fixedDatums.size(); - dataStream << ( unsigned int )_variableDatums.size(); - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - FixedDatum x = _fixedDatums[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - VariableDatum x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void SetDataPdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requestID; - dataStream >> _padding1; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatums.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatums.push_back(x); - } - - _variableDatums.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool SetDataPdu::operator ==(const SetDataPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatums.size(); idx++) - { - if( ! ( _fixedDatums[idx] == rhs._fixedDatums[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - if( ! ( _variableDatums[idx] == rhs._variableDatums[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int SetDataPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _padding1 - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatums.size(); idx++) - { - FixedDatum listElement = _fixedDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatums.size(); idx++) - { - VariableDatum listElement = _variableDatums[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SetDataPdu.h b/src/dis7/SetDataPdu.h deleted file mode 100644 index 8854c814..00000000 --- a/src/dis7/SetDataPdu.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.10. Change state information with the data contained in this. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SetDataPdu : public SimulationManagementFamilyPdu -{ -protected: - /** ID of request */ - unsigned int _requestID; - - /** padding */ - unsigned int _padding1; - - /** Number of fixed datum records */ - unsigned int _numberOfFixedDatumRecords; - - /** Number of variable datum records */ - unsigned int _numberOfVariableDatumRecords; - - /** variable length list of fixed datums */ - std::vector _fixedDatums; - - /** variable length list of variable length datums */ - std::vector _variableDatums; - - - public: - SetDataPdu(); - virtual ~SetDataPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getPadding1() const; - void setPadding1(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatums(); - const std::vector& getFixedDatums() const; - void setFixedDatums(const std::vector& pX); - - std::vector& getVariableDatums(); - const std::vector& getVariableDatums() const; - void setVariableDatums(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SetDataPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SetDataReliablePdu.cpp b/src/dis7/SetDataReliablePdu.cpp deleted file mode 100644 index c691a4cd..00000000 --- a/src/dis7/SetDataReliablePdu.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include - -using namespace DIS; - - -SetDataReliablePdu::SetDataReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0), - _numberOfFixedDatumRecords(0), - _numberOfVariableDatumRecords(0) -{ - setPduType( 59 ); -} - -SetDataReliablePdu::~SetDataReliablePdu() -{ - _fixedDatumRecords.clear(); - _variableDatumRecords.clear(); -} - -unsigned char SetDataReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void SetDataReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short SetDataReliablePdu::getPad1() const -{ - return _pad1; -} - -void SetDataReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char SetDataReliablePdu::getPad2() const -{ - return _pad2; -} - -void SetDataReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int SetDataReliablePdu::getRequestID() const -{ - return _requestID; -} - -void SetDataReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -unsigned int SetDataReliablePdu::getNumberOfFixedDatumRecords() const -{ - return _fixedDatumRecords.size(); -} - -unsigned int SetDataReliablePdu::getNumberOfVariableDatumRecords() const -{ - return _variableDatumRecords.size(); -} - -std::vector& SetDataReliablePdu::getFixedDatumRecords() -{ - return _fixedDatumRecords; -} - -const std::vector& SetDataReliablePdu::getFixedDatumRecords() const -{ - return _fixedDatumRecords; -} - -void SetDataReliablePdu::setFixedDatumRecords(const std::vector& pX) -{ - _fixedDatumRecords = pX; -} - -std::vector& SetDataReliablePdu::getVariableDatumRecords() -{ - return _variableDatumRecords; -} - -const std::vector& SetDataReliablePdu::getVariableDatumRecords() const -{ - return _variableDatumRecords; -} - -void SetDataReliablePdu::setVariableDatumRecords(const std::vector& pX) -{ - _variableDatumRecords = pX; -} - -void SetDataReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; - dataStream << ( unsigned int )_fixedDatumRecords.size(); - dataStream << ( unsigned int )_variableDatumRecords.size(); - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum x = _fixedDatumRecords[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum x = _variableDatumRecords[idx]; - x.marshal(dataStream); - } - -} - -void SetDataReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; - dataStream >> _numberOfFixedDatumRecords; - dataStream >> _numberOfVariableDatumRecords; - - _fixedDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) - { - FixedDatum x; - x.unmarshal(dataStream); - _fixedDatumRecords.push_back(x); - } - - _variableDatumRecords.clear(); - for(size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) - { - VariableDatum x; - x.unmarshal(dataStream); - _variableDatumRecords.push_back(x); - } -} - - -bool SetDataReliablePdu::operator ==(const SetDataReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) - { - if( ! ( _fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _variableDatumRecords.size(); idx++) - { - if( ! ( _variableDatumRecords[idx] == rhs._variableDatumRecords[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int SetDataReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords - marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords - - for(unsigned long long idx=0; idx < _fixedDatumRecords.size(); idx++) - { - FixedDatum listElement = _fixedDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _variableDatumRecords.size(); idx++) - { - VariableDatum listElement = _variableDatumRecords[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SetDataReliablePdu.h b/src/dis7/SetDataReliablePdu.h deleted file mode 100644 index 6ea6b556..00000000 --- a/src/dis7/SetDataReliablePdu.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.9: initializing or chaning internal state information, reliable. Needs manual intervention to fix padding on variable datums. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SetDataReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Request ID */ - unsigned int _requestID; - - /** Fixed datum record count */ - unsigned int _numberOfFixedDatumRecords; - - /** variable datum record count */ - unsigned int _numberOfVariableDatumRecords; - - /** Fixed datum records */ - std::vector _fixedDatumRecords; - - /** Variable datum records */ - std::vector _variableDatumRecords; - - - public: - SetDataReliablePdu(); - virtual ~SetDataReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - unsigned int getNumberOfFixedDatumRecords() const; - - unsigned int getNumberOfVariableDatumRecords() const; - - std::vector& getFixedDatumRecords(); - const std::vector& getFixedDatumRecords() const; - void setFixedDatumRecords(const std::vector& pX); - - std::vector& getVariableDatumRecords(); - const std::vector& getVariableDatumRecords() const; - void setVariableDatumRecords(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SetDataReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationAddress.cpp b/src/dis7/SimulationAddress.cpp deleted file mode 100644 index dd4d70f5..00000000 --- a/src/dis7/SimulationAddress.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -SimulationAddress::SimulationAddress(): - _site(0), - _application(0) -{ -} - -SimulationAddress::~SimulationAddress() -{ -} - -unsigned short SimulationAddress::getSite() const -{ - return _site; -} - -void SimulationAddress::setSite(unsigned short pX) -{ - _site = pX; -} - -unsigned short SimulationAddress::getApplication() const -{ - return _application; -} - -void SimulationAddress::setApplication(unsigned short pX) -{ - _application = pX; -} - -void SimulationAddress::marshal(DataStream& dataStream) const -{ - dataStream << _site; - dataStream << _application; -} - -void SimulationAddress::unmarshal(DataStream& dataStream) -{ - dataStream >> _site; - dataStream >> _application; -} - - -bool SimulationAddress::operator ==(const SimulationAddress& rhs) const - { - bool ivarsEqual = true; - - if( ! (_site == rhs._site) ) ivarsEqual = false; - if( ! (_application == rhs._application) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SimulationAddress::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _site - marshalSize = marshalSize + 2; // _application - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationAddress.h b/src/dis7/SimulationAddress.h deleted file mode 100644 index 516d0205..00000000 --- a/src/dis7/SimulationAddress.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// A Simulation Address record shall consist of the Site Identification number and the Application Identification number. Section 6.2.79 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SimulationAddress -{ -protected: - /** A site is defined as a facility, installation, organizational unit or a geographic location that has one or more simulation applications capable of participating in a distributed event. */ - unsigned short _site; - - /** An application is defined as a software program that is used to generate and process distributed simulation data including live, virtual and constructive data. */ - unsigned short _application; - - - public: - SimulationAddress(); - virtual ~SimulationAddress(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSite() const; - void setSite(unsigned short pX); - - unsigned short getApplication() const; - void setApplication(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SimulationAddress& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationIdentifier.cpp b/src/dis7/SimulationIdentifier.cpp deleted file mode 100644 index 12c956c6..00000000 --- a/src/dis7/SimulationIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -SimulationIdentifier::SimulationIdentifier(): - _simulationAddress(), - _referenceNumber(0) -{ -} - -SimulationIdentifier::~SimulationIdentifier() -{ -} - -SimulationAddress& SimulationIdentifier::getSimulationAddress() -{ - return _simulationAddress; -} - -const SimulationAddress& SimulationIdentifier::getSimulationAddress() const -{ - return _simulationAddress; -} - -void SimulationIdentifier::setSimulationAddress(const SimulationAddress &pX) -{ - _simulationAddress = pX; -} - -unsigned short SimulationIdentifier::getReferenceNumber() const -{ - return _referenceNumber; -} - -void SimulationIdentifier::setReferenceNumber(unsigned short pX) -{ - _referenceNumber = pX; -} - -void SimulationIdentifier::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _referenceNumber; -} - -void SimulationIdentifier::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _referenceNumber; -} - - -bool SimulationIdentifier::operator ==(const SimulationIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_referenceNumber == rhs._referenceNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SimulationIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _referenceNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationIdentifier.h b/src/dis7/SimulationIdentifier.h deleted file mode 100644 index 3b7b44ff..00000000 --- a/src/dis7/SimulationIdentifier.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// The unique designation of a simulation when using the 48-bit identifier format shall be specified by the Sim- ulation Identifier record. The reason that the 48-bit format is required in addition to the 32-bit simulation address format that actually identifies a specific simulation is because some 48-bit identifier fields in PDUs may contain either an Object Identifier, such as an Entity ID, or a Simulation Identifier. Section 6.2.80 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SimulationIdentifier -{ -protected: - /** Simulation address */ - SimulationAddress _simulationAddress; - - /** This field shall be set to zero as there is no reference number associated with a Simulation Identifier. */ - unsigned short _referenceNumber; - - - public: - SimulationIdentifier(); - virtual ~SimulationIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getSimulationAddress(); - const SimulationAddress& getSimulationAddress() const; - void setSimulationAddress(const SimulationAddress &pX); - - unsigned short getReferenceNumber() const; - void setReferenceNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SimulationIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationManagementFamilyPdu.cpp b/src/dis7/SimulationManagementFamilyPdu.cpp deleted file mode 100644 index ab41debd..00000000 --- a/src/dis7/SimulationManagementFamilyPdu.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -using namespace DIS; - - -SimulationManagementFamilyPdu::SimulationManagementFamilyPdu() : Pdu(), - _originatingEntityID(), - _receivingEntityID() -{ - setProtocolFamily( 5 ); -} - -SimulationManagementFamilyPdu::~SimulationManagementFamilyPdu() -{ -} - -EntityID& SimulationManagementFamilyPdu::getOriginatingEntityID() -{ - return _originatingEntityID; -} - -const EntityID& SimulationManagementFamilyPdu::getOriginatingEntityID() const -{ - return _originatingEntityID; -} - -void SimulationManagementFamilyPdu::setOriginatingEntityID(const EntityID &pX) -{ - _originatingEntityID = pX; -} - -EntityID& SimulationManagementFamilyPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& SimulationManagementFamilyPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void SimulationManagementFamilyPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -void SimulationManagementFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first - _originatingEntityID.marshal(dataStream); - _receivingEntityID.marshal(dataStream); -} - -void SimulationManagementFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingEntityID.unmarshal(dataStream); - _receivingEntityID.unmarshal(dataStream); -} - - -bool SimulationManagementFamilyPdu::operator ==(const SimulationManagementFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - if( ! (_originatingEntityID == rhs._originatingEntityID) ) ivarsEqual = false; - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SimulationManagementFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingEntityID.getMarshalledSize(); // _originatingEntityID - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationManagementFamilyPdu.h b/src/dis7/SimulationManagementFamilyPdu.h deleted file mode 100644 index 7bc913e5..00000000 --- a/src/dis7/SimulationManagementFamilyPdu.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5 Abstract superclass for PDUs relating to the simulation itself. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SimulationManagementFamilyPdu : public Pdu -{ -protected: - /** Entity that is sending message */ - EntityID _originatingEntityID; - - /** Entity that is intended to receive message */ - EntityID _receivingEntityID; - - - public: - SimulationManagementFamilyPdu(); - virtual ~SimulationManagementFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingEntityID(); - const EntityID& getOriginatingEntityID() const; - void setOriginatingEntityID(const EntityID &pX); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SimulationManagementFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationManagementPduHeader.cpp b/src/dis7/SimulationManagementPduHeader.cpp deleted file mode 100644 index 623e8527..00000000 --- a/src/dis7/SimulationManagementPduHeader.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -SimulationManagementPduHeader::SimulationManagementPduHeader(): - _pduHeader(), - _originatingID(), - _recevingID() -{ -} - -SimulationManagementPduHeader::~SimulationManagementPduHeader() -{ -} - -PduHeader& SimulationManagementPduHeader::getPduHeader() -{ - return _pduHeader; -} - -const PduHeader& SimulationManagementPduHeader::getPduHeader() const -{ - return _pduHeader; -} - -void SimulationManagementPduHeader::setPduHeader(const PduHeader &pX) -{ - _pduHeader = pX; -} - -EntityID& SimulationManagementPduHeader::getOriginatingID() -{ - return _originatingID; -} - -const EntityID& SimulationManagementPduHeader::getOriginatingID() const -{ - return _originatingID; -} - -void SimulationManagementPduHeader::setOriginatingID(const EntityID &pX) -{ - _originatingID = pX; -} - -EntityID& SimulationManagementPduHeader::getRecevingID() -{ - return _recevingID; -} - -const EntityID& SimulationManagementPduHeader::getRecevingID() const -{ - return _recevingID; -} - -void SimulationManagementPduHeader::setRecevingID(const EntityID &pX) -{ - _recevingID = pX; -} - -void SimulationManagementPduHeader::marshal(DataStream& dataStream) const -{ - _pduHeader.marshal(dataStream); - _originatingID.marshal(dataStream); - _recevingID.marshal(dataStream); -} - -void SimulationManagementPduHeader::unmarshal(DataStream& dataStream) -{ - _pduHeader.unmarshal(dataStream); - _originatingID.unmarshal(dataStream); - _recevingID.unmarshal(dataStream); -} - - -bool SimulationManagementPduHeader::operator ==(const SimulationManagementPduHeader& rhs) const - { - bool ivarsEqual = true; - - if( ! (_pduHeader == rhs._pduHeader) ) ivarsEqual = false; - if( ! (_originatingID == rhs._originatingID) ) ivarsEqual = false; - if( ! (_recevingID == rhs._recevingID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SimulationManagementPduHeader::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _pduHeader.getMarshalledSize(); // _pduHeader - marshalSize = marshalSize + _originatingID.getMarshalledSize(); // _originatingID - marshalSize = marshalSize + _recevingID.getMarshalledSize(); // _recevingID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationManagementPduHeader.h b/src/dis7/SimulationManagementPduHeader.h deleted file mode 100644 index 010aa468..00000000 --- a/src/dis7/SimulationManagementPduHeader.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// First part of a simulation management (SIMAN) PDU and SIMAN-Reliability (SIMAN-R) PDU. Sectionn 6.2.81 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SimulationManagementPduHeader -{ -protected: - /** Conventional PDU header */ - PduHeader _pduHeader; - - /** IDs the simulation or entity, etiehr a simulation or an entity. Either 6.2.80 or 6.2.28 */ - EntityID _originatingID; - - /** simulation, all simulations, a special ID, or an entity. See 5.6.5 and 5.12.4 */ - EntityID _recevingID; - - - public: - SimulationManagementPduHeader(); - virtual ~SimulationManagementPduHeader(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - PduHeader& getPduHeader(); - const PduHeader& getPduHeader() const; - void setPduHeader(const PduHeader &pX); - - EntityID& getOriginatingID(); - const EntityID& getOriginatingID() const; - void setOriginatingID(const EntityID &pX); - - EntityID& getRecevingID(); - const EntityID& getRecevingID() const; - void setRecevingID(const EntityID &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SimulationManagementPduHeader& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationManagementWithReliabilityFamilyPdu.cpp b/src/dis7/SimulationManagementWithReliabilityFamilyPdu.cpp deleted file mode 100644 index d1dc95f1..00000000 --- a/src/dis7/SimulationManagementWithReliabilityFamilyPdu.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -using namespace DIS; - - -SimulationManagementWithReliabilityFamilyPdu::SimulationManagementWithReliabilityFamilyPdu() : Pdu(), - _originatingEntityID(), - _receivingEntityID() -{ - setProtocolFamily( 10 ); -} - -SimulationManagementWithReliabilityFamilyPdu::~SimulationManagementWithReliabilityFamilyPdu() -{ -} - -EntityID& SimulationManagementWithReliabilityFamilyPdu::getOriginatingEntityID() -{ - return _originatingEntityID; -} - -const EntityID& SimulationManagementWithReliabilityFamilyPdu::getOriginatingEntityID() const -{ - return _originatingEntityID; -} - -void SimulationManagementWithReliabilityFamilyPdu::setOriginatingEntityID(const EntityID &pX) -{ - _originatingEntityID = pX; -} - -EntityID& SimulationManagementWithReliabilityFamilyPdu::getReceivingEntityID() -{ - return _receivingEntityID; -} - -const EntityID& SimulationManagementWithReliabilityFamilyPdu::getReceivingEntityID() const -{ - return _receivingEntityID; -} - -void SimulationManagementWithReliabilityFamilyPdu::setReceivingEntityID(const EntityID &pX) -{ - _receivingEntityID = pX; -} - -void SimulationManagementWithReliabilityFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first - _originatingEntityID.marshal(dataStream); - _receivingEntityID.marshal(dataStream); -} - -void SimulationManagementWithReliabilityFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingEntityID.unmarshal(dataStream); - _receivingEntityID.unmarshal(dataStream); -} - - -bool SimulationManagementWithReliabilityFamilyPdu::operator ==(const SimulationManagementWithReliabilityFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - if( ! (_originatingEntityID == rhs._originatingEntityID) ) ivarsEqual = false; - if( ! (_receivingEntityID == rhs._receivingEntityID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingEntityID.getMarshalledSize(); // _originatingEntityID - marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SimulationManagementWithReliabilityFamilyPdu.h b/src/dis7/SimulationManagementWithReliabilityFamilyPdu.h deleted file mode 100644 index bccdcd93..00000000 --- a/src/dis7/SimulationManagementWithReliabilityFamilyPdu.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12: Abstract superclass for reliable simulation management PDUs - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SimulationManagementWithReliabilityFamilyPdu : public Pdu -{ -protected: - /** Object originatig the request */ - EntityID _originatingEntityID; - - /** Object with which this point object is associated */ - EntityID _receivingEntityID; - - - public: - SimulationManagementWithReliabilityFamilyPdu(); - virtual ~SimulationManagementWithReliabilityFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingEntityID(); - const EntityID& getOriginatingEntityID() const; - void setOriginatingEntityID(const EntityID &pX); - - EntityID& getReceivingEntityID(); - const EntityID& getReceivingEntityID() const; - void setReceivingEntityID(const EntityID &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SimulationManagementWithReliabilityFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StandardVariableSpecification.cpp b/src/dis7/StandardVariableSpecification.cpp deleted file mode 100644 index ed91196b..00000000 --- a/src/dis7/StandardVariableSpecification.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include - -using namespace DIS; - - -StandardVariableSpecification::StandardVariableSpecification(): - _numberOfStandardVariableRecords(0) -{ -} - -StandardVariableSpecification::~StandardVariableSpecification() -{ - _standardVariables.clear(); -} - -unsigned short StandardVariableSpecification::getNumberOfStandardVariableRecords() const -{ - return _standardVariables.size(); -} - -std::vector& StandardVariableSpecification::getStandardVariables() -{ - return _standardVariables; -} - -const std::vector& StandardVariableSpecification::getStandardVariables() const -{ - return _standardVariables; -} - -void StandardVariableSpecification::setStandardVariables(const std::vector& pX) -{ - _standardVariables = pX; -} - -void StandardVariableSpecification::marshal(DataStream& dataStream) const -{ - dataStream << ( unsigned short )_standardVariables.size(); - - for(size_t idx = 0; idx < _standardVariables.size(); idx++) - { - SimulationManagementPduHeader x = _standardVariables[idx]; - x.marshal(dataStream); - } - -} - -void StandardVariableSpecification::unmarshal(DataStream& dataStream) -{ - dataStream >> _numberOfStandardVariableRecords; - - _standardVariables.clear(); - for(size_t idx = 0; idx < _numberOfStandardVariableRecords; idx++) - { - SimulationManagementPduHeader x; - x.unmarshal(dataStream); - _standardVariables.push_back(x); - } -} - - -bool StandardVariableSpecification::operator ==(const StandardVariableSpecification& rhs) const - { - bool ivarsEqual = true; - - - for(size_t idx = 0; idx < _standardVariables.size(); idx++) - { - if( ! ( _standardVariables[idx] == rhs._standardVariables[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int StandardVariableSpecification::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _numberOfStandardVariableRecords - - for(unsigned long long idx=0; idx < _standardVariables.size(); idx++) - { - SimulationManagementPduHeader listElement = _standardVariables[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StandardVariableSpecification.h b/src/dis7/StandardVariableSpecification.h deleted file mode 100644 index f6a898f2..00000000 --- a/src/dis7/StandardVariableSpecification.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Does not work, and causes failure in anything it is embedded in. Section 6.2.82 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT StandardVariableSpecification -{ -protected: - /** Number of static variable records */ - unsigned short _numberOfStandardVariableRecords; - - /** variable length list of standard variables, The class type and length here are WRONG and will cause the incorrect serialization of any class in whihc it is embedded. */ - std::vector _standardVariables; - - - public: - StandardVariableSpecification(); - virtual ~StandardVariableSpecification(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getNumberOfStandardVariableRecords() const; - - std::vector& getStandardVariables(); - const std::vector& getStandardVariables() const; - void setStandardVariables(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StandardVariableSpecification& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StartResumePdu.cpp b/src/dis7/StartResumePdu.cpp deleted file mode 100644 index a02fb954..00000000 --- a/src/dis7/StartResumePdu.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#include - -using namespace DIS; - - -StartResumePdu::StartResumePdu() : SimulationManagementFamilyPdu(), - _originatingID(), - _receivingID(), - _realWorldTime(), - _simulationTime(), - _requestID(0) -{ - setPduType( 13 ); -} - -StartResumePdu::~StartResumePdu() -{ -} - -EntityID& StartResumePdu::getOriginatingID() -{ - return _originatingID; -} - -const EntityID& StartResumePdu::getOriginatingID() const -{ - return _originatingID; -} - -void StartResumePdu::setOriginatingID(const EntityID &pX) -{ - _originatingID = pX; -} - -EntityID& StartResumePdu::getReceivingID() -{ - return _receivingID; -} - -const EntityID& StartResumePdu::getReceivingID() const -{ - return _receivingID; -} - -void StartResumePdu::setReceivingID(const EntityID &pX) -{ - _receivingID = pX; -} - -ClockTime& StartResumePdu::getRealWorldTime() -{ - return _realWorldTime; -} - -const ClockTime& StartResumePdu::getRealWorldTime() const -{ - return _realWorldTime; -} - -void StartResumePdu::setRealWorldTime(const ClockTime &pX) -{ - _realWorldTime = pX; -} - -ClockTime& StartResumePdu::getSimulationTime() -{ - return _simulationTime; -} - -const ClockTime& StartResumePdu::getSimulationTime() const -{ - return _simulationTime; -} - -void StartResumePdu::setSimulationTime(const ClockTime &pX) -{ - _simulationTime = pX; -} - -unsigned int StartResumePdu::getRequestID() const -{ - return _requestID; -} - -void StartResumePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void StartResumePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _originatingID.marshal(dataStream); - _receivingID.marshal(dataStream); - _realWorldTime.marshal(dataStream); - _simulationTime.marshal(dataStream); - dataStream << _requestID; -} - -void StartResumePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - _realWorldTime.unmarshal(dataStream); - _simulationTime.unmarshal(dataStream); - dataStream >> _requestID; -} - - -bool StartResumePdu::operator ==(const StartResumePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_originatingID == rhs._originatingID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_realWorldTime == rhs._realWorldTime) ) ivarsEqual = false; - if( ! (_simulationTime == rhs._simulationTime) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StartResumePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingID.getMarshalledSize(); // _originatingID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime - marshalSize = marshalSize + _simulationTime.getMarshalledSize(); // _simulationTime - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StartResumePdu.h b/src/dis7/StartResumePdu.h deleted file mode 100644 index 0fc7d949..00000000 --- a/src/dis7/StartResumePdu.h +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.4. Start or resume an exercise. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT StartResumePdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for originating entity(or simulation) */ - EntityID _originatingID; - - /** Identifier for the receiving entity(or simulation) */ - EntityID _receivingID; - - /** This field shall specify the real-world time (UTC) at which the entity is to start/resume in the exercise. This information shall be used by the participating simulation applications to start/resume an exercise synchronously. This field shall be represented by a Clock Time record (see 6.2.16). */ - ClockTime _realWorldTime; - - /** The reference time within a simulation exercise. This time is established ahead of time by simulation management and is common to all participants in a particular exercise. Simulation time may be either Absolute Time or Relative Time. This field shall be represented by a Clock Time record (see 6.2.16) */ - ClockTime _simulationTime; - - /** Identifier for the specific and unique start/resume request */ - unsigned int _requestID; - - - public: - StartResumePdu(); - virtual ~StartResumePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingID(); - const EntityID& getOriginatingID() const; - void setOriginatingID(const EntityID &pX); - - EntityID& getReceivingID(); - const EntityID& getReceivingID() const; - void setReceivingID(const EntityID &pX); - - ClockTime& getRealWorldTime(); - const ClockTime& getRealWorldTime() const; - void setRealWorldTime(const ClockTime &pX); - - ClockTime& getSimulationTime(); - const ClockTime& getSimulationTime() const; - void setSimulationTime(const ClockTime &pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StartResumePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StartResumeReliablePdu.cpp b/src/dis7/StartResumeReliablePdu.cpp deleted file mode 100644 index b9f1d0fb..00000000 --- a/src/dis7/StartResumeReliablePdu.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include - -using namespace DIS; - - -StartResumeReliablePdu::StartResumeReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _realWorldTime(), - _simulationTime(), - _requiredReliabilityService(0), - _pad1(0), - _pad2(0), - _requestID(0) -{ - setPduType( 53 ); -} - -StartResumeReliablePdu::~StartResumeReliablePdu() -{ -} - -ClockTime& StartResumeReliablePdu::getRealWorldTime() -{ - return _realWorldTime; -} - -const ClockTime& StartResumeReliablePdu::getRealWorldTime() const -{ - return _realWorldTime; -} - -void StartResumeReliablePdu::setRealWorldTime(const ClockTime &pX) -{ - _realWorldTime = pX; -} - -ClockTime& StartResumeReliablePdu::getSimulationTime() -{ - return _simulationTime; -} - -const ClockTime& StartResumeReliablePdu::getSimulationTime() const -{ - return _simulationTime; -} - -void StartResumeReliablePdu::setSimulationTime(const ClockTime &pX) -{ - _simulationTime = pX; -} - -unsigned char StartResumeReliablePdu::getRequiredReliabilityService() const -{ - return _requiredReliabilityService; -} - -void StartResumeReliablePdu::setRequiredReliabilityService(unsigned char pX) -{ - _requiredReliabilityService = pX; -} - -unsigned short StartResumeReliablePdu::getPad1() const -{ - return _pad1; -} - -void StartResumeReliablePdu::setPad1(unsigned short pX) -{ - _pad1 = pX; -} - -unsigned char StartResumeReliablePdu::getPad2() const -{ - return _pad2; -} - -void StartResumeReliablePdu::setPad2(unsigned char pX) -{ - _pad2 = pX; -} - -unsigned int StartResumeReliablePdu::getRequestID() const -{ - return _requestID; -} - -void StartResumeReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void StartResumeReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _realWorldTime.marshal(dataStream); - _simulationTime.marshal(dataStream); - dataStream << _requiredReliabilityService; - dataStream << _pad1; - dataStream << _pad2; - dataStream << _requestID; -} - -void StartResumeReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _realWorldTime.unmarshal(dataStream); - _simulationTime.unmarshal(dataStream); - dataStream >> _requiredReliabilityService; - dataStream >> _pad1; - dataStream >> _pad2; - dataStream >> _requestID; -} - - -bool StartResumeReliablePdu::operator ==(const StartResumeReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_realWorldTime == rhs._realWorldTime) ) ivarsEqual = false; - if( ! (_simulationTime == rhs._simulationTime) ) ivarsEqual = false; - if( ! (_requiredReliabilityService == rhs._requiredReliabilityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_pad2 == rhs._pad2) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StartResumeReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime - marshalSize = marshalSize + _simulationTime.getMarshalledSize(); // _simulationTime - marshalSize = marshalSize + 1; // _requiredReliabilityService - marshalSize = marshalSize + 2; // _pad1 - marshalSize = marshalSize + 1; // _pad2 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StartResumeReliablePdu.h b/src/dis7/StartResumeReliablePdu.h deleted file mode 100644 index 7717d011..00000000 --- a/src/dis7/StartResumeReliablePdu.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.3: Start resume simulation, relaible. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT StartResumeReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** time in real world for this operation to happen */ - ClockTime _realWorldTime; - - /** time in simulation for the simulation to resume */ - ClockTime _simulationTime; - - /** level of reliability service used for this transaction */ - unsigned char _requiredReliabilityService; - - /** padding */ - unsigned short _pad1; - - /** padding */ - unsigned char _pad2; - - /** Request ID */ - unsigned int _requestID; - - - public: - StartResumeReliablePdu(); - virtual ~StartResumeReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - ClockTime& getRealWorldTime(); - const ClockTime& getRealWorldTime() const; - void setRealWorldTime(const ClockTime &pX); - - ClockTime& getSimulationTime(); - const ClockTime& getSimulationTime() const; - void setSimulationTime(const ClockTime &pX); - - unsigned char getRequiredReliabilityService() const; - void setRequiredReliabilityService(unsigned char pX); - - unsigned short getPad1() const; - void setPad1(unsigned short pX); - - unsigned char getPad2() const; - void setPad2(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StartResumeReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StopFreezePdu.cpp b/src/dis7/StopFreezePdu.cpp deleted file mode 100644 index 56972215..00000000 --- a/src/dis7/StopFreezePdu.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include - -using namespace DIS; - - -StopFreezePdu::StopFreezePdu() : SimulationManagementFamilyPdu(), - _originatingID(), - _receivingID(), - _realWorldTime(), - _reason(0), - _frozenBehavior(0), - _padding1(0), - _requestID(0) -{ - setPduType( 14 ); -} - -StopFreezePdu::~StopFreezePdu() -{ -} - -EntityID& StopFreezePdu::getOriginatingID() -{ - return _originatingID; -} - -const EntityID& StopFreezePdu::getOriginatingID() const -{ - return _originatingID; -} - -void StopFreezePdu::setOriginatingID(const EntityID &pX) -{ - _originatingID = pX; -} - -EntityID& StopFreezePdu::getReceivingID() -{ - return _receivingID; -} - -const EntityID& StopFreezePdu::getReceivingID() const -{ - return _receivingID; -} - -void StopFreezePdu::setReceivingID(const EntityID &pX) -{ - _receivingID = pX; -} - -ClockTime& StopFreezePdu::getRealWorldTime() -{ - return _realWorldTime; -} - -const ClockTime& StopFreezePdu::getRealWorldTime() const -{ - return _realWorldTime; -} - -void StopFreezePdu::setRealWorldTime(const ClockTime &pX) -{ - _realWorldTime = pX; -} - -unsigned char StopFreezePdu::getReason() const -{ - return _reason; -} - -void StopFreezePdu::setReason(unsigned char pX) -{ - _reason = pX; -} - -unsigned char StopFreezePdu::getFrozenBehavior() const -{ - return _frozenBehavior; -} - -void StopFreezePdu::setFrozenBehavior(unsigned char pX) -{ - _frozenBehavior = pX; -} - -short StopFreezePdu::getPadding1() const -{ - return _padding1; -} - -void StopFreezePdu::setPadding1(short pX) -{ - _padding1 = pX; -} - -unsigned int StopFreezePdu::getRequestID() const -{ - return _requestID; -} - -void StopFreezePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void StopFreezePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _originatingID.marshal(dataStream); - _receivingID.marshal(dataStream); - _realWorldTime.marshal(dataStream); - dataStream << _reason; - dataStream << _frozenBehavior; - dataStream << _padding1; - dataStream << _requestID; -} - -void StopFreezePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _originatingID.unmarshal(dataStream); - _receivingID.unmarshal(dataStream); - _realWorldTime.unmarshal(dataStream); - dataStream >> _reason; - dataStream >> _frozenBehavior; - dataStream >> _padding1; - dataStream >> _requestID; -} - - -bool StopFreezePdu::operator ==(const StopFreezePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); - - if( ! (_originatingID == rhs._originatingID) ) ivarsEqual = false; - if( ! (_receivingID == rhs._receivingID) ) ivarsEqual = false; - if( ! (_realWorldTime == rhs._realWorldTime) ) ivarsEqual = false; - if( ! (_reason == rhs._reason) ) ivarsEqual = false; - if( ! (_frozenBehavior == rhs._frozenBehavior) ) ivarsEqual = false; - if( ! (_padding1 == rhs._padding1) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StopFreezePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _originatingID.getMarshalledSize(); // _originatingID - marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID - marshalSize = marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime - marshalSize = marshalSize + 1; // _reason - marshalSize = marshalSize + 1; // _frozenBehavior - marshalSize = marshalSize + 2; // _padding1 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StopFreezePdu.h b/src/dis7/StopFreezePdu.h deleted file mode 100644 index 9b97c6e0..00000000 --- a/src/dis7/StopFreezePdu.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Section 7.5.5. Stop or freeze an enity (or exercise). COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT StopFreezePdu : public SimulationManagementFamilyPdu -{ -protected: - /** Identifier for originating entity(or simulation) */ - EntityID _originatingID; - - /** Identifier for the receiving entity(or simulation) */ - EntityID _receivingID; - - /** real-world(UTC) time at which the entity shall stop or freeze in the exercise */ - ClockTime _realWorldTime; - - /** Reason the simulation was stopped or frozen (see section 7 of SISO-REF-010) represented by an 8-bit enumeration */ - unsigned char _reason; - - /** Internal behavior of the entity(or simulation) and its appearance while frozen to the other participants */ - unsigned char _frozenBehavior; - - /** padding */ - short _padding1; - - /** Request ID that is unique */ - unsigned int _requestID; - - - public: - StopFreezePdu(); - virtual ~StopFreezePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getOriginatingID(); - const EntityID& getOriginatingID() const; - void setOriginatingID(const EntityID &pX); - - EntityID& getReceivingID(); - const EntityID& getReceivingID() const; - void setReceivingID(const EntityID &pX); - - ClockTime& getRealWorldTime(); - const ClockTime& getRealWorldTime() const; - void setRealWorldTime(const ClockTime &pX); - - unsigned char getReason() const; - void setReason(unsigned char pX); - - unsigned char getFrozenBehavior() const; - void setFrozenBehavior(unsigned char pX); - - short getPadding1() const; - void setPadding1(short pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StopFreezePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StopFreezeReliablePdu.cpp b/src/dis7/StopFreezeReliablePdu.cpp deleted file mode 100644 index dd298eaf..00000000 --- a/src/dis7/StopFreezeReliablePdu.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#include - -using namespace DIS; - - -StopFreezeReliablePdu::StopFreezeReliablePdu() : SimulationManagementWithReliabilityFamilyPdu(), - _realWorldTime(), - _reason(0), - _frozenBehavior(0), - _requiredReliablityService(0), - _pad1(0), - _requestID(0) -{ - setPduType( 54 ); -} - -StopFreezeReliablePdu::~StopFreezeReliablePdu() -{ -} - -ClockTime& StopFreezeReliablePdu::getRealWorldTime() -{ - return _realWorldTime; -} - -const ClockTime& StopFreezeReliablePdu::getRealWorldTime() const -{ - return _realWorldTime; -} - -void StopFreezeReliablePdu::setRealWorldTime(const ClockTime &pX) -{ - _realWorldTime = pX; -} - -unsigned char StopFreezeReliablePdu::getReason() const -{ - return _reason; -} - -void StopFreezeReliablePdu::setReason(unsigned char pX) -{ - _reason = pX; -} - -unsigned char StopFreezeReliablePdu::getFrozenBehavior() const -{ - return _frozenBehavior; -} - -void StopFreezeReliablePdu::setFrozenBehavior(unsigned char pX) -{ - _frozenBehavior = pX; -} - -unsigned char StopFreezeReliablePdu::getRequiredReliablityService() const -{ - return _requiredReliablityService; -} - -void StopFreezeReliablePdu::setRequiredReliablityService(unsigned char pX) -{ - _requiredReliablityService = pX; -} - -unsigned char StopFreezeReliablePdu::getPad1() const -{ - return _pad1; -} - -void StopFreezeReliablePdu::setPad1(unsigned char pX) -{ - _pad1 = pX; -} - -unsigned int StopFreezeReliablePdu::getRequestID() const -{ - return _requestID; -} - -void StopFreezeReliablePdu::setRequestID(unsigned int pX) -{ - _requestID = pX; -} - -void StopFreezeReliablePdu::marshal(DataStream& dataStream) const -{ - SimulationManagementWithReliabilityFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _realWorldTime.marshal(dataStream); - dataStream << _reason; - dataStream << _frozenBehavior; - dataStream << _requiredReliablityService; - dataStream << _pad1; - dataStream << _requestID; -} - -void StopFreezeReliablePdu::unmarshal(DataStream& dataStream) -{ - SimulationManagementWithReliabilityFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _realWorldTime.unmarshal(dataStream); - dataStream >> _reason; - dataStream >> _frozenBehavior; - dataStream >> _requiredReliablityService; - dataStream >> _pad1; - dataStream >> _requestID; -} - - -bool StopFreezeReliablePdu::operator ==(const StopFreezeReliablePdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); - - if( ! (_realWorldTime == rhs._realWorldTime) ) ivarsEqual = false; - if( ! (_reason == rhs._reason) ) ivarsEqual = false; - if( ! (_frozenBehavior == rhs._frozenBehavior) ) ivarsEqual = false; - if( ! (_requiredReliablityService == rhs._requiredReliablityService) ) ivarsEqual = false; - if( ! (_pad1 == rhs._pad1) ) ivarsEqual = false; - if( ! (_requestID == rhs._requestID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StopFreezeReliablePdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime - marshalSize = marshalSize + 1; // _reason - marshalSize = marshalSize + 1; // _frozenBehavior - marshalSize = marshalSize + 1; // _requiredReliablityService - marshalSize = marshalSize + 1; // _pad1 - marshalSize = marshalSize + 4; // _requestID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StopFreezeReliablePdu.h b/src/dis7/StopFreezeReliablePdu.h deleted file mode 100644 index 4905dfbb..00000000 --- a/src/dis7/StopFreezeReliablePdu.h +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.12.4: Stop freeze simulation, relaible. COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT StopFreezeReliablePdu : public SimulationManagementWithReliabilityFamilyPdu -{ -protected: - /** time in real world for this operation to happen */ - ClockTime _realWorldTime; - - /** Reason for stopping/freezing simulation */ - unsigned char _reason; - - /** internal behvior of the simulation while frozen */ - unsigned char _frozenBehavior; - - /** reliablity level */ - unsigned char _requiredReliablityService; - - /** padding */ - unsigned char _pad1; - - /** Request ID */ - unsigned int _requestID; - - - public: - StopFreezeReliablePdu(); - virtual ~StopFreezeReliablePdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - ClockTime& getRealWorldTime(); - const ClockTime& getRealWorldTime() const; - void setRealWorldTime(const ClockTime &pX); - - unsigned char getReason() const; - void setReason(unsigned char pX); - - unsigned char getFrozenBehavior() const; - void setFrozenBehavior(unsigned char pX); - - unsigned char getRequiredReliablityService() const; - void setRequiredReliablityService(unsigned char pX); - - unsigned char getPad1() const; - void setPad1(unsigned char pX); - - unsigned int getRequestID() const; - void setRequestID(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StopFreezeReliablePdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StorageFuel.cpp b/src/dis7/StorageFuel.cpp deleted file mode 100644 index 5cf75407..00000000 --- a/src/dis7/StorageFuel.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -StorageFuel::StorageFuel(): - _fuelQuantity(0), - _fuelMeasurementUnits(0), - _fuelType(0), - _fuelLocation(0), - _padding(0) -{ -} - -StorageFuel::~StorageFuel() -{ -} - -unsigned int StorageFuel::getFuelQuantity() const -{ - return _fuelQuantity; -} - -void StorageFuel::setFuelQuantity(unsigned int pX) -{ - _fuelQuantity = pX; -} - -unsigned char StorageFuel::getFuelMeasurementUnits() const -{ - return _fuelMeasurementUnits; -} - -void StorageFuel::setFuelMeasurementUnits(unsigned char pX) -{ - _fuelMeasurementUnits = pX; -} - -unsigned char StorageFuel::getFuelType() const -{ - return _fuelType; -} - -void StorageFuel::setFuelType(unsigned char pX) -{ - _fuelType = pX; -} - -unsigned char StorageFuel::getFuelLocation() const -{ - return _fuelLocation; -} - -void StorageFuel::setFuelLocation(unsigned char pX) -{ - _fuelLocation = pX; -} - -unsigned char StorageFuel::getPadding() const -{ - return _padding; -} - -void StorageFuel::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void StorageFuel::marshal(DataStream& dataStream) const -{ - dataStream << _fuelQuantity; - dataStream << _fuelMeasurementUnits; - dataStream << _fuelType; - dataStream << _fuelLocation; - dataStream << _padding; -} - -void StorageFuel::unmarshal(DataStream& dataStream) -{ - dataStream >> _fuelQuantity; - dataStream >> _fuelMeasurementUnits; - dataStream >> _fuelType; - dataStream >> _fuelLocation; - dataStream >> _padding; -} - - -bool StorageFuel::operator ==(const StorageFuel& rhs) const - { - bool ivarsEqual = true; - - if( ! (_fuelQuantity == rhs._fuelQuantity) ) ivarsEqual = false; - if( ! (_fuelMeasurementUnits == rhs._fuelMeasurementUnits) ) ivarsEqual = false; - if( ! (_fuelType == rhs._fuelType) ) ivarsEqual = false; - if( ! (_fuelLocation == rhs._fuelLocation) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StorageFuel::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _fuelQuantity - marshalSize = marshalSize + 1; // _fuelMeasurementUnits - marshalSize = marshalSize + 1; // _fuelType - marshalSize = marshalSize + 1; // _fuelLocation - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StorageFuel.h b/src/dis7/StorageFuel.h deleted file mode 100644 index a530c66f..00000000 --- a/src/dis7/StorageFuel.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Information about an entity's engine fuel. Section 6.2.83. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT StorageFuel -{ -protected: - /** Fuel quantity, units specified by next field */ - unsigned int _fuelQuantity; - - /** Units in which the fuel is measured */ - unsigned char _fuelMeasurementUnits; - - /** Type of fuel */ - unsigned char _fuelType; - - /** Location of fuel as related to entity. See section 14 of EBV document */ - unsigned char _fuelLocation; - - /** padding */ - unsigned char _padding; - - - public: - StorageFuel(); - virtual ~StorageFuel(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getFuelQuantity() const; - void setFuelQuantity(unsigned int pX); - - unsigned char getFuelMeasurementUnits() const; - void setFuelMeasurementUnits(unsigned char pX); - - unsigned char getFuelType() const; - void setFuelType(unsigned char pX); - - unsigned char getFuelLocation() const; - void setFuelLocation(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StorageFuel& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StorageFuelReload.cpp b/src/dis7/StorageFuelReload.cpp deleted file mode 100644 index efbe38c2..00000000 --- a/src/dis7/StorageFuelReload.cpp +++ /dev/null @@ -1,187 +0,0 @@ -#include - -using namespace DIS; - - -StorageFuelReload::StorageFuelReload(): - _standardQuantity(0), - _maximumQuantity(0), - _standardQuantityReloadTime(0), - _maximumQuantityReloadTime(0), - _fuelMeasurementUnits(0), - _fuelType(0), - _fuelLocation(0), - _padding(0) -{ -} - -StorageFuelReload::~StorageFuelReload() -{ -} - -unsigned int StorageFuelReload::getStandardQuantity() const -{ - return _standardQuantity; -} - -void StorageFuelReload::setStandardQuantity(unsigned int pX) -{ - _standardQuantity = pX; -} - -unsigned int StorageFuelReload::getMaximumQuantity() const -{ - return _maximumQuantity; -} - -void StorageFuelReload::setMaximumQuantity(unsigned int pX) -{ - _maximumQuantity = pX; -} - -unsigned char StorageFuelReload::getStandardQuantityReloadTime() const -{ - return _standardQuantityReloadTime; -} - -void StorageFuelReload::setStandardQuantityReloadTime(unsigned char pX) -{ - _standardQuantityReloadTime = pX; -} - -unsigned char StorageFuelReload::getMaximumQuantityReloadTime() const -{ - return _maximumQuantityReloadTime; -} - -void StorageFuelReload::setMaximumQuantityReloadTime(unsigned char pX) -{ - _maximumQuantityReloadTime = pX; -} - -unsigned char StorageFuelReload::getFuelMeasurementUnits() const -{ - return _fuelMeasurementUnits; -} - -void StorageFuelReload::setFuelMeasurementUnits(unsigned char pX) -{ - _fuelMeasurementUnits = pX; -} - -unsigned char StorageFuelReload::getFuelType() const -{ - return _fuelType; -} - -void StorageFuelReload::setFuelType(unsigned char pX) -{ - _fuelType = pX; -} - -unsigned char StorageFuelReload::getFuelLocation() const -{ - return _fuelLocation; -} - -void StorageFuelReload::setFuelLocation(unsigned char pX) -{ - _fuelLocation = pX; -} - -unsigned char StorageFuelReload::getPadding() const -{ - return _padding; -} - -void StorageFuelReload::setPadding(unsigned char pX) -{ - _padding = pX; -} - -void StorageFuelReload::marshal(DataStream& dataStream) const -{ - dataStream << _standardQuantity; - dataStream << _maximumQuantity; - dataStream << _standardQuantityReloadTime; - dataStream << _maximumQuantityReloadTime; - dataStream << _fuelMeasurementUnits; - dataStream << _fuelType; - dataStream << _fuelLocation; - dataStream << _padding; -} - -void StorageFuelReload::unmarshal(DataStream& dataStream) -{ - dataStream >> _standardQuantity; - dataStream >> _maximumQuantity; - dataStream >> _standardQuantityReloadTime; - dataStream >> _maximumQuantityReloadTime; - dataStream >> _fuelMeasurementUnits; - dataStream >> _fuelType; - dataStream >> _fuelLocation; - dataStream >> _padding; -} - - -bool StorageFuelReload::operator ==(const StorageFuelReload& rhs) const - { - bool ivarsEqual = true; - - if( ! (_standardQuantity == rhs._standardQuantity) ) ivarsEqual = false; - if( ! (_maximumQuantity == rhs._maximumQuantity) ) ivarsEqual = false; - if( ! (_standardQuantityReloadTime == rhs._standardQuantityReloadTime) ) ivarsEqual = false; - if( ! (_maximumQuantityReloadTime == rhs._maximumQuantityReloadTime) ) ivarsEqual = false; - if( ! (_fuelMeasurementUnits == rhs._fuelMeasurementUnits) ) ivarsEqual = false; - if( ! (_fuelType == rhs._fuelType) ) ivarsEqual = false; - if( ! (_fuelLocation == rhs._fuelLocation) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int StorageFuelReload::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _standardQuantity - marshalSize = marshalSize + 4; // _maximumQuantity - marshalSize = marshalSize + 1; // _standardQuantityReloadTime - marshalSize = marshalSize + 1; // _maximumQuantityReloadTime - marshalSize = marshalSize + 1; // _fuelMeasurementUnits - marshalSize = marshalSize + 1; // _fuelType - marshalSize = marshalSize + 1; // _fuelLocation - marshalSize = marshalSize + 1; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/StorageFuelReload.h b/src/dis7/StorageFuelReload.h deleted file mode 100644 index 9d96c84b..00000000 --- a/src/dis7/StorageFuelReload.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// For each type or location of Storage Fuel, this record shall specify the type, location, fuel measure- ment units, reload quantity and maximum quantity for storage fuel either for the whole entity or a specific storage fuel location (tank). Section 6.2.84. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT StorageFuelReload -{ -protected: - /** the standard quantity of this fuel type normally loaded at this station/launcher if a station/launcher is specified. If the Station/Launcher field is set to zero, then this is the total quantity of this fuel type that would be present in a standard reload of all appli- cable stations/launchers associated with this entity. */ - unsigned int _standardQuantity; - - /** the maximum quantity of this fuel type that this sta- tion/launcher is capable of holding when a station/launcher is specified. This would be the value used when a maximum reload was desired to be set for this station/launcher. If the Station/launcher field is set to zero, then this is the maximum quantity of this fuel type that would be present on this entity at all stations/launchers that can accept this fuel type. */ - unsigned int _maximumQuantity; - - /** the seconds normally required to reload the standard quantity of this fuel type at this specific station/launcher. When the Station/Launcher field is set to zero, this shall be the time it takes to perform a standard quantity reload of this fuel type at all applicable stations/launchers for this entity. */ - unsigned char _standardQuantityReloadTime; - - /** the seconds normally required to reload the maximum possible quantity of this fuel type at this station/launcher. When the Station/Launcher field is set to zero, this shall be the time it takes to perform a maximum quantity load/reload of this fuel type at all applicable stations/launchers for this entity. */ - unsigned char _maximumQuantityReloadTime; - - /** the fuel measurement units. Enumeration */ - unsigned char _fuelMeasurementUnits; - - /** Fuel type. Enumeration */ - unsigned char _fuelType; - - /** Location of fuel as related to entity. See section 14 of EBV document */ - unsigned char _fuelLocation; - - /** padding */ - unsigned char _padding; - - - public: - StorageFuelReload(); - virtual ~StorageFuelReload(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getStandardQuantity() const; - void setStandardQuantity(unsigned int pX); - - unsigned int getMaximumQuantity() const; - void setMaximumQuantity(unsigned int pX); - - unsigned char getStandardQuantityReloadTime() const; - void setStandardQuantityReloadTime(unsigned char pX); - - unsigned char getMaximumQuantityReloadTime() const; - void setMaximumQuantityReloadTime(unsigned char pX); - - unsigned char getFuelMeasurementUnits() const; - void setFuelMeasurementUnits(unsigned char pX); - - unsigned char getFuelType() const; - void setFuelType(unsigned char pX); - - unsigned char getFuelLocation() const; - void setFuelLocation(unsigned char pX); - - unsigned char getPadding() const; - void setPadding(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const StorageFuelReload& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SupplyQuantity.cpp b/src/dis7/SupplyQuantity.cpp deleted file mode 100644 index f39a151d..00000000 --- a/src/dis7/SupplyQuantity.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -SupplyQuantity::SupplyQuantity(): - _supplyType(), - _quantity(0.0) -{ -} - -SupplyQuantity::~SupplyQuantity() -{ -} - -EntityType& SupplyQuantity::getSupplyType() -{ - return _supplyType; -} - -const EntityType& SupplyQuantity::getSupplyType() const -{ - return _supplyType; -} - -void SupplyQuantity::setSupplyType(const EntityType &pX) -{ - _supplyType = pX; -} - -float SupplyQuantity::getQuantity() const -{ - return _quantity; -} - -void SupplyQuantity::setQuantity(float pX) -{ - _quantity = pX; -} - -void SupplyQuantity::marshal(DataStream& dataStream) const -{ - _supplyType.marshal(dataStream); - dataStream << _quantity; -} - -void SupplyQuantity::unmarshal(DataStream& dataStream) -{ - _supplyType.unmarshal(dataStream); - dataStream >> _quantity; -} - - -bool SupplyQuantity::operator ==(const SupplyQuantity& rhs) const - { - bool ivarsEqual = true; - - if( ! (_supplyType == rhs._supplyType) ) ivarsEqual = false; - if( ! (_quantity == rhs._quantity) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SupplyQuantity::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _supplyType.getMarshalledSize(); // _supplyType - marshalSize = marshalSize + 4; // _quantity - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SupplyQuantity.h b/src/dis7/SupplyQuantity.h deleted file mode 100644 index 01e7fc3c..00000000 --- a/src/dis7/SupplyQuantity.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// A supply, and the amount of that supply. Section 6.2.85 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SupplyQuantity -{ -protected: - /** Type of supply */ - EntityType _supplyType; - - /** the number of units of a supply type. */ - float _quantity; - - - public: - SupplyQuantity(); - virtual ~SupplyQuantity(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityType& getSupplyType(); - const EntityType& getSupplyType() const; - void setSupplyType(const EntityType &pX); - - float getQuantity() const; - void setQuantity(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SupplyQuantity& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SyntheticEnvironmentFamilyPdu.cpp b/src/dis7/SyntheticEnvironmentFamilyPdu.cpp deleted file mode 100644 index 9fff6ace..00000000 --- a/src/dis7/SyntheticEnvironmentFamilyPdu.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include - -using namespace DIS; - - -SyntheticEnvironmentFamilyPdu::SyntheticEnvironmentFamilyPdu() : Pdu() - -{ - setProtocolFamily( 9 ); -} - -SyntheticEnvironmentFamilyPdu::~SyntheticEnvironmentFamilyPdu() -{ -} - -void SyntheticEnvironmentFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first -} - -void SyntheticEnvironmentFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first -} - - -bool SyntheticEnvironmentFamilyPdu::operator ==(const SyntheticEnvironmentFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - - return ivarsEqual; - } - -int SyntheticEnvironmentFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SyntheticEnvironmentFamilyPdu.h b/src/dis7/SyntheticEnvironmentFamilyPdu.h deleted file mode 100644 index 184320a6..00000000 --- a/src/dis7/SyntheticEnvironmentFamilyPdu.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Section 5.3.11: Abstract superclass for synthetic environment PDUs - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SyntheticEnvironmentFamilyPdu : public Pdu -{ -protected: - - public: - SyntheticEnvironmentFamilyPdu(); - virtual ~SyntheticEnvironmentFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SyntheticEnvironmentFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SystemIdentifier.cpp b/src/dis7/SystemIdentifier.cpp deleted file mode 100644 index 1291cf93..00000000 --- a/src/dis7/SystemIdentifier.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include - -using namespace DIS; - - -SystemIdentifier::SystemIdentifier(): - _systemType(0), - _systemName(0), - _systemMode(0), - _changeOptions(0) -{ -} - -SystemIdentifier::~SystemIdentifier() -{ -} - -unsigned short SystemIdentifier::getSystemType() const -{ - return _systemType; -} - -void SystemIdentifier::setSystemType(unsigned short pX) -{ - _systemType = pX; -} - -unsigned short SystemIdentifier::getSystemName() const -{ - return _systemName; -} - -void SystemIdentifier::setSystemName(unsigned short pX) -{ - _systemName = pX; -} - -unsigned char SystemIdentifier::getSystemMode() const -{ - return _systemMode; -} - -void SystemIdentifier::setSystemMode(unsigned char pX) -{ - _systemMode = pX; -} - -unsigned char SystemIdentifier::getChangeOptions() const -{ - return _changeOptions; -} - -void SystemIdentifier::setChangeOptions(unsigned char pX) -{ - _changeOptions = pX; -} - -void SystemIdentifier::marshal(DataStream& dataStream) const -{ - dataStream << _systemType; - dataStream << _systemName; - dataStream << _systemMode; - dataStream << _changeOptions; -} - -void SystemIdentifier::unmarshal(DataStream& dataStream) -{ - dataStream >> _systemType; - dataStream >> _systemName; - dataStream >> _systemMode; - dataStream >> _changeOptions; -} - - -bool SystemIdentifier::operator ==(const SystemIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_systemType == rhs._systemType) ) ivarsEqual = false; - if( ! (_systemName == rhs._systemName) ) ivarsEqual = false; - if( ! (_systemMode == rhs._systemMode) ) ivarsEqual = false; - if( ! (_changeOptions == rhs._changeOptions) ) ivarsEqual = false; - - return ivarsEqual; - } - -int SystemIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _systemType - marshalSize = marshalSize + 2; // _systemName - marshalSize = marshalSize + 1; // _systemMode - marshalSize = marshalSize + 1; // _changeOptions - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/SystemIdentifier.h b/src/dis7/SystemIdentifier.h deleted file mode 100644 index 613a763f..00000000 --- a/src/dis7/SystemIdentifier.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// The ID of the IFF emitting system. NOT COMPLETE. Section 6.2.86 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT SystemIdentifier -{ -protected: - /** general type of emitting system, an enumeration */ - unsigned short _systemType; - - /** named type of system, an enumeration */ - unsigned short _systemName; - - /** mode of operation for the system, an enumeration */ - unsigned char _systemMode; - - /** status of this PDU, see section 6.2.15 */ - unsigned char _changeOptions; - - - public: - SystemIdentifier(); - virtual ~SystemIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getSystemType() const; - void setSystemType(unsigned short pX); - - unsigned short getSystemName() const; - void setSystemName(unsigned short pX); - - unsigned char getSystemMode() const; - void setSystemMode(unsigned char pX); - - unsigned char getChangeOptions() const; - void setChangeOptions(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const SystemIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/TotalRecordSets.cpp b/src/dis7/TotalRecordSets.cpp deleted file mode 100644 index 10aef8fa..00000000 --- a/src/dis7/TotalRecordSets.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -TotalRecordSets::TotalRecordSets(): - _totalRecordSets(0), - _padding(0) -{ -} - -TotalRecordSets::~TotalRecordSets() -{ -} - -unsigned short TotalRecordSets::getTotalRecordSets() const -{ - return _totalRecordSets; -} - -void TotalRecordSets::setTotalRecordSets(unsigned short pX) -{ - _totalRecordSets = pX; -} - -unsigned short TotalRecordSets::getPadding() const -{ - return _padding; -} - -void TotalRecordSets::setPadding(unsigned short pX) -{ - _padding = pX; -} - -void TotalRecordSets::marshal(DataStream& dataStream) const -{ - dataStream << _totalRecordSets; - dataStream << _padding; -} - -void TotalRecordSets::unmarshal(DataStream& dataStream) -{ - dataStream >> _totalRecordSets; - dataStream >> _padding; -} - - -bool TotalRecordSets::operator ==(const TotalRecordSets& rhs) const - { - bool ivarsEqual = true; - - if( ! (_totalRecordSets == rhs._totalRecordSets) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int TotalRecordSets::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _totalRecordSets - marshalSize = marshalSize + 2; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/TotalRecordSets.h b/src/dis7/TotalRecordSets.h deleted file mode 100644 index 16994c32..00000000 --- a/src/dis7/TotalRecordSets.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Total number of record sets contained in a logical set of one or more PDUs. Used to transfer ownership, etc Section 6.2.88 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT TotalRecordSets -{ -protected: - /** Total number of record sets */ - unsigned short _totalRecordSets; - - /** padding */ - unsigned short _padding; - - - public: - TotalRecordSets(); - virtual ~TotalRecordSets(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getTotalRecordSets() const; - void setTotalRecordSets(unsigned short pX); - - unsigned short getPadding() const; - void setPadding(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const TotalRecordSets& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/TrackJamData.cpp b/src/dis7/TrackJamData.cpp deleted file mode 100644 index caf1a708..00000000 --- a/src/dis7/TrackJamData.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include - -using namespace DIS; - - -TrackJamData::TrackJamData(): - _entityID(), - _emitterNumber(0), - _beamNumber(0) -{ -} - -TrackJamData::~TrackJamData() -{ -} - -EntityID& TrackJamData::getEntityID() -{ - return _entityID; -} - -const EntityID& TrackJamData::getEntityID() const -{ - return _entityID; -} - -void TrackJamData::setEntityID(const EntityID &pX) -{ - _entityID = pX; -} - -unsigned char TrackJamData::getEmitterNumber() const -{ - return _emitterNumber; -} - -void TrackJamData::setEmitterNumber(unsigned char pX) -{ - _emitterNumber = pX; -} - -unsigned char TrackJamData::getBeamNumber() const -{ - return _beamNumber; -} - -void TrackJamData::setBeamNumber(unsigned char pX) -{ - _beamNumber = pX; -} - -void TrackJamData::marshal(DataStream& dataStream) const -{ - _entityID.marshal(dataStream); - dataStream << _emitterNumber; - dataStream << _beamNumber; -} - -void TrackJamData::unmarshal(DataStream& dataStream) -{ - _entityID.unmarshal(dataStream); - dataStream >> _emitterNumber; - dataStream >> _beamNumber; -} - - -bool TrackJamData::operator ==(const TrackJamData& rhs) const - { - bool ivarsEqual = true; - - if( ! (_entityID == rhs._entityID) ) ivarsEqual = false; - if( ! (_emitterNumber == rhs._emitterNumber) ) ivarsEqual = false; - if( ! (_beamNumber == rhs._beamNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int TrackJamData::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID - marshalSize = marshalSize + 1; // _emitterNumber - marshalSize = marshalSize + 1; // _beamNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/TrackJamData.h b/src/dis7/TrackJamData.h deleted file mode 100644 index e9b07676..00000000 --- a/src/dis7/TrackJamData.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// Track-Jam data Section 6.2.89 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT TrackJamData -{ -protected: - /** the entity tracked or illumated, or an emitter beam targeted with jamming */ - EntityID _entityID; - - /** Emitter system associated with the entity */ - unsigned char _emitterNumber; - - /** Beam associated with the entity */ - unsigned char _beamNumber; - - - public: - TrackJamData(); - virtual ~TrackJamData(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEntityID(); - const EntityID& getEntityID() const; - void setEntityID(const EntityID &pX); - - unsigned char getEmitterNumber() const; - void setEmitterNumber(unsigned char pX); - - unsigned char getBeamNumber() const; - void setBeamNumber(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const TrackJamData& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/TwoByteChunk.cpp b/src/dis7/TwoByteChunk.cpp deleted file mode 100644 index 67177bb0..00000000 --- a/src/dis7/TwoByteChunk.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -using namespace DIS; - - -TwoByteChunk::TwoByteChunk() -{ - // Initialize fixed length array - for(int lengthotherParameters= 0; lengthotherParameters < 2; lengthotherParameters++) - { - _otherParameters[lengthotherParameters] = 0; - } - -} - -TwoByteChunk::~TwoByteChunk() -{ -} - -char* TwoByteChunk::getOtherParameters() -{ - return _otherParameters; -} - -const char* TwoByteChunk::getOtherParameters() const -{ - return _otherParameters; -} - -void TwoByteChunk::setOtherParameters(const char* x) -{ - for(int i = 0; i < 2; i++) - { - _otherParameters[i] = x[i]; - } -} - -void TwoByteChunk::marshal(DataStream& dataStream) const -{ - - for(size_t idx = 0; idx < 2; idx++) - { - dataStream << _otherParameters[idx]; - } - -} - -void TwoByteChunk::unmarshal(DataStream& dataStream) -{ - - for(size_t idx = 0; idx < 2; idx++) - { - dataStream >> _otherParameters[idx]; - } - -} - - -bool TwoByteChunk::operator ==(const TwoByteChunk& rhs) const - { - bool ivarsEqual = true; - - - for(unsigned char idx = 0; idx < 2; idx++) - { - if(!(_otherParameters[idx] == rhs._otherParameters[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int TwoByteChunk::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2 * 1; // _otherParameters - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/TwoByteChunk.h b/src/dis7/TwoByteChunk.h deleted file mode 100644 index ab339084..00000000 --- a/src/dis7/TwoByteChunk.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// 16 bit piece of data - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT TwoByteChunk -{ -protected: - /** two bytes of arbitrary data */ - char _otherParameters[2]; - - - public: - TwoByteChunk(); - virtual ~TwoByteChunk(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - char* getOtherParameters(); - const char* getOtherParameters() const; - void setOtherParameters( const char* pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const TwoByteChunk& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/UAFundamentalParameter.cpp b/src/dis7/UAFundamentalParameter.cpp deleted file mode 100644 index 7fe09a4b..00000000 --- a/src/dis7/UAFundamentalParameter.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include - -using namespace DIS; - - -UAFundamentalParameter::UAFundamentalParameter(): - _activeEmissionParameterIndex(0), - _scanPattern(0), - _beamCenterAzimuthHorizontal(0.0), - _azimuthalBeamwidthHorizontal(0.0), - _beamCenterDepressionElevation(0.0), - _beamwidthDownElevation(0.0) -{ -} - -UAFundamentalParameter::~UAFundamentalParameter() -{ -} - -unsigned short UAFundamentalParameter::getActiveEmissionParameterIndex() const -{ - return _activeEmissionParameterIndex; -} - -void UAFundamentalParameter::setActiveEmissionParameterIndex(unsigned short pX) -{ - _activeEmissionParameterIndex = pX; -} - -unsigned short UAFundamentalParameter::getScanPattern() const -{ - return _scanPattern; -} - -void UAFundamentalParameter::setScanPattern(unsigned short pX) -{ - _scanPattern = pX; -} - -float UAFundamentalParameter::getBeamCenterAzimuthHorizontal() const -{ - return _beamCenterAzimuthHorizontal; -} - -void UAFundamentalParameter::setBeamCenterAzimuthHorizontal(float pX) -{ - _beamCenterAzimuthHorizontal = pX; -} - -float UAFundamentalParameter::getAzimuthalBeamwidthHorizontal() const -{ - return _azimuthalBeamwidthHorizontal; -} - -void UAFundamentalParameter::setAzimuthalBeamwidthHorizontal(float pX) -{ - _azimuthalBeamwidthHorizontal = pX; -} - -float UAFundamentalParameter::getBeamCenterDepressionElevation() const -{ - return _beamCenterDepressionElevation; -} - -void UAFundamentalParameter::setBeamCenterDepressionElevation(float pX) -{ - _beamCenterDepressionElevation = pX; -} - -float UAFundamentalParameter::getBeamwidthDownElevation() const -{ - return _beamwidthDownElevation; -} - -void UAFundamentalParameter::setBeamwidthDownElevation(float pX) -{ - _beamwidthDownElevation = pX; -} - -void UAFundamentalParameter::marshal(DataStream& dataStream) const -{ - dataStream << _activeEmissionParameterIndex; - dataStream << _scanPattern; - dataStream << _beamCenterAzimuthHorizontal; - dataStream << _azimuthalBeamwidthHorizontal; - dataStream << _beamCenterDepressionElevation; - dataStream << _beamwidthDownElevation; -} - -void UAFundamentalParameter::unmarshal(DataStream& dataStream) -{ - dataStream >> _activeEmissionParameterIndex; - dataStream >> _scanPattern; - dataStream >> _beamCenterAzimuthHorizontal; - dataStream >> _azimuthalBeamwidthHorizontal; - dataStream >> _beamCenterDepressionElevation; - dataStream >> _beamwidthDownElevation; -} - - -bool UAFundamentalParameter::operator ==(const UAFundamentalParameter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_activeEmissionParameterIndex == rhs._activeEmissionParameterIndex) ) ivarsEqual = false; - if( ! (_scanPattern == rhs._scanPattern) ) ivarsEqual = false; - if( ! (_beamCenterAzimuthHorizontal == rhs._beamCenterAzimuthHorizontal) ) ivarsEqual = false; - if( ! (_azimuthalBeamwidthHorizontal == rhs._azimuthalBeamwidthHorizontal) ) ivarsEqual = false; - if( ! (_beamCenterDepressionElevation == rhs._beamCenterDepressionElevation) ) ivarsEqual = false; - if( ! (_beamwidthDownElevation == rhs._beamwidthDownElevation) ) ivarsEqual = false; - - return ivarsEqual; - } - -int UAFundamentalParameter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 2; // _activeEmissionParameterIndex - marshalSize = marshalSize + 2; // _scanPattern - marshalSize = marshalSize + 4; // _beamCenterAzimuthHorizontal - marshalSize = marshalSize + 4; // _azimuthalBeamwidthHorizontal - marshalSize = marshalSize + 4; // _beamCenterDepressionElevation - marshalSize = marshalSize + 4; // _beamwidthDownElevation - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/UAFundamentalParameter.h b/src/dis7/UAFundamentalParameter.h deleted file mode 100644 index 46ba0731..00000000 --- a/src/dis7/UAFundamentalParameter.h +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Regeneration parameters for active emission systems that are variable throughout a scenario. Section 6.2.90 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT UAFundamentalParameter -{ -protected: - /** Which database record shall be used. An enumeration from EBV document */ - unsigned short _activeEmissionParameterIndex; - - /** The type of scan pattern, If not used, zero. An enumeration from EBV document */ - unsigned short _scanPattern; - - /** center azimuth bearing of th emain beam. In radians. */ - float _beamCenterAzimuthHorizontal; - - /** Horizontal beamwidth of th emain beam Meastued at the 3dB down point of peak radiated power. In radians. */ - float _azimuthalBeamwidthHorizontal; - - /** center of the d/e angle of th emain beam relative to the stablised de angle of the target. In radians. */ - float _beamCenterDepressionElevation; - - /** vertical beamwidth of the main beam. Meastured at the 3dB down point of peak radiated power. In radians. */ - float _beamwidthDownElevation; - - - public: - UAFundamentalParameter(); - virtual ~UAFundamentalParameter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned short getActiveEmissionParameterIndex() const; - void setActiveEmissionParameterIndex(unsigned short pX); - - unsigned short getScanPattern() const; - void setScanPattern(unsigned short pX); - - float getBeamCenterAzimuthHorizontal() const; - void setBeamCenterAzimuthHorizontal(float pX); - - float getAzimuthalBeamwidthHorizontal() const; - void setAzimuthalBeamwidthHorizontal(float pX); - - float getBeamCenterDepressionElevation() const; - void setBeamCenterDepressionElevation(float pX); - - float getBeamwidthDownElevation() const; - void setBeamwidthDownElevation(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const UAFundamentalParameter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/UaPdu.cpp b/src/dis7/UaPdu.cpp deleted file mode 100644 index 37fb4c3b..00000000 --- a/src/dis7/UaPdu.cpp +++ /dev/null @@ -1,332 +0,0 @@ -#include - -using namespace DIS; - - -UaPdu::UaPdu() : DistributedEmissionsFamilyPdu(), - _emittingEntityID(), - _eventID(), - _stateChangeIndicator(0), - _pad(0), - _passiveParameterIndex(0), - _propulsionPlantConfiguration(0), - _numberOfShafts(0), - _numberOfAPAs(0), - _numberOfUAEmitterSystems(0) -{ - setPduType( 29 ); -} - -UaPdu::~UaPdu() -{ - _shaftRPMs.clear(); - _apaData.clear(); - _emitterSystems.clear(); -} - -EntityID& UaPdu::getEmittingEntityID() -{ - return _emittingEntityID; -} - -const EntityID& UaPdu::getEmittingEntityID() const -{ - return _emittingEntityID; -} - -void UaPdu::setEmittingEntityID(const EntityID &pX) -{ - _emittingEntityID = pX; -} - -EventIdentifier& UaPdu::getEventID() -{ - return _eventID; -} - -const EventIdentifier& UaPdu::getEventID() const -{ - return _eventID; -} - -void UaPdu::setEventID(const EventIdentifier &pX) -{ - _eventID = pX; -} - -char UaPdu::getStateChangeIndicator() const -{ - return _stateChangeIndicator; -} - -void UaPdu::setStateChangeIndicator(char pX) -{ - _stateChangeIndicator = pX; -} - -char UaPdu::getPad() const -{ - return _pad; -} - -void UaPdu::setPad(char pX) -{ - _pad = pX; -} - -unsigned short UaPdu::getPassiveParameterIndex() const -{ - return _passiveParameterIndex; -} - -void UaPdu::setPassiveParameterIndex(unsigned short pX) -{ - _passiveParameterIndex = pX; -} - -unsigned char UaPdu::getPropulsionPlantConfiguration() const -{ - return _propulsionPlantConfiguration; -} - -void UaPdu::setPropulsionPlantConfiguration(unsigned char pX) -{ - _propulsionPlantConfiguration = pX; -} - -unsigned char UaPdu::getNumberOfShafts() const -{ - return _shaftRPMs.size(); -} - -unsigned char UaPdu::getNumberOfAPAs() const -{ - return _apaData.size(); -} - -unsigned char UaPdu::getNumberOfUAEmitterSystems() const -{ - return _emitterSystems.size(); -} - -std::vector& UaPdu::getShaftRPMs() -{ - return _shaftRPMs; -} - -const std::vector& UaPdu::getShaftRPMs() const -{ - return _shaftRPMs; -} - -void UaPdu::setShaftRPMs(const std::vector& pX) -{ - _shaftRPMs = pX; -} - -std::vector& UaPdu::getApaData() -{ - return _apaData; -} - -const std::vector& UaPdu::getApaData() const -{ - return _apaData; -} - -void UaPdu::setApaData(const std::vector& pX) -{ - _apaData = pX; -} - -std::vector& UaPdu::getEmitterSystems() -{ - return _emitterSystems; -} - -const std::vector& UaPdu::getEmitterSystems() const -{ - return _emitterSystems; -} - -void UaPdu::setEmitterSystems(const std::vector& pX) -{ - _emitterSystems = pX; -} - -void UaPdu::marshal(DataStream& dataStream) const -{ - DistributedEmissionsFamilyPdu::marshal(dataStream); // Marshal information in superclass first - _emittingEntityID.marshal(dataStream); - _eventID.marshal(dataStream); - dataStream << _stateChangeIndicator; - dataStream << _pad; - dataStream << _passiveParameterIndex; - dataStream << _propulsionPlantConfiguration; - dataStream << ( unsigned char )_shaftRPMs.size(); - dataStream << ( unsigned char )_apaData.size(); - dataStream << ( unsigned char )_emitterSystems.size(); - - for(size_t idx = 0; idx < _shaftRPMs.size(); idx++) - { - Vector3Float x = _shaftRPMs[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _apaData.size(); idx++) - { - Vector3Float x = _apaData[idx]; - x.marshal(dataStream); - } - - - for(size_t idx = 0; idx < _emitterSystems.size(); idx++) - { - Vector3Float x = _emitterSystems[idx]; - x.marshal(dataStream); - } - -} - -void UaPdu::unmarshal(DataStream& dataStream) -{ - DistributedEmissionsFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first - _emittingEntityID.unmarshal(dataStream); - _eventID.unmarshal(dataStream); - dataStream >> _stateChangeIndicator; - dataStream >> _pad; - dataStream >> _passiveParameterIndex; - dataStream >> _propulsionPlantConfiguration; - dataStream >> _numberOfShafts; - dataStream >> _numberOfAPAs; - dataStream >> _numberOfUAEmitterSystems; - - _shaftRPMs.clear(); - for(size_t idx = 0; idx < _numberOfShafts; idx++) - { - Vector3Float x; - x.unmarshal(dataStream); - _shaftRPMs.push_back(x); - } - - _apaData.clear(); - for(size_t idx = 0; idx < _numberOfAPAs; idx++) - { - Vector3Float x; - x.unmarshal(dataStream); - _apaData.push_back(x); - } - - _emitterSystems.clear(); - for(size_t idx = 0; idx < _numberOfUAEmitterSystems; idx++) - { - Vector3Float x; - x.unmarshal(dataStream); - _emitterSystems.push_back(x); - } -} - - -bool UaPdu::operator ==(const UaPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); - - if( ! (_emittingEntityID == rhs._emittingEntityID) ) ivarsEqual = false; - if( ! (_eventID == rhs._eventID) ) ivarsEqual = false; - if( ! (_stateChangeIndicator == rhs._stateChangeIndicator) ) ivarsEqual = false; - if( ! (_pad == rhs._pad) ) ivarsEqual = false; - if( ! (_passiveParameterIndex == rhs._passiveParameterIndex) ) ivarsEqual = false; - if( ! (_propulsionPlantConfiguration == rhs._propulsionPlantConfiguration) ) ivarsEqual = false; - - for(size_t idx = 0; idx < _shaftRPMs.size(); idx++) - { - if( ! ( _shaftRPMs[idx] == rhs._shaftRPMs[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _apaData.size(); idx++) - { - if( ! ( _apaData[idx] == rhs._apaData[idx]) ) ivarsEqual = false; - } - - - for(size_t idx = 0; idx < _emitterSystems.size(); idx++) - { - if( ! ( _emitterSystems[idx] == rhs._emitterSystems[idx]) ) ivarsEqual = false; - } - - - return ivarsEqual; - } - -int UaPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); - marshalSize = marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID - marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID - marshalSize = marshalSize + 1; // _stateChangeIndicator - marshalSize = marshalSize + 1; // _pad - marshalSize = marshalSize + 2; // _passiveParameterIndex - marshalSize = marshalSize + 1; // _propulsionPlantConfiguration - marshalSize = marshalSize + 1; // _numberOfShafts - marshalSize = marshalSize + 1; // _numberOfAPAs - marshalSize = marshalSize + 1; // _numberOfUAEmitterSystems - - for(unsigned long long idx=0; idx < _shaftRPMs.size(); idx++) - { - Vector3Float listElement = _shaftRPMs[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _apaData.size(); idx++) - { - Vector3Float listElement = _apaData[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - - for(unsigned long long idx=0; idx < _emitterSystems.size(); idx++) - { - Vector3Float listElement = _emitterSystems[idx]; - marshalSize = marshalSize + listElement.getMarshalledSize(); - } - - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/UaPdu.h b/src/dis7/UaPdu.h deleted file mode 100644 index b290a158..00000000 --- a/src/dis7/UaPdu.h +++ /dev/null @@ -1,143 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace DIS -{ -// Information about underwater acoustic emmissions. This requires manual cleanup. The beam data records should ALL be a the finish, rather than attached to each emitter system. Section 7.6.4. UNFINISHED - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT UaPdu : public DistributedEmissionsFamilyPdu -{ -protected: - /** ID of the entity that is the source of the emission */ - EntityID _emittingEntityID; - - /** ID of event */ - EventIdentifier _eventID; - - /** This field shall be used to indicate whether the data in the UA PDU represent a state update or data that have changed since issuance of the last UA PDU */ - char _stateChangeIndicator; - - /** padding */ - char _pad; - - /** This field indicates which database record (or file) shall be used in the definition of passive signature (unintentional) emissions of the entity. The indicated database record (or file) shall define all noise generated as a function of propulsion plant configurations and associated auxiliaries. */ - unsigned short _passiveParameterIndex; - - /** This field shall specify the entity propulsion plant configuration. This field is used to determine the passive signature characteristics of an entity. */ - unsigned char _propulsionPlantConfiguration; - - /** This field shall represent the number of shafts on a platform */ - unsigned char _numberOfShafts; - - /** This field shall indicate the number of APAs described in the current UA PDU */ - unsigned char _numberOfAPAs; - - /** This field shall specify the number of UA emitter systems being described in the current UA PDU */ - unsigned char _numberOfUAEmitterSystems; - - /** shaft RPM values. THIS IS WRONG. It has the wrong class in the list. */ - std::vector _shaftRPMs; - - /** apaData. THIS IS WRONG. It has the worng class in the list. */ - std::vector _apaData; - - /** THIS IS WRONG. It has the wrong class in the list. */ - std::vector _emitterSystems; - - - public: - UaPdu(); - virtual ~UaPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getEmittingEntityID(); - const EntityID& getEmittingEntityID() const; - void setEmittingEntityID(const EntityID &pX); - - EventIdentifier& getEventID(); - const EventIdentifier& getEventID() const; - void setEventID(const EventIdentifier &pX); - - char getStateChangeIndicator() const; - void setStateChangeIndicator(char pX); - - char getPad() const; - void setPad(char pX); - - unsigned short getPassiveParameterIndex() const; - void setPassiveParameterIndex(unsigned short pX); - - unsigned char getPropulsionPlantConfiguration() const; - void setPropulsionPlantConfiguration(unsigned char pX); - - unsigned char getNumberOfShafts() const; - - unsigned char getNumberOfAPAs() const; - - unsigned char getNumberOfUAEmitterSystems() const; - - std::vector& getShaftRPMs(); - const std::vector& getShaftRPMs() const; - void setShaftRPMs(const std::vector& pX); - - std::vector& getApaData(); - const std::vector& getApaData() const; - void setApaData(const std::vector& pX); - - std::vector& getEmitterSystems(); - const std::vector& getEmitterSystems() const; - void setEmitterSystems(const std::vector& pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const UaPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/UnattachedIdentifier.cpp b/src/dis7/UnattachedIdentifier.cpp deleted file mode 100644 index 7410797a..00000000 --- a/src/dis7/UnattachedIdentifier.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -using namespace DIS; - - -UnattachedIdentifier::UnattachedIdentifier(): - _simulationAddress(), - _referenceNumber(0) -{ -} - -UnattachedIdentifier::~UnattachedIdentifier() -{ -} - -SimulationAddress& UnattachedIdentifier::getSimulationAddress() -{ - return _simulationAddress; -} - -const SimulationAddress& UnattachedIdentifier::getSimulationAddress() const -{ - return _simulationAddress; -} - -void UnattachedIdentifier::setSimulationAddress(const SimulationAddress &pX) -{ - _simulationAddress = pX; -} - -unsigned short UnattachedIdentifier::getReferenceNumber() const -{ - return _referenceNumber; -} - -void UnattachedIdentifier::setReferenceNumber(unsigned short pX) -{ - _referenceNumber = pX; -} - -void UnattachedIdentifier::marshal(DataStream& dataStream) const -{ - _simulationAddress.marshal(dataStream); - dataStream << _referenceNumber; -} - -void UnattachedIdentifier::unmarshal(DataStream& dataStream) -{ - _simulationAddress.unmarshal(dataStream); - dataStream >> _referenceNumber; -} - - -bool UnattachedIdentifier::operator ==(const UnattachedIdentifier& rhs) const - { - bool ivarsEqual = true; - - if( ! (_simulationAddress == rhs._simulationAddress) ) ivarsEqual = false; - if( ! (_referenceNumber == rhs._referenceNumber) ) ivarsEqual = false; - - return ivarsEqual; - } - -int UnattachedIdentifier::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + _simulationAddress.getMarshalledSize(); // _simulationAddress - marshalSize = marshalSize + 2; // _referenceNumber - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/UnattachedIdentifier.h b/src/dis7/UnattachedIdentifier.h deleted file mode 100644 index 0f70c14d..00000000 --- a/src/dis7/UnattachedIdentifier.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace DIS -{ -// The unique designation of one or more unattached radios in an event or exercise Section 6.2.91 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT UnattachedIdentifier -{ -protected: - /** See 6.2.79 */ - SimulationAddress _simulationAddress; - - /** Reference number */ - unsigned short _referenceNumber; - - - public: - UnattachedIdentifier(); - virtual ~UnattachedIdentifier(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - SimulationAddress& getSimulationAddress(); - const SimulationAddress& getSimulationAddress() const; - void setSimulationAddress(const SimulationAddress &pX); - - unsigned short getReferenceNumber() const; - void setReferenceNumber(unsigned short pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const UnattachedIdentifier& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/UnsignedDISInteger.cpp b/src/dis7/UnsignedDISInteger.cpp deleted file mode 100644 index b2e26269..00000000 --- a/src/dis7/UnsignedDISInteger.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include - -using namespace DIS; - - -UnsignedDISInteger::UnsignedDISInteger(): - _val(0) -{ -} - -UnsignedDISInteger::~UnsignedDISInteger() -{ -} - -unsigned int UnsignedDISInteger::getVal() const -{ - return _val; -} - -void UnsignedDISInteger::setVal(unsigned int pX) -{ - _val = pX; -} - -void UnsignedDISInteger::marshal(DataStream& dataStream) const -{ - dataStream << _val; -} - -void UnsignedDISInteger::unmarshal(DataStream& dataStream) -{ - dataStream >> _val; -} - - -bool UnsignedDISInteger::operator ==(const UnsignedDISInteger& rhs) const - { - bool ivarsEqual = true; - - if( ! (_val == rhs._val) ) ivarsEqual = false; - - return ivarsEqual; - } - -int UnsignedDISInteger::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _val - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/VariableDatum.cpp b/src/dis7/VariableDatum.cpp deleted file mode 100644 index 4ab96401..00000000 --- a/src/dis7/VariableDatum.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include - -using namespace DIS; - - -VariableDatum::VariableDatum(): - _variableDatumID(0), - _variableDatumLength(0), - _variableDatumBits(0), - _padding(0) -{ -} - -VariableDatum::~VariableDatum() -{ -} - -unsigned int VariableDatum::getVariableDatumID() const -{ - return _variableDatumID; -} - -void VariableDatum::setVariableDatumID(unsigned int pX) -{ - _variableDatumID = pX; -} - -unsigned int VariableDatum::getVariableDatumLength() const -{ - return _variableDatumLength; -} - -void VariableDatum::setVariableDatumLength(unsigned int pX) -{ - _variableDatumLength = pX; -} - -unsigned int VariableDatum::getVariableDatumBits() const -{ - return _variableDatumBits; -} - -void VariableDatum::setVariableDatumBits(unsigned int pX) -{ - _variableDatumBits = pX; -} - -unsigned int VariableDatum::getPadding() const -{ - return _padding; -} - -void VariableDatum::setPadding(unsigned int pX) -{ - _padding = pX; -} - -void VariableDatum::marshal(DataStream& dataStream) const -{ - dataStream << _variableDatumID; - dataStream << ( unsigned int )_variableDatums.size() * 64; - - for(size_t idx = 0; idx < _variableDatums.size(); idx++) - { - EightByteChunk x = _variableDatums[idx]; - x.marshal(dataStream); - } - -} - -void VariableDatum::unmarshal(DataStream& dataStream) -{ - dataStream >> _variableDatumID; - dataStream >> _variableDatumLength; - _variableDatumLength = (_variableDatumLength / 64) + ((_variableDatumLength % 64) > 0); - - _variableDatums.clear(); - for(size_t idx = 0; idx < _variableDatumLength; idx++) - { - EightByteChunk x; - x.unmarshal(dataStream); - _variableDatums.push_back(x); - } -} - - -bool VariableDatum::operator ==(const VariableDatum& rhs) const - { - bool ivarsEqual = true; - - if( ! (_variableDatumID == rhs._variableDatumID) ) ivarsEqual = false; - if( ! (_variableDatumLength == rhs._variableDatumLength) ) ivarsEqual = false; - if( ! (_variableDatumBits == rhs._variableDatumBits) ) ivarsEqual = false; - if( ! (_padding == rhs._padding) ) ivarsEqual = false; - - return ivarsEqual; - } - -int VariableDatum::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _variableDatumID - marshalSize = marshalSize + 4; // _variableDatumLength - marshalSize = marshalSize + 4; // _variableDatumBits - marshalSize = marshalSize + 4; // _padding - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/VariableDatum.h b/src/dis7/VariableDatum.h deleted file mode 100644 index d99ac3c9..00000000 --- a/src/dis7/VariableDatum.h +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - -namespace DIS -{ -// the variable datum type, the datum length, and the value for that variable datum type. NOT COMPLETE. Section 6.2.92 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT VariableDatum -{ -protected: - /** 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 _variableDatums; - - - public: - VariableDatum(); - virtual ~VariableDatum(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getVariableDatumID() const; - void setVariableDatumID(unsigned int pX); - - unsigned int getVariableDatumLength() const; - void setVariableDatumLength(unsigned int pX); - - unsigned int getVariableDatumBits() const; - void setVariableDatumBits(unsigned int pX); - - unsigned int getPadding() const; - void setPadding(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const VariableDatum& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/VariableParameter.cpp b/src/dis7/VariableParameter.cpp deleted file mode 100644 index 6949134f..00000000 --- a/src/dis7/VariableParameter.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include - -using namespace DIS; - - -VariableParameter::VariableParameter(): - _recordType(0), - _variableParameterFields1(0.0), - _variableParameterFields2(0), - _variableParameterFields3(0), - _variableParameterFields4(0) -{ -} - -VariableParameter::~VariableParameter() -{ -} - -unsigned char VariableParameter::getRecordType() const -{ - return _recordType; -} - -void VariableParameter::setRecordType(unsigned char pX) -{ - _recordType = pX; -} - -double VariableParameter::getVariableParameterFields1() const -{ - return _variableParameterFields1; -} - -void VariableParameter::setVariableParameterFields1(double pX) -{ - _variableParameterFields1 = pX; -} - -unsigned int VariableParameter::getVariableParameterFields2() const -{ - return _variableParameterFields2; -} - -void VariableParameter::setVariableParameterFields2(unsigned int pX) -{ - _variableParameterFields2 = pX; -} - -unsigned short VariableParameter::getVariableParameterFields3() const -{ - return _variableParameterFields3; -} - -void VariableParameter::setVariableParameterFields3(unsigned short pX) -{ - _variableParameterFields3 = pX; -} - -unsigned char VariableParameter::getVariableParameterFields4() const -{ - return _variableParameterFields4; -} - -void VariableParameter::setVariableParameterFields4(unsigned char pX) -{ - _variableParameterFields4 = pX; -} - -void VariableParameter::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _variableParameterFields1; - dataStream << _variableParameterFields2; - dataStream << _variableParameterFields3; - dataStream << _variableParameterFields4; -} - -void VariableParameter::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _variableParameterFields1; - dataStream >> _variableParameterFields2; - dataStream >> _variableParameterFields3; - dataStream >> _variableParameterFields4; -} - - -bool VariableParameter::operator ==(const VariableParameter& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_variableParameterFields1 == rhs._variableParameterFields1) ) ivarsEqual = false; - if( ! (_variableParameterFields2 == rhs._variableParameterFields2) ) ivarsEqual = false; - if( ! (_variableParameterFields3 == rhs._variableParameterFields3) ) ivarsEqual = false; - if( ! (_variableParameterFields4 == rhs._variableParameterFields4) ) ivarsEqual = false; - - return ivarsEqual; - } - -int VariableParameter::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 1; // _recordType - marshalSize = marshalSize + 8; // _variableParameterFields1 - marshalSize = marshalSize + 4; // _variableParameterFields2 - marshalSize = marshalSize + 2; // _variableParameterFields3 - marshalSize = marshalSize + 1; // _variableParameterFields4 - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/VariableParameter.h b/src/dis7/VariableParameter.h deleted file mode 100644 index 38806ecb..00000000 --- a/src/dis7/VariableParameter.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// specification of additional information associated with an entity or detonation, not otherwise accounted for in a PDU 6.2.93.1 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT VariableParameter -{ -protected: - /** the identification of the Variable Parameter record. Enumeration from EBV */ - unsigned char _recordType; - - /** Variable parameter data fields. Two doubles minus one byte */ - double _variableParameterFields1; - - /** Variable parameter data fields. */ - unsigned int _variableParameterFields2; - - /** Variable parameter data fields. */ - unsigned short _variableParameterFields3; - - /** Variable parameter data fields. */ - unsigned char _variableParameterFields4; - - - public: - VariableParameter(); - virtual ~VariableParameter(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned char getRecordType() const; - void setRecordType(unsigned char pX); - - double getVariableParameterFields1() const; - void setVariableParameterFields1(double pX); - - unsigned int getVariableParameterFields2() const; - void setVariableParameterFields2(unsigned int pX); - - unsigned short getVariableParameterFields3() const; - void setVariableParameterFields3(unsigned short pX); - - unsigned char getVariableParameterFields4() const; - void setVariableParameterFields4(unsigned char pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const VariableParameter& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/VariableTransmitterParameters.cpp b/src/dis7/VariableTransmitterParameters.cpp deleted file mode 100644 index 405af394..00000000 --- a/src/dis7/VariableTransmitterParameters.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -VariableTransmitterParameters::VariableTransmitterParameters(): - _recordType(4), - _recordLength(4) -{ -} - -VariableTransmitterParameters::~VariableTransmitterParameters() -{ -} - -unsigned int VariableTransmitterParameters::getRecordType() const -{ - return _recordType; -} - -void VariableTransmitterParameters::setRecordType(unsigned int pX) -{ - _recordType = pX; -} - -unsigned int VariableTransmitterParameters::getRecordLength() const -{ - return _recordLength; -} - -void VariableTransmitterParameters::setRecordLength(unsigned int pX) -{ - _recordLength = pX; -} - -void VariableTransmitterParameters::marshal(DataStream& dataStream) const -{ - dataStream << _recordType; - dataStream << _recordLength; -} - -void VariableTransmitterParameters::unmarshal(DataStream& dataStream) -{ - dataStream >> _recordType; - dataStream >> _recordLength; -} - - -bool VariableTransmitterParameters::operator ==(const VariableTransmitterParameters& rhs) const - { - bool ivarsEqual = true; - - if( ! (_recordType == rhs._recordType) ) ivarsEqual = false; - if( ! (_recordLength == rhs._recordLength) ) ivarsEqual = false; - - return ivarsEqual; - } - -int VariableTransmitterParameters::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _recordType - marshalSize = marshalSize + 4; // _recordLength - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/VariableTransmitterParameters.h b/src/dis7/VariableTransmitterParameters.h deleted file mode 100644 index 02b9530e..00000000 --- a/src/dis7/VariableTransmitterParameters.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Relates to radios. NOT COMPLETE. Section 6.2.94 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT VariableTransmitterParameters -{ -protected: - /** Type of VTP. Enumeration from EBV */ - unsigned int _recordType; - - /** Length, in bytes */ - unsigned int _recordLength; - - - public: - VariableTransmitterParameters(); - virtual ~VariableTransmitterParameters(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - unsigned int getRecordType() const; - void setRecordType(unsigned int pX); - - unsigned int getRecordLength() const; - void setRecordLength(unsigned int pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const VariableTransmitterParameters& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Vector2Float.cpp b/src/dis7/Vector2Float.cpp deleted file mode 100644 index cf031490..00000000 --- a/src/dis7/Vector2Float.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -Vector2Float::Vector2Float(): - _x(0.0), - _y(0.0) -{ -} - -Vector2Float::~Vector2Float() -{ -} - -float Vector2Float::getX() const -{ - return _x; -} - -void Vector2Float::setX(float pX) -{ - _x = pX; -} - -float Vector2Float::getY() const -{ - return _y; -} - -void Vector2Float::setY(float pX) -{ - _y = pX; -} - -void Vector2Float::marshal(DataStream& dataStream) const -{ - dataStream << _x; - dataStream << _y; -} - -void Vector2Float::unmarshal(DataStream& dataStream) -{ - dataStream >> _x; - dataStream >> _y; -} - - -bool Vector2Float::operator ==(const Vector2Float& rhs) const - { - bool ivarsEqual = true; - - if( ! (_x == rhs._x) ) ivarsEqual = false; - if( ! (_y == rhs._y) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Vector2Float::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _x - marshalSize = marshalSize + 4; // _y - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Vector3Double.cpp b/src/dis7/Vector3Double.cpp deleted file mode 100644 index 2ab2473a..00000000 --- a/src/dis7/Vector3Double.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -Vector3Double::Vector3Double(): - _x(0.0), - _y(0.0), - _z(0.0) -{ -} - -Vector3Double::~Vector3Double() -{ -} - -double Vector3Double::getX() const -{ - return _x; -} - -void Vector3Double::setX(double pX) -{ - _x = pX; -} - -double Vector3Double::getY() const -{ - return _y; -} - -void Vector3Double::setY(double pX) -{ - _y = pX; -} - -double Vector3Double::getZ() const -{ - return _z; -} - -void Vector3Double::setZ(double pX) -{ - _z = pX; -} - -void Vector3Double::marshal(DataStream& dataStream) const -{ - dataStream << _x; - dataStream << _y; - dataStream << _z; -} - -void Vector3Double::unmarshal(DataStream& dataStream) -{ - dataStream >> _x; - dataStream >> _y; - dataStream >> _z; -} - - -bool Vector3Double::operator ==(const Vector3Double& rhs) const - { - bool ivarsEqual = true; - - if( ! (_x == rhs._x) ) ivarsEqual = false; - if( ! (_y == rhs._y) ) ivarsEqual = false; - if( ! (_z == rhs._z) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Vector3Double::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 8; // _x - marshalSize = marshalSize + 8; // _y - marshalSize = marshalSize + 8; // _z - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Vector3Double.h b/src/dis7/Vector3Double.h deleted file mode 100644 index ebee9a59..00000000 --- a/src/dis7/Vector3Double.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Three double precision floating point values, x, y, and z. Used for world coordinates Section 6.2.97. - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Vector3Double -{ -protected: - /** X value */ - double _x; - - /** y Value */ - double _y; - - /** Z value */ - double _z; - - - public: - Vector3Double(); - virtual ~Vector3Double(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - double getX() const; - void setX(double pX); - - double getY() const; - void setY(double pX); - - double getZ() const; - void setZ(double pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Vector3Double& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Vector3Float.cpp b/src/dis7/Vector3Float.cpp deleted file mode 100644 index c68d34cc..00000000 --- a/src/dis7/Vector3Float.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include - -using namespace DIS; - - -Vector3Float::Vector3Float(): - _x(0.0), - _y(0.0), - _z(0.0) -{ -} - -Vector3Float::~Vector3Float() -{ -} - -float Vector3Float::getX() const -{ - return _x; -} - -void Vector3Float::setX(float pX) -{ - _x = pX; -} - -float Vector3Float::getY() const -{ - return _y; -} - -void Vector3Float::setY(float pX) -{ - _y = pX; -} - -float Vector3Float::getZ() const -{ - return _z; -} - -void Vector3Float::setZ(float pX) -{ - _z = pX; -} - -void Vector3Float::marshal(DataStream& dataStream) const -{ - dataStream << _x; - dataStream << _y; - dataStream << _z; -} - -void Vector3Float::unmarshal(DataStream& dataStream) -{ - dataStream >> _x; - dataStream >> _y; - dataStream >> _z; -} - - -bool Vector3Float::operator ==(const Vector3Float& rhs) const - { - bool ivarsEqual = true; - - if( ! (_x == rhs._x) ) ivarsEqual = false; - if( ! (_y == rhs._y) ) ivarsEqual = false; - if( ! (_z == rhs._z) ) ivarsEqual = false; - - return ivarsEqual; - } - -int Vector3Float::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _x - marshalSize = marshalSize + 4; // _y - marshalSize = marshalSize + 4; // _z - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Vector3Float.h b/src/dis7/Vector3Float.h deleted file mode 100644 index e2a028e8..00000000 --- a/src/dis7/Vector3Float.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Three floating point values, x, y, and z. Section 6.2.95 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT Vector3Float -{ -protected: - /** X value */ - float _x; - - /** y Value */ - float _y; - - /** Z value */ - float _z; - - - public: - Vector3Float(); - virtual ~Vector3Float(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getX() const; - void setX(float pX); - - float getY() const; - void setY(float pX); - - float getZ() const; - void setZ(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const Vector3Float& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/VectoringNozzleSystem.cpp b/src/dis7/VectoringNozzleSystem.cpp deleted file mode 100644 index 185b996b..00000000 --- a/src/dis7/VectoringNozzleSystem.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include - -using namespace DIS; - - -VectoringNozzleSystem::VectoringNozzleSystem(): - _horizontalDeflectionAngle(0.0), - _verticalDeflectionAngle(0.0) -{ -} - -VectoringNozzleSystem::~VectoringNozzleSystem() -{ -} - -float VectoringNozzleSystem::getHorizontalDeflectionAngle() const -{ - return _horizontalDeflectionAngle; -} - -void VectoringNozzleSystem::setHorizontalDeflectionAngle(float pX) -{ - _horizontalDeflectionAngle = pX; -} - -float VectoringNozzleSystem::getVerticalDeflectionAngle() const -{ - return _verticalDeflectionAngle; -} - -void VectoringNozzleSystem::setVerticalDeflectionAngle(float pX) -{ - _verticalDeflectionAngle = pX; -} - -void VectoringNozzleSystem::marshal(DataStream& dataStream) const -{ - dataStream << _horizontalDeflectionAngle; - dataStream << _verticalDeflectionAngle; -} - -void VectoringNozzleSystem::unmarshal(DataStream& dataStream) -{ - dataStream >> _horizontalDeflectionAngle; - dataStream >> _verticalDeflectionAngle; -} - - -bool VectoringNozzleSystem::operator ==(const VectoringNozzleSystem& rhs) const - { - bool ivarsEqual = true; - - if( ! (_horizontalDeflectionAngle == rhs._horizontalDeflectionAngle) ) ivarsEqual = false; - if( ! (_verticalDeflectionAngle == rhs._verticalDeflectionAngle) ) ivarsEqual = false; - - return ivarsEqual; - } - -int VectoringNozzleSystem::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = marshalSize + 4; // _horizontalDeflectionAngle - marshalSize = marshalSize + 4; // _verticalDeflectionAngle - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/VectoringNozzleSystem.h b/src/dis7/VectoringNozzleSystem.h deleted file mode 100644 index 383e25f5..00000000 --- a/src/dis7/VectoringNozzleSystem.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include - - -namespace DIS -{ -// Operational data for describing the vectoring nozzle systems Section 6.2.96 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT VectoringNozzleSystem -{ -protected: - /** In degrees */ - float _horizontalDeflectionAngle; - - /** In degrees */ - float _verticalDeflectionAngle; - - - public: - VectoringNozzleSystem(); - virtual ~VectoringNozzleSystem(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - float getHorizontalDeflectionAngle() const; - void setHorizontalDeflectionAngle(float pX); - - float getVerticalDeflectionAngle() const; - void setVerticalDeflectionAngle(float pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const VectoringNozzleSystem& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/WarfareFamilyPdu.cpp b/src/dis7/WarfareFamilyPdu.cpp deleted file mode 100644 index 1c3c998b..00000000 --- a/src/dis7/WarfareFamilyPdu.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -using namespace DIS; - - -WarfareFamilyPdu::WarfareFamilyPdu() : Pdu(), - _firingEntityID(), - _targetEntityID() -{ - setProtocolFamily( 2 ); -} - -WarfareFamilyPdu::~WarfareFamilyPdu() -{ -} - -EntityID& WarfareFamilyPdu::getFiringEntityID() -{ - return _firingEntityID; -} - -const EntityID& WarfareFamilyPdu::getFiringEntityID() const -{ - return _firingEntityID; -} - -void WarfareFamilyPdu::setFiringEntityID(const EntityID &pX) -{ - _firingEntityID = pX; -} - -EntityID& WarfareFamilyPdu::getTargetEntityID() -{ - return _targetEntityID; -} - -const EntityID& WarfareFamilyPdu::getTargetEntityID() const -{ - return _targetEntityID; -} - -void WarfareFamilyPdu::setTargetEntityID(const EntityID &pX) -{ - _targetEntityID = pX; -} - -void WarfareFamilyPdu::marshal(DataStream& dataStream) const -{ - Pdu::marshal(dataStream); // Marshal information in superclass first - _firingEntityID.marshal(dataStream); - _targetEntityID.marshal(dataStream); -} - -void WarfareFamilyPdu::unmarshal(DataStream& dataStream) -{ - Pdu::unmarshal(dataStream); // unmarshal information in superclass first - _firingEntityID.unmarshal(dataStream); - _targetEntityID.unmarshal(dataStream); -} - - -bool WarfareFamilyPdu::operator ==(const WarfareFamilyPdu& rhs) const - { - bool ivarsEqual = true; - - ivarsEqual = Pdu::operator==(rhs); - - if( ! (_firingEntityID == rhs._firingEntityID) ) ivarsEqual = false; - if( ! (_targetEntityID == rhs._targetEntityID) ) ivarsEqual = false; - - return ivarsEqual; - } - -int WarfareFamilyPdu::getMarshalledSize() const -{ - int marshalSize = 0; - - marshalSize = Pdu::getMarshalledSize(); - marshalSize = marshalSize + _firingEntityID.getMarshalledSize(); // _firingEntityID - marshalSize = marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID - return marshalSize; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/WarfareFamilyPdu.h b/src/dis7/WarfareFamilyPdu.h deleted file mode 100644 index 7ae64367..00000000 --- a/src/dis7/WarfareFamilyPdu.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DIS -{ -// abstract superclass for fire and detonation pdus that have shared information. Section 7.3 COMPLETE - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. -// -// @author DMcG, jkg - -class OPENDIS7_EXPORT WarfareFamilyPdu : public Pdu -{ -protected: - /** ID of the entity that shot */ - EntityID _firingEntityID; - - /** ID of the entity that is being shot at */ - EntityID _targetEntityID; - - - public: - WarfareFamilyPdu(); - virtual ~WarfareFamilyPdu(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); - - EntityID& getFiringEntityID(); - const EntityID& getFiringEntityID() const; - void setFiringEntityID(const EntityID &pX); - - EntityID& getTargetEntityID(); - const EntityID& getTargetEntityID() const; - void setTargetEntityID(const EntityID &pX); - - -virtual int getMarshalledSize() const; - - bool operator ==(const WarfareFamilyPdu& rhs) const; -}; -} - -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AcousticEmitter.cpp b/src/dis7/common/AcousticEmitter.cpp new file mode 100644 index 00000000..a7f0d2b9 --- /dev/null +++ b/src/dis7/common/AcousticEmitter.cpp @@ -0,0 +1,88 @@ +#include "dis7/AcousticEmitter.h" + +using namespace DIS; + +AcousticEmitter::AcousticEmitter() + : _acousticName(0), _function(0), _acousticIdNumber(0) {} + +AcousticEmitter::~AcousticEmitter() {} + +uint16_t AcousticEmitter::getAcousticName() const { + return _acousticName; +} + +void AcousticEmitter::setAcousticName(uint16_t pX) { _acousticName = pX; } + +uint8_t AcousticEmitter::getFunction() const { return _function; } + +void AcousticEmitter::setFunction(uint8_t pX) { _function = pX; } + +uint8_t AcousticEmitter::getAcousticIdNumber() const { + return _acousticIdNumber; +} + +void AcousticEmitter::setAcousticIdNumber(uint8_t pX) { + _acousticIdNumber = pX; +} + +void AcousticEmitter::marshal(DataStream& dataStream) const { + dataStream << _acousticName; + dataStream << _function; + dataStream << _acousticIdNumber; +} + +void AcousticEmitter::unmarshal(DataStream& dataStream) { + dataStream >> _acousticName; + dataStream >> _function; + dataStream >> _acousticIdNumber; +} + +bool AcousticEmitter::operator==(const AcousticEmitter& rhs) const { + bool ivarsEqual = true; + + if (!(_acousticName == rhs._acousticName)) ivarsEqual = false; + if (!(_function == rhs._function)) ivarsEqual = false; + if (!(_acousticIdNumber == rhs._acousticIdNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int AcousticEmitter::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _acousticName + marshalSize = marshalSize + 1; // _function + marshalSize = marshalSize + 1; // _acousticIdNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AcousticEmitter.h b/src/dis7/common/AcousticEmitter.h new file mode 100644 index 00000000..c245667b --- /dev/null +++ b/src/dis7/common/AcousticEmitter.h @@ -0,0 +1,76 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// information about a specific UA emmtter. Section 6.2.2. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AcousticEmitter { + protected: + /** the system for a particular UA emitter, and an enumeration */ + uint16_t _acousticName; + + /** The function of the acoustic system */ + uint8_t _function; + + /** The UA emitter identification number relative to a specific system */ + uint8_t _acousticIdNumber; + + public: + AcousticEmitter(); + virtual ~AcousticEmitter(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getAcousticName() const; + void setAcousticName(uint16_t pX); + + uint8_t getFunction() const; + void setFunction(uint8_t pX); + + uint8_t getAcousticIdNumber() const; + void setAcousticIdNumber(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AcousticEmitter& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AggregateIdentifier.cpp b/src/dis7/common/AggregateIdentifier.cpp new file mode 100644 index 00000000..107fa064 --- /dev/null +++ b/src/dis7/common/AggregateIdentifier.cpp @@ -0,0 +1,87 @@ +#include "dis7/AggregateIdentifier.h" + +using namespace DIS; + +AggregateIdentifier::AggregateIdentifier() + : _simulationAddress(), _aggregateID(0) {} + +AggregateIdentifier::~AggregateIdentifier() {} + +SimulationAddress& AggregateIdentifier::getSimulationAddress() { + return _simulationAddress; +} + +const SimulationAddress& AggregateIdentifier::getSimulationAddress() const { + return _simulationAddress; +} + +void AggregateIdentifier::setSimulationAddress(const SimulationAddress& pX) { + _simulationAddress = pX; +} + +uint16_t AggregateIdentifier::getAggregateID() const { + return _aggregateID; +} + +void AggregateIdentifier::setAggregateID(uint16_t pX) { + _aggregateID = pX; +} + +void AggregateIdentifier::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _aggregateID; +} + +void AggregateIdentifier::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _aggregateID; +} + +bool AggregateIdentifier::operator==(const AggregateIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_aggregateID == rhs._aggregateID)) ivarsEqual = false; + + return ivarsEqual; +} + +int AggregateIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _aggregateID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AggregateIdentifier.h b/src/dis7/common/AggregateIdentifier.h new file mode 100644 index 00000000..c7848994 --- /dev/null +++ b/src/dis7/common/AggregateIdentifier.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of each aggrgate in an exercise is specified by an +// aggregate identifier record. The aggregate ID is not an entity and shall not +// be treated as such. Section 6.2.3. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AggregateIdentifier { + protected: + /** Simulation address, ie site and application, the first two fields of the + * entity ID */ + SimulationAddress _simulationAddress; + + /** the aggregate ID */ + uint16_t _aggregateID; + + public: + AggregateIdentifier(); + virtual ~AggregateIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getSimulationAddress(); + const SimulationAddress& getSimulationAddress() const; + void setSimulationAddress(const SimulationAddress& pX); + + uint16_t getAggregateID() const; + void setAggregateID(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AggregateIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AggregateMarking.cpp b/src/dis7/common/AggregateMarking.cpp new file mode 100644 index 00000000..7f599235 --- /dev/null +++ b/src/dis7/common/AggregateMarking.cpp @@ -0,0 +1,97 @@ +#include "dis7/AggregateMarking.h" + +using namespace DIS; + +AggregateMarking::AggregateMarking() : _characterSet(0) { + // Initialize fixed length array + for (int lengthcharacters = 0; lengthcharacters < 31; lengthcharacters++) { + _characters[lengthcharacters] = 0; + } +} + +AggregateMarking::~AggregateMarking() {} + +uint8_t AggregateMarking::getCharacterSet() const { + return _characterSet; +} + +void AggregateMarking::setCharacterSet(uint8_t pX) { _characterSet = pX; } + +uint8_t* AggregateMarking::getCharacters() { return _characters; } + +const uint8_t* AggregateMarking::getCharacters() const { + return _characters; +} + +void AggregateMarking::setCharacters(const uint8_t* x) { + for (int i = 0; i < 31; i++) { + _characters[i] = x[i]; + } +} + +void AggregateMarking::marshal(DataStream& dataStream) const { + dataStream << _characterSet; + + for (size_t idx = 0; idx < 31; idx++) { + dataStream << _characters[idx]; + } +} + +void AggregateMarking::unmarshal(DataStream& dataStream) { + dataStream >> _characterSet; + + for (size_t idx = 0; idx < 31; idx++) { + dataStream >> _characters[idx]; + } +} + +bool AggregateMarking::operator==(const AggregateMarking& rhs) const { + bool ivarsEqual = true; + + if (!(_characterSet == rhs._characterSet)) ivarsEqual = false; + + for (uint8_t idx = 0; idx < 31; idx++) { + if (!(_characters[idx] == rhs._characters[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int AggregateMarking::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _characterSet + marshalSize = marshalSize + 31 * 1; // _characters + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AggregateMarking.h b/src/dis7/common/AggregateMarking.h new file mode 100644 index 00000000..ee92b590 --- /dev/null +++ b/src/dis7/common/AggregateMarking.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Specifies the character set used in the first byte, followed by up to 31 +// characters of text data. Section 6.2.4. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AggregateMarking { + protected: + /** The character set */ + uint8_t _characterSet; + + /** The characters */ + uint8_t _characters[31]; + + public: + AggregateMarking(); + virtual ~AggregateMarking(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getCharacterSet() const; + void setCharacterSet(uint8_t pX); + + uint8_t* getCharacters(); + const uint8_t* getCharacters() const; + void setCharacters(const uint8_t* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AggregateMarking& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AggregateType.cpp b/src/dis7/common/AggregateType.cpp new file mode 100644 index 00000000..d767e36a --- /dev/null +++ b/src/dis7/common/AggregateType.cpp @@ -0,0 +1,120 @@ +#include "dis7/AggregateType.h" + +using namespace DIS; + +AggregateType::AggregateType() + : _aggregateKind(0), + _domain(0), + _country(0), + _category(0), + _subcategory(0), + _specific(0), + _extra(0) {} + +AggregateType::~AggregateType() {} + +uint8_t AggregateType::getAggregateKind() const { return _aggregateKind; } + +void AggregateType::setAggregateKind(uint8_t pX) { _aggregateKind = pX; } + +uint8_t AggregateType::getDomain() const { return _domain; } + +void AggregateType::setDomain(uint8_t pX) { _domain = pX; } + +uint16_t AggregateType::getCountry() const { return _country; } + +void AggregateType::setCountry(uint16_t pX) { _country = pX; } + +uint8_t AggregateType::getCategory() const { return _category; } + +void AggregateType::setCategory(uint8_t pX) { _category = pX; } + +uint8_t AggregateType::getSubcategory() const { return _subcategory; } + +void AggregateType::setSubcategory(uint8_t pX) { _subcategory = pX; } + +uint8_t AggregateType::getSpecific() const { return _specific; } + +void AggregateType::setSpecific(uint8_t pX) { _specific = pX; } + +uint8_t AggregateType::getExtra() const { return _extra; } + +void AggregateType::setExtra(uint8_t pX) { _extra = pX; } + +void AggregateType::marshal(DataStream& dataStream) const { + dataStream << _aggregateKind; + dataStream << _domain; + dataStream << _country; + dataStream << _category; + dataStream << _subcategory; + dataStream << _specific; + dataStream << _extra; +} + +void AggregateType::unmarshal(DataStream& dataStream) { + dataStream >> _aggregateKind; + dataStream >> _domain; + dataStream >> _country; + dataStream >> _category; + dataStream >> _subcategory; + dataStream >> _specific; + dataStream >> _extra; +} + +bool AggregateType::operator==(const AggregateType& rhs) const { + bool ivarsEqual = true; + + if (!(_aggregateKind == rhs._aggregateKind)) ivarsEqual = false; + if (!(_domain == rhs._domain)) ivarsEqual = false; + if (!(_country == rhs._country)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_subcategory == rhs._subcategory)) ivarsEqual = false; + if (!(_specific == rhs._specific)) ivarsEqual = false; + if (!(_extra == rhs._extra)) ivarsEqual = false; + + return ivarsEqual; +} + +int AggregateType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _aggregateKind + marshalSize = marshalSize + 1; // _domain + marshalSize = marshalSize + 2; // _country + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _subcategory + marshalSize = marshalSize + 1; // _specific + marshalSize = marshalSize + 1; // _extra + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AggregateType.h b/src/dis7/common/AggregateType.h new file mode 100644 index 00000000..8b8b4880 --- /dev/null +++ b/src/dis7/common/AggregateType.h @@ -0,0 +1,101 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Identifies the type and organization of an aggregate. Section 6.2.5 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AggregateType { + protected: + /** Grouping criterion used to group the aggregate. Enumeration from EBV + * document */ + uint8_t _aggregateKind; + + /** Domain of entity (air, surface, subsurface, space, etc) Zero means domain + * does not apply. */ + uint8_t _domain; + + /** country to which the design of the entity is attributed */ + uint16_t _country; + + /** category of entity */ + uint8_t _category; + + /** subcategory of entity */ + uint8_t _subcategory; + + /** specific info based on subcategory field */ + uint8_t _specific; + + uint8_t _extra; + + public: + AggregateType(); + virtual ~AggregateType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getAggregateKind() const; + void setAggregateKind(uint8_t pX); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint16_t getCountry() const; + void setCountry(uint16_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + uint8_t getSpecific() const; + void setSpecific(uint8_t pX); + + uint8_t getExtra() const; + void setExtra(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AggregateType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AngleDeception.cpp b/src/dis7/common/AngleDeception.cpp new file mode 100644 index 00000000..0c339d90 --- /dev/null +++ b/src/dis7/common/AngleDeception.cpp @@ -0,0 +1,219 @@ +#include "dis7/AngleDeception.h" + +using namespace DIS; + +AngleDeception::AngleDeception() + : _recordType(3501), + _recordLength(48), + _padding(0), + _emitterNumber(0), + _beamNumber(0), + _stateIndicator(0), + _padding2(0), + _azimuthOffset(0.0), + _azimuthWidth(0.0), + _azimuthPullRate(0.0), + _azimuthPullAcceleration(0.0), + _elevationOffset(0.0), + _elevationWidth(0.0), + _elevationPullRate(0.0), + _elevationPullAcceleration(0.0), + _padding3(0) {} + +AngleDeception::~AngleDeception() {} + +uint32_t AngleDeception::getRecordType() const { return _recordType; } + +void AngleDeception::setRecordType(uint32_t pX) { _recordType = pX; } + +uint16_t AngleDeception::getRecordLength() const { return _recordLength; } + +void AngleDeception::setRecordLength(uint16_t pX) { _recordLength = pX; } + +uint16_t AngleDeception::getPadding() const { return _padding; } + +void AngleDeception::setPadding(uint16_t pX) { _padding = pX; } + +uint8_t AngleDeception::getEmitterNumber() const { + return _emitterNumber; +} + +void AngleDeception::setEmitterNumber(uint8_t pX) { _emitterNumber = pX; } + +uint8_t AngleDeception::getBeamNumber() const { return _beamNumber; } + +void AngleDeception::setBeamNumber(uint8_t pX) { _beamNumber = pX; } + +uint8_t AngleDeception::getStateIndicator() const { + return _stateIndicator; +} + +void AngleDeception::setStateIndicator(uint8_t pX) { + _stateIndicator = pX; +} + +uint32_t AngleDeception::getPadding2() const { return _padding2; } + +void AngleDeception::setPadding2(uint32_t pX) { _padding2 = pX; } + +float AngleDeception::getAzimuthOffset() const { return _azimuthOffset; } + +void AngleDeception::setAzimuthOffset(float pX) { _azimuthOffset = pX; } + +float AngleDeception::getAzimuthWidth() const { return _azimuthWidth; } + +void AngleDeception::setAzimuthWidth(float pX) { _azimuthWidth = pX; } + +float AngleDeception::getAzimuthPullRate() const { return _azimuthPullRate; } + +void AngleDeception::setAzimuthPullRate(float pX) { _azimuthPullRate = pX; } + +float AngleDeception::getAzimuthPullAcceleration() const { + return _azimuthPullAcceleration; +} + +void AngleDeception::setAzimuthPullAcceleration(float pX) { + _azimuthPullAcceleration = pX; +} + +float AngleDeception::getElevationOffset() const { return _elevationOffset; } + +void AngleDeception::setElevationOffset(float pX) { _elevationOffset = pX; } + +float AngleDeception::getElevationWidth() const { return _elevationWidth; } + +void AngleDeception::setElevationWidth(float pX) { _elevationWidth = pX; } + +float AngleDeception::getElevationPullRate() const { + return _elevationPullRate; +} + +void AngleDeception::setElevationPullRate(float pX) { _elevationPullRate = pX; } + +float AngleDeception::getElevationPullAcceleration() const { + return _elevationPullAcceleration; +} + +void AngleDeception::setElevationPullAcceleration(float pX) { + _elevationPullAcceleration = pX; +} + +uint32_t AngleDeception::getPadding3() const { return _padding3; } + +void AngleDeception::setPadding3(uint32_t pX) { _padding3 = pX; } + +void AngleDeception::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _padding; + dataStream << _emitterNumber; + dataStream << _beamNumber; + dataStream << _stateIndicator; + dataStream << _padding2; + dataStream << _azimuthOffset; + dataStream << _azimuthWidth; + dataStream << _azimuthPullRate; + dataStream << _azimuthPullAcceleration; + dataStream << _elevationOffset; + dataStream << _elevationWidth; + dataStream << _elevationPullRate; + dataStream << _elevationPullAcceleration; + dataStream << _padding3; +} + +void AngleDeception::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _padding; + dataStream >> _emitterNumber; + dataStream >> _beamNumber; + dataStream >> _stateIndicator; + dataStream >> _padding2; + dataStream >> _azimuthOffset; + dataStream >> _azimuthWidth; + dataStream >> _azimuthPullRate; + dataStream >> _azimuthPullAcceleration; + dataStream >> _elevationOffset; + dataStream >> _elevationWidth; + dataStream >> _elevationPullRate; + dataStream >> _elevationPullAcceleration; + dataStream >> _padding3; +} + +bool AngleDeception::operator==(const AngleDeception& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_emitterNumber == rhs._emitterNumber)) ivarsEqual = false; + if (!(_beamNumber == rhs._beamNumber)) ivarsEqual = false; + if (!(_stateIndicator == rhs._stateIndicator)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_azimuthOffset == rhs._azimuthOffset)) ivarsEqual = false; + if (!(_azimuthWidth == rhs._azimuthWidth)) ivarsEqual = false; + if (!(_azimuthPullRate == rhs._azimuthPullRate)) ivarsEqual = false; + if (!(_azimuthPullAcceleration == rhs._azimuthPullAcceleration)) + ivarsEqual = false; + if (!(_elevationOffset == rhs._elevationOffset)) ivarsEqual = false; + if (!(_elevationWidth == rhs._elevationWidth)) ivarsEqual = false; + if (!(_elevationPullRate == rhs._elevationPullRate)) ivarsEqual = false; + if (!(_elevationPullAcceleration == rhs._elevationPullAcceleration)) + ivarsEqual = false; + if (!(_padding3 == rhs._padding3)) ivarsEqual = false; + + return ivarsEqual; +} + +int AngleDeception::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 2; // _padding + marshalSize = marshalSize + 1; // _emitterNumber + marshalSize = marshalSize + 1; // _beamNumber + marshalSize = marshalSize + 1; // _stateIndicator + marshalSize = marshalSize + 4; // _padding2 + marshalSize = marshalSize + 4; // _azimuthOffset + marshalSize = marshalSize + 4; // _azimuthWidth + marshalSize = marshalSize + 4; // _azimuthPullRate + marshalSize = marshalSize + 4; // _azimuthPullAcceleration + marshalSize = marshalSize + 4; // _elevationOffset + marshalSize = marshalSize + 4; // _elevationWidth + marshalSize = marshalSize + 4; // _elevationPullRate + marshalSize = marshalSize + 4; // _elevationPullAcceleration + marshalSize = marshalSize + 4; // _padding3 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AngleDeception.h b/src/dis7/common/AngleDeception.h new file mode 100644 index 00000000..37a51e09 --- /dev/null +++ b/src/dis7/common/AngleDeception.h @@ -0,0 +1,142 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The Angle Deception attribute record may be used to communicate discrete +// values that are associated with angle deception jamming that cannot be +// referenced to an emitter mode. The values provided in the record records +// (provided in the associated Electromagnetic Emission PDU). (The victim radar +// beams are those that are targeted by the jammer.) Section 6.2.12.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AngleDeception { + protected: + uint32_t _recordType; + + uint16_t _recordLength; + + uint16_t _padding; + + uint8_t _emitterNumber; + + uint8_t _beamNumber; + + uint8_t _stateIndicator; + + uint32_t _padding2; + + float _azimuthOffset; + + float _azimuthWidth; + + float _azimuthPullRate; + + float _azimuthPullAcceleration; + + float _elevationOffset; + + float _elevationWidth; + + float _elevationPullRate; + + float _elevationPullAcceleration; + + uint32_t _padding3; + + public: + AngleDeception(); + virtual ~AngleDeception(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + uint8_t getEmitterNumber() const; + void setEmitterNumber(uint8_t pX); + + uint8_t getBeamNumber() const; + void setBeamNumber(uint8_t pX); + + uint8_t getStateIndicator() const; + void setStateIndicator(uint8_t pX); + + uint32_t getPadding2() const; + void setPadding2(uint32_t pX); + + float getAzimuthOffset() const; + void setAzimuthOffset(float pX); + + float getAzimuthWidth() const; + void setAzimuthWidth(float pX); + + float getAzimuthPullRate() const; + void setAzimuthPullRate(float pX); + + float getAzimuthPullAcceleration() const; + void setAzimuthPullAcceleration(float pX); + + float getElevationOffset() const; + void setElevationOffset(float pX); + + float getElevationWidth() const; + void setElevationWidth(float pX); + + float getElevationPullRate() const; + void setElevationPullRate(float pX); + + float getElevationPullAcceleration() const; + void setElevationPullAcceleration(float pX); + + uint32_t getPadding3() const; + void setPadding3(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AngleDeception& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AngularVelocityVector.cpp b/src/dis7/common/AngularVelocityVector.cpp new file mode 100644 index 00000000..fdac9c53 --- /dev/null +++ b/src/dis7/common/AngularVelocityVector.cpp @@ -0,0 +1,81 @@ +#include "dis7/AngularVelocityVector.h" + +using namespace DIS; + +AngularVelocityVector::AngularVelocityVector() : _x(0), _y(0), _z(0) {} + +AngularVelocityVector::~AngularVelocityVector() {} + +float AngularVelocityVector::getX() const { return _x; } + +void AngularVelocityVector::setX(float pX) { _x = pX; } + +float AngularVelocityVector::getY() const { return _y; } + +void AngularVelocityVector::setY(float pX) { _y = pX; } + +float AngularVelocityVector::getZ() const { return _z; } + +void AngularVelocityVector::setZ(float pX) { _z = pX; } + +void AngularVelocityVector::marshal(DataStream& dataStream) const { + dataStream << _x; + dataStream << _y; + dataStream << _z; +} + +void AngularVelocityVector::unmarshal(DataStream& dataStream) { + dataStream >> _x; + dataStream >> _y; + dataStream >> _z; +} + +bool AngularVelocityVector::operator==(const AngularVelocityVector& rhs) const { + bool ivarsEqual = true; + + if (!(_x == rhs._x)) ivarsEqual = false; + if (!(_y == rhs._y)) ivarsEqual = false; + if (!(_z == rhs._z)) ivarsEqual = false; + + return ivarsEqual; +} + +int AngularVelocityVector::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _x + marshalSize = marshalSize + 4; // _y + marshalSize = marshalSize + 4; // _z + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AngularVelocityVector.h b/src/dis7/common/AngularVelocityVector.h new file mode 100644 index 00000000..619f011e --- /dev/null +++ b/src/dis7/common/AngularVelocityVector.h @@ -0,0 +1,79 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Angular velocity measured in radians per second out each of the entity's own +// coordinate axes. Order of measurement is angular velocity around the x, y, +// and z axis of the entity. The positive direction is determined by the right +// hand rule. Section 6.2.7 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AngularVelocityVector { + protected: + /** velocity about the x axis */ + float _x; + + /** velocity about the y axis */ + float _y; + + /** velocity about the zaxis */ + float _z; + + public: + AngularVelocityVector(); + virtual ~AngularVelocityVector(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getX() const; + void setX(float pX); + + float getY() const; + void setY(float pX); + + float getZ() const; + void setZ(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AngularVelocityVector& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AntennaLocation.cpp b/src/dis7/common/AntennaLocation.cpp new file mode 100644 index 00000000..fe9ac3b8 --- /dev/null +++ b/src/dis7/common/AntennaLocation.cpp @@ -0,0 +1,94 @@ +#include "dis7/AntennaLocation.h" + +using namespace DIS; + +AntennaLocation::AntennaLocation() + : _antennaLocation(), _relativeAntennaLocation() {} + +AntennaLocation::~AntennaLocation() {} + +Vector3Double& AntennaLocation::getAntennaLocation() { + return _antennaLocation; +} + +const Vector3Double& AntennaLocation::getAntennaLocation() const { + return _antennaLocation; +} + +void AntennaLocation::setAntennaLocation(const Vector3Double& pX) { + _antennaLocation = pX; +} + +Vector3Float& AntennaLocation::getRelativeAntennaLocation() { + return _relativeAntennaLocation; +} + +const Vector3Float& AntennaLocation::getRelativeAntennaLocation() const { + return _relativeAntennaLocation; +} + +void AntennaLocation::setRelativeAntennaLocation(const Vector3Float& pX) { + _relativeAntennaLocation = pX; +} + +void AntennaLocation::marshal(DataStream& dataStream) const { + _antennaLocation.marshal(dataStream); + _relativeAntennaLocation.marshal(dataStream); +} + +void AntennaLocation::unmarshal(DataStream& dataStream) { + _antennaLocation.unmarshal(dataStream); + _relativeAntennaLocation.unmarshal(dataStream); +} + +bool AntennaLocation::operator==(const AntennaLocation& rhs) const { + bool ivarsEqual = true; + + if (!(_antennaLocation == rhs._antennaLocation)) ivarsEqual = false; + if (!(_relativeAntennaLocation == rhs._relativeAntennaLocation)) + ivarsEqual = false; + + return ivarsEqual; +} + +int AntennaLocation::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _antennaLocation.getMarshalledSize(); // _antennaLocation + marshalSize = + marshalSize + + _relativeAntennaLocation.getMarshalledSize(); // _relativeAntennaLocation + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AntennaLocation.h b/src/dis7/common/AntennaLocation.h new file mode 100644 index 00000000..49f0f0d1 --- /dev/null +++ b/src/dis7/common/AntennaLocation.h @@ -0,0 +1,77 @@ +#pragma once + +#include "dis7/Vector3Double.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Location of the radiating portion of the antenna, specified in world +// coordinates and entity coordinates. Section 6.2.8 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AntennaLocation { + protected: + /** Location of the radiating portion of the antenna in world coordinates + */ + Vector3Double _antennaLocation; + + /** Location of the radiating portion of the antenna in entity coordinates + */ + Vector3Float _relativeAntennaLocation; + + public: + AntennaLocation(); + virtual ~AntennaLocation(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + Vector3Double& getAntennaLocation(); + const Vector3Double& getAntennaLocation() const; + void setAntennaLocation(const Vector3Double& pX); + + Vector3Float& getRelativeAntennaLocation(); + const Vector3Float& getRelativeAntennaLocation() const; + void setRelativeAntennaLocation(const Vector3Float& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AntennaLocation& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ArticulatedParts.cpp b/src/dis7/common/ArticulatedParts.cpp new file mode 100644 index 00000000..fcd613a6 --- /dev/null +++ b/src/dis7/common/ArticulatedParts.cpp @@ -0,0 +1,118 @@ +#include "dis7/ArticulatedParts.h" + +using namespace DIS; + +ArticulatedParts::ArticulatedParts() + : _recordType(0), + _changeIndicator(0), + _partAttachedTo(0), + _parameterType(0), + _parameterValue(0), + _padding(0) {} + +ArticulatedParts::~ArticulatedParts() {} + +uint8_t ArticulatedParts::getRecordType() const { return _recordType; } + +void ArticulatedParts::setRecordType(uint8_t pX) { _recordType = pX; } + +uint8_t ArticulatedParts::getChangeIndicator() const { + return _changeIndicator; +} + +void ArticulatedParts::setChangeIndicator(uint8_t pX) { + _changeIndicator = pX; +} + +uint16_t ArticulatedParts::getPartAttachedTo() const { + return _partAttachedTo; +} + +void ArticulatedParts::setPartAttachedTo(uint16_t pX) { + _partAttachedTo = pX; +} + +uint32_t ArticulatedParts::getParameterType() const { + return _parameterType; +} + +void ArticulatedParts::setParameterType(uint32_t pX) { + _parameterType = pX; +} + +float ArticulatedParts::getParameterValue() const { return _parameterValue; } + +void ArticulatedParts::setParameterValue(float pX) { _parameterValue = pX; } + +void ArticulatedParts::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _changeIndicator; + dataStream << _partAttachedTo; + dataStream << _parameterType; + dataStream << _parameterValue; + dataStream << _padding; +} + +void ArticulatedParts::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _changeIndicator; + dataStream >> _partAttachedTo; + dataStream >> _parameterType; + dataStream >> _parameterValue; + dataStream >> _padding; +} + +bool ArticulatedParts::operator==(const ArticulatedParts& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_changeIndicator == rhs._changeIndicator)) ivarsEqual = false; + if (!(_partAttachedTo == rhs._partAttachedTo)) ivarsEqual = false; + if (!(_parameterType == rhs._parameterType)) ivarsEqual = false; + if (!(_parameterValue == rhs._parameterValue)) ivarsEqual = false; + + return ivarsEqual; +} + +int ArticulatedParts::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _recordType + marshalSize = marshalSize + 1; // _changeIndicator + marshalSize = marshalSize + 2; // _partAttachedTo + marshalSize = marshalSize + 4; // _parameterType + marshalSize = marshalSize + 4; // _parameterValue + marshalSize = marshalSize + 4; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ArticulatedParts.h b/src/dis7/common/ArticulatedParts.h new file mode 100644 index 00000000..b0f4b3de --- /dev/null +++ b/src/dis7/common/ArticulatedParts.h @@ -0,0 +1,98 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// articulated parts for movable parts and a combination of moveable/attached +// parts of an entity. Section 6.2.94.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ArticulatedParts { + protected: + /** the identification of the Variable Parameter record. Enumeration from EBV + */ + uint8_t _recordType; + + /** indicate the change of any parameter for any articulated part. Starts at + * zero, incremented for each change */ + uint8_t _changeIndicator; + + /** the identification of the articulated part to which this articulation + * parameter is attached. This field shall be specified by a 16-bit unsigned + * integer. This field shall contain the value zero if the articulated part is + * attached directly to the entity. */ + uint16_t _partAttachedTo; + + /** the type of parameter represented, 32 bit enumeration */ + uint32_t _parameterType; + + /** This field shall specify the parameter value and shall be specified by a +32-bit floating point number. */ + float _parameterValue; + + /** 32 bits of unused padding */ + uint32_t _padding; + + public: + ArticulatedParts(); + virtual ~ArticulatedParts(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRecordType() const; + void setRecordType(uint8_t pX); + + uint8_t getChangeIndicator() const; + void setChangeIndicator(uint8_t pX); + + uint16_t getPartAttachedTo() const; + void setPartAttachedTo(uint16_t pX); + + uint32_t getParameterType() const; + void setParameterType(uint32_t pX); + + float getParameterValue() const; + void setParameterValue(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ArticulatedParts& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Association.cpp b/src/dis7/common/Association.cpp new file mode 100644 index 00000000..3459d881 --- /dev/null +++ b/src/dis7/common/Association.cpp @@ -0,0 +1,113 @@ +#include "dis7/Association.h" + +using namespace DIS; + +Association::Association() + : _associationType(0), + _padding4(0), + _associatedEntityID(), + _associatedLocation() {} + +Association::~Association() {} + +uint8_t Association::getAssociationType() const { + return _associationType; +} + +void Association::setAssociationType(uint8_t pX) { + _associationType = pX; +} + +uint8_t Association::getPadding4() const { return _padding4; } + +void Association::setPadding4(uint8_t pX) { _padding4 = pX; } + +EntityID& Association::getAssociatedEntityID() { return _associatedEntityID; } + +const EntityID& Association::getAssociatedEntityID() const { + return _associatedEntityID; +} + +void Association::setAssociatedEntityID(const EntityID& pX) { + _associatedEntityID = pX; +} + +Vector3Double& Association::getAssociatedLocation() { + return _associatedLocation; +} + +const Vector3Double& Association::getAssociatedLocation() const { + return _associatedLocation; +} + +void Association::setAssociatedLocation(const Vector3Double& pX) { + _associatedLocation = pX; +} + +void Association::marshal(DataStream& dataStream) const { + dataStream << _associationType; + dataStream << _padding4; + _associatedEntityID.marshal(dataStream); + _associatedLocation.marshal(dataStream); +} + +void Association::unmarshal(DataStream& dataStream) { + dataStream >> _associationType; + dataStream >> _padding4; + _associatedEntityID.unmarshal(dataStream); + _associatedLocation.unmarshal(dataStream); +} + +bool Association::operator==(const Association& rhs) const { + bool ivarsEqual = true; + + if (!(_associationType == rhs._associationType)) ivarsEqual = false; + if (!(_padding4 == rhs._padding4)) ivarsEqual = false; + if (!(_associatedEntityID == rhs._associatedEntityID)) ivarsEqual = false; + if (!(_associatedLocation == rhs._associatedLocation)) ivarsEqual = false; + + return ivarsEqual; +} + +int Association::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _associationType + marshalSize = marshalSize + 1; // _padding4 + marshalSize = marshalSize + + _associatedEntityID.getMarshalledSize(); // _associatedEntityID + marshalSize = marshalSize + + _associatedLocation.getMarshalledSize(); // _associatedLocation + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Association.h b/src/dis7/common/Association.h new file mode 100644 index 00000000..3f08b274 --- /dev/null +++ b/src/dis7/common/Association.h @@ -0,0 +1,90 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/Vector3Double.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// An entity's associations with other entities and/or locations. For each +// association, this record shall specify the type of the association, the +// associated entity's EntityID and/or the associated location's world +// coordinates. This record may be used (optionally) in a transfer transaction +// to send internal state data from the divesting simulation to the acquiring +// simulation (see 5.9.4). This record may also be used for other purposes. +// Section 6.2.10 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Association { + protected: + uint8_t _associationType; + + uint8_t _padding4; + + /** identity of associated entity. If none, NO_SPECIFIC_ENTITY */ + EntityID _associatedEntityID; + + /** location, in world coordinates */ + Vector3Double _associatedLocation; + + public: + Association(); + virtual ~Association(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getAssociationType() const; + void setAssociationType(uint8_t pX); + + uint8_t getPadding4() const; + void setPadding4(uint8_t pX); + + EntityID& getAssociatedEntityID(); + const EntityID& getAssociatedEntityID() const; + void setAssociatedEntityID(const EntityID& pX); + + Vector3Double& getAssociatedLocation(); + const Vector3Double& getAssociatedLocation() const; + void setAssociatedLocation(const Vector3Double& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Association& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AttachedParts.cpp b/src/dis7/common/AttachedParts.cpp new file mode 100644 index 00000000..8d61df48 --- /dev/null +++ b/src/dis7/common/AttachedParts.cpp @@ -0,0 +1,114 @@ +#include "dis7/AttachedParts.h" + +using namespace DIS; + +AttachedParts::AttachedParts() + : _recordType(1), + _detachedIndicator(0), + _partAttachedTo(0), + _parameterType(0), + _attachedPartType(0) {} + +AttachedParts::~AttachedParts() {} + +uint8_t AttachedParts::getRecordType() const { return _recordType; } + +void AttachedParts::setRecordType(uint8_t pX) { _recordType = pX; } + +uint8_t AttachedParts::getDetachedIndicator() const { + return _detachedIndicator; +} + +void AttachedParts::setDetachedIndicator(uint8_t pX) { + _detachedIndicator = pX; +} + +uint16_t AttachedParts::getPartAttachedTo() const { + return _partAttachedTo; +} + +void AttachedParts::setPartAttachedTo(uint16_t pX) { + _partAttachedTo = pX; +} + +uint32_t AttachedParts::getParameterType() const { return _parameterType; } + +void AttachedParts::setParameterType(uint32_t pX) { _parameterType = pX; } + +uint64_t AttachedParts::getAttachedPartType() const { + return _attachedPartType; +} + +void AttachedParts::setAttachedPartType(uint64_t pX) { + _attachedPartType = pX; +} + +void AttachedParts::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _detachedIndicator; + dataStream << _partAttachedTo; + dataStream << _parameterType; + dataStream << _attachedPartType; +} + +void AttachedParts::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _detachedIndicator; + dataStream >> _partAttachedTo; + dataStream >> _parameterType; + dataStream >> _attachedPartType; +} + +bool AttachedParts::operator==(const AttachedParts& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_detachedIndicator == rhs._detachedIndicator)) ivarsEqual = false; + if (!(_partAttachedTo == rhs._partAttachedTo)) ivarsEqual = false; + if (!(_parameterType == rhs._parameterType)) ivarsEqual = false; + if (!(_attachedPartType == rhs._attachedPartType)) ivarsEqual = false; + + return ivarsEqual; +} + +int AttachedParts::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _recordType + marshalSize = marshalSize + 1; // _detachedIndicator + marshalSize = marshalSize + 2; // _partAttachedTo + marshalSize = marshalSize + 4; // _parameterType + marshalSize = marshalSize + 8; // _attachedPartType + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/AttachedParts.h b/src/dis7/common/AttachedParts.h new file mode 100644 index 00000000..7b3f5b55 --- /dev/null +++ b/src/dis7/common/AttachedParts.h @@ -0,0 +1,93 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Removable parts that may be attached to an entity. Section 6.2.94.3 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AttachedParts { + protected: + /** the identification of the Variable Parameter record. Enumeration from EBV + */ + uint8_t _recordType; + + /** 0 = attached, 1 = detached. See I.2.3.1 for state transition diagram */ + uint8_t _detachedIndicator; + + /** the identification of the articulated part to which this articulation + * parameter is attached. This field shall be specified by a 16-bit unsigned + * integer. This field shall contain the value zero if the articulated part is + * attached directly to the entity. */ + uint16_t _partAttachedTo; + + /** The location or station to which the part is attached */ + uint32_t _parameterType; + + /** The definition of the 64 bits shall be determined based on the type of + * parameter specified in the Parameter Type field */ + uint64_t _attachedPartType; + + public: + AttachedParts(); + virtual ~AttachedParts(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRecordType() const; + void setRecordType(uint8_t pX); + + uint8_t getDetachedIndicator() const; + void setDetachedIndicator(uint8_t pX); + + uint16_t getPartAttachedTo() const; + void setPartAttachedTo(uint16_t pX); + + uint32_t getParameterType() const; + void setParameterType(uint32_t pX); + + uint64_t getAttachedPartType() const; + void setAttachedPartType(uint64_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AttachedParts& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Attribute.cpp b/src/dis7/common/Attribute.cpp new file mode 100644 index 00000000..20995d85 --- /dev/null +++ b/src/dis7/common/Attribute.cpp @@ -0,0 +1,86 @@ +#include "dis7/Attribute.h" + +using namespace DIS; + +Attribute::Attribute() + : _recordType(0), _recordLength(0), _recordSpecificFields(0) {} + +Attribute::~Attribute() {} + +uint32_t Attribute::getRecordType() const { return _recordType; } + +void Attribute::setRecordType(uint32_t pX) { _recordType = pX; } + +uint16_t Attribute::getRecordLength() const { return _recordLength; } + +void Attribute::setRecordLength(uint16_t pX) { _recordLength = pX; } + +int64_t Attribute::getRecordSpecificFields() const { + return _recordSpecificFields; +} + +void Attribute::setRecordSpecificFields(int64_t pX) { + _recordSpecificFields = pX; +} + +void Attribute::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _recordSpecificFields; +} + +void Attribute::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _recordSpecificFields; +} + +bool Attribute::operator==(const Attribute& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_recordSpecificFields == rhs._recordSpecificFields)) ivarsEqual = false; + + return ivarsEqual; +} + +int Attribute::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 1; // _recordLength + marshalSize = marshalSize + 8; // _recordSpecificFields + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Attribute.h b/src/dis7/common/Attribute.h new file mode 100644 index 00000000..e14cf28b --- /dev/null +++ b/src/dis7/common/Attribute.h @@ -0,0 +1,74 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Used to convey information for one or more attributes. Attributes conform to +// the standard variable record format of 6.2.82. Section 6.2.10 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Attribute { + protected: + uint32_t _recordType; + + uint16_t _recordLength; + + int64_t _recordSpecificFields; + + public: + Attribute(); + virtual ~Attribute(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + int64_t getRecordSpecificFields() const; + void setRecordSpecificFields(int64_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Attribute& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/BeamAntennaPattern.cpp b/src/dis7/common/BeamAntennaPattern.cpp new file mode 100644 index 00000000..0742a33d --- /dev/null +++ b/src/dis7/common/BeamAntennaPattern.cpp @@ -0,0 +1,164 @@ +#include "dis7/BeamAntennaPattern.h" + +using namespace DIS; + +BeamAntennaPattern::BeamAntennaPattern() + : _beamDirection(), + _azimuthBeamwidth(0), + _elevationBeamwidth(0), + _referenceSystem(0), + _padding1(0), + _padding2(0), + _ez(0.0), + _ex(0.0), + _phase(0.0), + _padding3(0) {} + +BeamAntennaPattern::~BeamAntennaPattern() {} + +EulerAngles& BeamAntennaPattern::getBeamDirection() { return _beamDirection; } + +const EulerAngles& BeamAntennaPattern::getBeamDirection() const { + return _beamDirection; +} + +void BeamAntennaPattern::setBeamDirection(const EulerAngles& pX) { + _beamDirection = pX; +} + +float BeamAntennaPattern::getAzimuthBeamwidth() const { + return _azimuthBeamwidth; +} + +void BeamAntennaPattern::setAzimuthBeamwidth(float pX) { + _azimuthBeamwidth = pX; +} + +float BeamAntennaPattern::getElevationBeamwidth() const { + return _elevationBeamwidth; +} + +void BeamAntennaPattern::setElevationBeamwidth(float pX) { + _elevationBeamwidth = pX; +} + +float BeamAntennaPattern::getReferenceSystem() const { + return _referenceSystem; +} + +void BeamAntennaPattern::setReferenceSystem(float pX) { _referenceSystem = pX; } + +uint8_t BeamAntennaPattern::getPadding1() const { return _padding1; } + +void BeamAntennaPattern::setPadding1(uint8_t pX) { _padding1 = pX; } + +uint16_t BeamAntennaPattern::getPadding2() const { return _padding2; } + +void BeamAntennaPattern::setPadding2(uint16_t pX) { _padding2 = pX; } + +float BeamAntennaPattern::getEz() const { return _ez; } + +void BeamAntennaPattern::setEz(float pX) { _ez = pX; } + +float BeamAntennaPattern::getEx() const { return _ex; } + +void BeamAntennaPattern::setEx(float pX) { _ex = pX; } + +float BeamAntennaPattern::getPhase() const { return _phase; } + +void BeamAntennaPattern::setPhase(float pX) { _phase = pX; } + +uint32_t BeamAntennaPattern::getPadding3() const { return _padding3; } + +void BeamAntennaPattern::setPadding3(uint32_t pX) { _padding3 = pX; } + +void BeamAntennaPattern::marshal(DataStream& dataStream) const { + _beamDirection.marshal(dataStream); + dataStream << _azimuthBeamwidth; + dataStream << _elevationBeamwidth; + dataStream << _referenceSystem; + dataStream << _padding1; + dataStream << _padding2; + dataStream << _ez; + dataStream << _ex; + dataStream << _phase; + dataStream << _padding3; +} + +void BeamAntennaPattern::unmarshal(DataStream& dataStream) { + _beamDirection.unmarshal(dataStream); + dataStream >> _azimuthBeamwidth; + dataStream >> _elevationBeamwidth; + dataStream >> _referenceSystem; + dataStream >> _padding1; + dataStream >> _padding2; + dataStream >> _ez; + dataStream >> _ex; + dataStream >> _phase; + dataStream >> _padding3; +} + +bool BeamAntennaPattern::operator==(const BeamAntennaPattern& rhs) const { + bool ivarsEqual = true; + + if (!(_beamDirection == rhs._beamDirection)) ivarsEqual = false; + if (!(_azimuthBeamwidth == rhs._azimuthBeamwidth)) ivarsEqual = false; + if (!(_elevationBeamwidth == rhs._elevationBeamwidth)) ivarsEqual = false; + if (!(_referenceSystem == rhs._referenceSystem)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_ez == rhs._ez)) ivarsEqual = false; + if (!(_ex == rhs._ex)) ivarsEqual = false; + if (!(_phase == rhs._phase)) ivarsEqual = false; + if (!(_padding3 == rhs._padding3)) ivarsEqual = false; + + return ivarsEqual; +} + +int BeamAntennaPattern::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _beamDirection.getMarshalledSize(); // _beamDirection + marshalSize = marshalSize + 4; // _azimuthBeamwidth + marshalSize = marshalSize + 4; // _elevationBeamwidth + marshalSize = marshalSize + 4; // _referenceSystem + marshalSize = marshalSize + 1; // _padding1 + marshalSize = marshalSize + 2; // _padding2 + marshalSize = marshalSize + 4; // _ez + marshalSize = marshalSize + 4; // _ex + marshalSize = marshalSize + 4; // _phase + marshalSize = marshalSize + 4; // _padding3 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/BeamAntennaPattern.h b/src/dis7/common/BeamAntennaPattern.h new file mode 100644 index 00000000..f9bb7a2f --- /dev/null +++ b/src/dis7/common/BeamAntennaPattern.h @@ -0,0 +1,128 @@ +#pragma once + +#include "dis7/EulerAngles.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Used when the antenna pattern type field has a value of 1. Specifies the +// direction, pattern, and polarization of radiation from an antenna. +// Section 6.2.9.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT BeamAntennaPattern { + protected: + /** The rotation that transforms the reference coordinate sytem into the beam + * coordinate system. Either world coordinates or entity coordinates may be + * used as the reference coordinate system, as specified by the reference + * system field of the antenna pattern record. */ + EulerAngles _beamDirection; + + float _azimuthBeamwidth; + + float _elevationBeamwidth; + + float _referenceSystem; + + uint8_t _padding1; + + uint16_t _padding2; + + /** This field shall specify the magnitude of the Z-component (in beam + * coordinates) of the Electrical field at some arbitrary single point in the + * main beam and in the far field of the antenna. */ + float _ez; + + /** This field shall specify the magnitude of the X-component (in beam + * coordinates) of the Electri- cal field at some arbitrary single point in + * the main beam and in the far field of the antenna. */ + float _ex; + + /** This field shall specify the phase angle between EZ and EX in radians. If + * fully omni-direc- tional antenna is modeled using beam pattern type one, + * the omni-directional antenna shall be repre- sented by beam direction Euler + * angles psi, theta, and phi of zero, an azimuth beamwidth of 2PI, and an + * elevation beamwidth of PI */ + float _phase; + + /** padding */ + uint32_t _padding3; + + public: + BeamAntennaPattern(); + virtual ~BeamAntennaPattern(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EulerAngles& getBeamDirection(); + const EulerAngles& getBeamDirection() const; + void setBeamDirection(const EulerAngles& pX); + + float getAzimuthBeamwidth() const; + void setAzimuthBeamwidth(float pX); + + float getElevationBeamwidth() const; + void setElevationBeamwidth(float pX); + + float getReferenceSystem() const; + void setReferenceSystem(float pX); + + uint8_t getPadding1() const; + void setPadding1(uint8_t pX); + + uint16_t getPadding2() const; + void setPadding2(uint16_t pX); + + float getEz() const; + void setEz(float pX); + + float getEx() const; + void setEx(float pX); + + float getPhase() const; + void setPhase(float pX); + + uint32_t getPadding3() const; + void setPadding3(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const BeamAntennaPattern& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/BeamStatus.cpp b/src/dis7/common/BeamStatus.cpp new file mode 100644 index 00000000..2f2f1b25 --- /dev/null +++ b/src/dis7/common/BeamStatus.cpp @@ -0,0 +1,63 @@ +#include "dis7/BeamStatus.h" + +using namespace DIS; + +BeamStatus::BeamStatus() : _beamState(0) {} + +BeamStatus::~BeamStatus() {} + +uint8_t BeamStatus::getBeamState() const { return _beamState; } + +void BeamStatus::setBeamState(uint8_t pX) { _beamState = pX; } + +void BeamStatus::marshal(DataStream& dataStream) const { + dataStream << _beamState; +} + +void BeamStatus::unmarshal(DataStream& dataStream) { dataStream >> _beamState; } + +bool BeamStatus::operator==(const BeamStatus& rhs) const { + bool ivarsEqual = true; + + if (!(_beamState == rhs._beamState)) ivarsEqual = false; + + return ivarsEqual; +} + +int BeamStatus::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _beamState + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/BeamStatus.h b/src/dis7/common/BeamStatus.h new file mode 100644 index 00000000..01fb9059 --- /dev/null +++ b/src/dis7/common/BeamStatus.h @@ -0,0 +1,67 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information related to the status of a beam. This is contained in the beam +// status field of the electromagnitec emission PDU. The first bit determines +// whether the beam is active (0) or deactivated (1). + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT BeamStatus { + protected: + /** First bit zero means beam is active, first bit = 1 means deactivated. The + * rest is padding. */ + uint8_t _beamState; + + public: + BeamStatus(); + virtual ~BeamStatus(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getBeamState() const; + void setBeamState(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const BeamStatus& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/BlankingSector.cpp b/src/dis7/common/BlankingSector.cpp new file mode 100644 index 00000000..115d1497 --- /dev/null +++ b/src/dis7/common/BlankingSector.cpp @@ -0,0 +1,153 @@ +#include "dis7/BlankingSector.h" + +using namespace DIS; + +BlankingSector::BlankingSector() + : _recordType(3500), + _recordLength(0), + _emitterNumber(0), + _beamNumber(0), + _stateIndicator(0), + _leftAzimuth(0.0), + _rightAzimuth(0.0), + _lowerElevation(0.0), + _upperElevation(0.0), + _residualPower(0.0) {} + +BlankingSector::~BlankingSector() {} + +uint32_t BlankingSector::getRecordType() const { return _recordType; } + +void BlankingSector::setRecordType(uint32_t pX) { _recordType = pX; } + +uint16_t BlankingSector::getRecordLength() const { return _recordLength; } + +void BlankingSector::setRecordLength(uint16_t pX) { _recordLength = pX; } + +uint8_t BlankingSector::getEmitterNumber() const { + return _emitterNumber; +} + +void BlankingSector::setEmitterNumber(uint8_t pX) { _emitterNumber = pX; } + +uint8_t BlankingSector::getBeamNumber() const { return _beamNumber; } + +void BlankingSector::setBeamNumber(uint8_t pX) { _beamNumber = pX; } + +uint8_t BlankingSector::getStateIndicator() const { + return _stateIndicator; +} + +void BlankingSector::setStateIndicator(uint8_t pX) { + _stateIndicator = pX; +} + +float BlankingSector::getLeftAzimuth() const { return _leftAzimuth; } + +void BlankingSector::setLeftAzimuth(float pX) { _leftAzimuth = pX; } + +float BlankingSector::getRightAzimuth() const { return _rightAzimuth; } + +void BlankingSector::setRightAzimuth(float pX) { _rightAzimuth = pX; } + +float BlankingSector::getLowerElevation() const { return _lowerElevation; } + +void BlankingSector::setLowerElevation(float pX) { _lowerElevation = pX; } + +float BlankingSector::getUpperElevation() const { return _upperElevation; } + +void BlankingSector::setUpperElevation(float pX) { _upperElevation = pX; } + +float BlankingSector::getResidualPower() const { return _residualPower; } + +void BlankingSector::setResidualPower(float pX) { _residualPower = pX; } + +void BlankingSector::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _emitterNumber; + dataStream << _beamNumber; + dataStream << _stateIndicator; + dataStream << _leftAzimuth; + dataStream << _rightAzimuth; + dataStream << _lowerElevation; + dataStream << _upperElevation; + dataStream << _residualPower; +} + +void BlankingSector::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _emitterNumber; + dataStream >> _beamNumber; + dataStream >> _stateIndicator; + dataStream >> _leftAzimuth; + dataStream >> _rightAzimuth; + dataStream >> _lowerElevation; + dataStream >> _upperElevation; + dataStream >> _residualPower; +} + +bool BlankingSector::operator==(const BlankingSector& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_emitterNumber == rhs._emitterNumber)) ivarsEqual = false; + if (!(_beamNumber == rhs._beamNumber)) ivarsEqual = false; + if (!(_stateIndicator == rhs._stateIndicator)) ivarsEqual = false; + if (!(_leftAzimuth == rhs._leftAzimuth)) ivarsEqual = false; + if (!(_rightAzimuth == rhs._rightAzimuth)) ivarsEqual = false; + if (!(_lowerElevation == rhs._lowerElevation)) ivarsEqual = false; + if (!(_upperElevation == rhs._upperElevation)) ivarsEqual = false; + if (!(_residualPower == rhs._residualPower)) ivarsEqual = false; + + return ivarsEqual; +} + +int BlankingSector::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 1; // _emitterNumber + marshalSize = marshalSize + 1; // _beamNumber + marshalSize = marshalSize + 1; // _stateIndicator + marshalSize = marshalSize + 4; // _leftAzimuth + marshalSize = marshalSize + 4; // _rightAzimuth + marshalSize = marshalSize + 4; // _lowerElevation + marshalSize = marshalSize + 4; // _upperElevation + marshalSize = marshalSize + 4; // _residualPower + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/BlankingSector.h b/src/dis7/common/BlankingSector.h new file mode 100644 index 00000000..5c06974a --- /dev/null +++ b/src/dis7/common/BlankingSector.h @@ -0,0 +1,110 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The Blanking Sector attribute record may be used to convey persistent areas +// within a scan volume where emitter power for a specific active emitter beam +// is reduced to an insignificant value. Section 6.2.12 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT BlankingSector { + protected: + uint32_t _recordType; + + uint16_t _recordLength; + + uint8_t _emitterNumber; + + uint8_t _beamNumber; + + uint8_t _stateIndicator; + + float _leftAzimuth; + + float _rightAzimuth; + + float _lowerElevation; + + float _upperElevation; + + float _residualPower; + + public: + BlankingSector(); + virtual ~BlankingSector(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint8_t getEmitterNumber() const; + void setEmitterNumber(uint8_t pX); + + uint8_t getBeamNumber() const; + void setBeamNumber(uint8_t pX); + + uint8_t getStateIndicator() const; + void setStateIndicator(uint8_t pX); + + float getLeftAzimuth() const; + void setLeftAzimuth(float pX); + + float getRightAzimuth() const; + void setRightAzimuth(float pX); + + float getLowerElevation() const; + void setLowerElevation(float pX); + + float getUpperElevation() const; + void setUpperElevation(float pX); + + float getResidualPower() const; + void setResidualPower(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const BlankingSector& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/CMakeLists.txt b/src/dis7/common/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/common/ClockTime.cpp b/src/dis7/common/ClockTime.cpp new file mode 100644 index 00000000..bc5d2e7a --- /dev/null +++ b/src/dis7/common/ClockTime.cpp @@ -0,0 +1,73 @@ +#include "dis7/ClockTime.h" + +using namespace DIS; + +ClockTime::ClockTime() : _hour(0), _timePastHour(0) {} + +ClockTime::~ClockTime() {} + +uint32_t ClockTime::getHour() const { return _hour; } + +void ClockTime::setHour(uint32_t pX) { _hour = pX; } + +uint32_t ClockTime::getTimePastHour() const { return _timePastHour; } + +void ClockTime::setTimePastHour(uint32_t pX) { _timePastHour = pX; } + +void ClockTime::marshal(DataStream& dataStream) const { + dataStream << _hour; + dataStream << _timePastHour; +} + +void ClockTime::unmarshal(DataStream& dataStream) { + dataStream >> _hour; + dataStream >> _timePastHour; +} + +bool ClockTime::operator==(const ClockTime& rhs) const { + bool ivarsEqual = true; + + if (!(_hour == rhs._hour)) ivarsEqual = false; + if (!(_timePastHour == rhs._timePastHour)) ivarsEqual = false; + + return ivarsEqual; +} + +int ClockTime::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _hour + marshalSize = marshalSize + 4; // _timePastHour + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ClockTime.h b/src/dis7/common/ClockTime.h new file mode 100644 index 00000000..cd3b7137 --- /dev/null +++ b/src/dis7/common/ClockTime.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Time measurements that exceed one hour are represented by this record. The +// first field is the hours since the unix epoch (Jan 1 1970, used by most Unix +// systems and java) and the second field the timestamp units since the top of +// the hour. Section 6.2.16 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ClockTime { + protected: + /** Hours in UTC */ + uint32_t _hour; + + /** Time past the hour */ + uint32_t _timePastHour; + + public: + ClockTime(); + virtual ~ClockTime(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getHour() const; + void setHour(uint32_t pX); + + uint32_t getTimePastHour() const; + void setTimePastHour(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ClockTime& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/CommunicationsNodeID.cpp b/src/dis7/common/CommunicationsNodeID.cpp new file mode 100644 index 00000000..4e695541 --- /dev/null +++ b/src/dis7/common/CommunicationsNodeID.cpp @@ -0,0 +1,75 @@ +#include "dis7/CommunicationsNodeID.h" + +using namespace DIS; + +CommunicationsNodeID::CommunicationsNodeID() : _entityID(), _elementID(0) {} + +CommunicationsNodeID::~CommunicationsNodeID() {} + +EntityID& CommunicationsNodeID::getEntityID() { return _entityID; } + +const EntityID& CommunicationsNodeID::getEntityID() const { return _entityID; } + +void CommunicationsNodeID::setEntityID(const EntityID& pX) { _entityID = pX; } + +uint16_t CommunicationsNodeID::getElementID() const { return _elementID; } + +void CommunicationsNodeID::setElementID(uint16_t pX) { _elementID = pX; } + +void CommunicationsNodeID::marshal(DataStream& dataStream) const { + _entityID.marshal(dataStream); + dataStream << _elementID; +} + +void CommunicationsNodeID::unmarshal(DataStream& dataStream) { + _entityID.unmarshal(dataStream); + dataStream >> _elementID; +} + +bool CommunicationsNodeID::operator==(const CommunicationsNodeID& rhs) const { + bool ivarsEqual = true; + + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_elementID == rhs._elementID)) ivarsEqual = false; + + return ivarsEqual; +} + +int CommunicationsNodeID::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID + marshalSize = marshalSize + 2; // _elementID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/CommunicationsNodeID.h b/src/dis7/common/CommunicationsNodeID.h new file mode 100644 index 00000000..fb57b9b8 --- /dev/null +++ b/src/dis7/common/CommunicationsNodeID.h @@ -0,0 +1,70 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Identity of a communications node. Section 6.2.49.4 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT CommunicationsNodeID { + protected: + EntityID _entityID; + + uint16_t _elementID; + + public: + CommunicationsNodeID(); + virtual ~CommunicationsNodeID(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + uint16_t getElementID() const; + void setElementID(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CommunicationsNodeID& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DataQueryDatumSpecification.cpp b/src/dis7/common/DataQueryDatumSpecification.cpp new file mode 100644 index 00000000..7df14cf7 --- /dev/null +++ b/src/dis7/common/DataQueryDatumSpecification.cpp @@ -0,0 +1,150 @@ +#include "dis7/DataQueryDatumSpecification.h" + +using namespace DIS; + +DataQueryDatumSpecification::DataQueryDatumSpecification() + : _numberOfFixedDatums(0), _numberOfVariableDatums(0) {} + +DataQueryDatumSpecification::~DataQueryDatumSpecification() { + _fixedDatumIDList.clear(); + _variableDatumIDList.clear(); +} + +uint32_t DataQueryDatumSpecification::getNumberOfFixedDatums() const { + return _fixedDatumIDList.size(); +} + +uint32_t DataQueryDatumSpecification::getNumberOfVariableDatums() const { + return _variableDatumIDList.size(); +} + +std::vector& +DataQueryDatumSpecification::getFixedDatumIDList() { + return _fixedDatumIDList; +} + +const std::vector& +DataQueryDatumSpecification::getFixedDatumIDList() const { + return _fixedDatumIDList; +} + +void DataQueryDatumSpecification::setFixedDatumIDList( + const std::vector& pX) { + _fixedDatumIDList = pX; +} + +std::vector& +DataQueryDatumSpecification::getVariableDatumIDList() { + return _variableDatumIDList; +} + +const std::vector& +DataQueryDatumSpecification::getVariableDatumIDList() const { + return _variableDatumIDList; +} + +void DataQueryDatumSpecification::setVariableDatumIDList( + const std::vector& pX) { + _variableDatumIDList = pX; +} + +void DataQueryDatumSpecification::marshal(DataStream& dataStream) const { + dataStream << (uint32_t)_fixedDatumIDList.size(); + dataStream << (uint32_t)_variableDatumIDList.size(); + + for (size_t idx = 0; idx < _fixedDatumIDList.size(); idx++) { + UnsignedDISInteger x = _fixedDatumIDList[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumIDList.size(); idx++) { + UnsignedDISInteger x = _variableDatumIDList[idx]; + x.marshal(dataStream); + } +} + +void DataQueryDatumSpecification::unmarshal(DataStream& dataStream) { + dataStream >> _numberOfFixedDatums; + dataStream >> _numberOfVariableDatums; + + _fixedDatumIDList.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatums; idx++) { + UnsignedDISInteger x; + x.unmarshal(dataStream); + _fixedDatumIDList.push_back(x); + } + + _variableDatumIDList.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatums; idx++) { + UnsignedDISInteger x; + x.unmarshal(dataStream); + _variableDatumIDList.push_back(x); + } +} + +bool DataQueryDatumSpecification::operator==( + const DataQueryDatumSpecification& rhs) const { + bool ivarsEqual = true; + + for (size_t idx = 0; idx < _fixedDatumIDList.size(); idx++) { + if (!(_fixedDatumIDList[idx] == rhs._fixedDatumIDList[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumIDList.size(); idx++) { + if (!(_variableDatumIDList[idx] == rhs._variableDatumIDList[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataQueryDatumSpecification::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _numberOfFixedDatums + marshalSize = marshalSize + 4; // _numberOfVariableDatums + + for (uint64_t idx = 0; idx < _fixedDatumIDList.size(); idx++) { + UnsignedDISInteger listElement = _fixedDatumIDList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumIDList.size(); idx++) { + UnsignedDISInteger listElement = _variableDatumIDList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DataQueryDatumSpecification.h b/src/dis7/common/DataQueryDatumSpecification.h new file mode 100644 index 00000000..8bba6d63 --- /dev/null +++ b/src/dis7/common/DataQueryDatumSpecification.h @@ -0,0 +1,85 @@ +#pragma once + +#include + +#include "dis7/UnsignedDISInteger.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// List of fixed and variable datum records. Section 6.2.18 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DataQueryDatumSpecification { + protected: + /** Number of fixed datums */ + uint32_t _numberOfFixedDatums; + + /** Number of variable datums */ + uint32_t _numberOfVariableDatums; + + /** variable length list fixed datum IDs */ + std::vector _fixedDatumIDList; + + /** variable length list variable datum IDs */ + std::vector _variableDatumIDList; + + public: + DataQueryDatumSpecification(); + virtual ~DataQueryDatumSpecification(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfFixedDatums() const; + + uint32_t getNumberOfVariableDatums() const; + + std::vector& getFixedDatumIDList(); + const std::vector& getFixedDatumIDList() const; + void setFixedDatumIDList(const std::vector& pX); + + std::vector& getVariableDatumIDList(); + const std::vector& getVariableDatumIDList() const; + void setVariableDatumIDList(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataQueryDatumSpecification& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DatumSpecification.cpp b/src/dis7/common/DatumSpecification.cpp new file mode 100644 index 00000000..3c0bc0e1 --- /dev/null +++ b/src/dis7/common/DatumSpecification.cpp @@ -0,0 +1,146 @@ +#include "dis7/DatumSpecification.h" + +using namespace DIS; + +DatumSpecification::DatumSpecification() + : _numberOfFixedDatums(0), _numberOfVariableDatums(0) {} + +DatumSpecification::~DatumSpecification() { + _fixedDatumIDList.clear(); + _variableDatumIDList.clear(); +} + +uint32_t DatumSpecification::getNumberOfFixedDatums() const { + return _fixedDatumIDList.size(); +} + +uint32_t DatumSpecification::getNumberOfVariableDatums() const { + return _variableDatumIDList.size(); +} + +std::vector& DatumSpecification::getFixedDatumIDList() { + return _fixedDatumIDList; +} + +const std::vector& DatumSpecification::getFixedDatumIDList() const { + return _fixedDatumIDList; +} + +void DatumSpecification::setFixedDatumIDList( + const std::vector& pX) { + _fixedDatumIDList = pX; +} + +std::vector& DatumSpecification::getVariableDatumIDList() { + return _variableDatumIDList; +} + +const std::vector& DatumSpecification::getVariableDatumIDList() + const { + return _variableDatumIDList; +} + +void DatumSpecification::setVariableDatumIDList( + const std::vector& pX) { + _variableDatumIDList = pX; +} + +void DatumSpecification::marshal(DataStream& dataStream) const { + dataStream << (uint32_t)_fixedDatumIDList.size(); + dataStream << (uint32_t)_variableDatumIDList.size(); + + for (size_t idx = 0; idx < _fixedDatumIDList.size(); idx++) { + FixedDatum x = _fixedDatumIDList[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumIDList.size(); idx++) { + VariableDatum x = _variableDatumIDList[idx]; + x.marshal(dataStream); + } +} + +void DatumSpecification::unmarshal(DataStream& dataStream) { + dataStream >> _numberOfFixedDatums; + dataStream >> _numberOfVariableDatums; + + _fixedDatumIDList.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatums; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumIDList.push_back(x); + } + + _variableDatumIDList.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatums; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumIDList.push_back(x); + } +} + +bool DatumSpecification::operator==(const DatumSpecification& rhs) const { + bool ivarsEqual = true; + + for (size_t idx = 0; idx < _fixedDatumIDList.size(); idx++) { + if (!(_fixedDatumIDList[idx] == rhs._fixedDatumIDList[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumIDList.size(); idx++) { + if (!(_variableDatumIDList[idx] == rhs._variableDatumIDList[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int DatumSpecification::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _numberOfFixedDatums + marshalSize = marshalSize + 4; // _numberOfVariableDatums + + for (uint64_t idx = 0; idx < _fixedDatumIDList.size(); idx++) { + FixedDatum listElement = _fixedDatumIDList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumIDList.size(); idx++) { + VariableDatum listElement = _variableDatumIDList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DatumSpecification.h b/src/dis7/common/DatumSpecification.h new file mode 100644 index 00000000..10f7a6ba --- /dev/null +++ b/src/dis7/common/DatumSpecification.h @@ -0,0 +1,86 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// List of fixed and variable datum records. Section 6.2.19 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DatumSpecification { + protected: + /** Number of fixed datums */ + uint32_t _numberOfFixedDatums; + + /** Number of variable datums */ + uint32_t _numberOfVariableDatums; + + /** variable length list fixed datums */ + std::vector _fixedDatumIDList; + + /** variable length list variable datums */ + std::vector _variableDatumIDList; + + public: + DatumSpecification(); + virtual ~DatumSpecification(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfFixedDatums() const; + + uint32_t getNumberOfVariableDatums() const; + + std::vector& getFixedDatumIDList(); + const std::vector& getFixedDatumIDList() const; + void setFixedDatumIDList(const std::vector& pX); + + std::vector& getVariableDatumIDList(); + const std::vector& getVariableDatumIDList() const; + void setVariableDatumIDList(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DatumSpecification& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DirectedEnergyAreaAimpoint.cpp b/src/dis7/common/DirectedEnergyAreaAimpoint.cpp new file mode 100644 index 00000000..c200eea0 --- /dev/null +++ b/src/dis7/common/DirectedEnergyAreaAimpoint.cpp @@ -0,0 +1,206 @@ +#include "dis7/DirectedEnergyAreaAimpoint.h" + +using namespace DIS; + +DirectedEnergyAreaAimpoint::DirectedEnergyAreaAimpoint() + : _recordType(4001), + _recordLength(0), + _padding(0), + _beamAntennaPatternRecordCount(0), + _directedEnergyTargetEnergyDepositionRecordCount(0) {} + +DirectedEnergyAreaAimpoint::~DirectedEnergyAreaAimpoint() { + _beamAntennaParameterList.clear(); + _directedEnergyTargetEnergyDepositionRecordList.clear(); +} + +uint32_t DirectedEnergyAreaAimpoint::getRecordType() const { + return _recordType; +} + +void DirectedEnergyAreaAimpoint::setRecordType(uint32_t pX) { + _recordType = pX; +} + +uint16_t DirectedEnergyAreaAimpoint::getRecordLength() const { + return _recordLength; +} + +void DirectedEnergyAreaAimpoint::setRecordLength(uint16_t pX) { + _recordLength = pX; +} + +uint16_t DirectedEnergyAreaAimpoint::getPadding() const { + return _padding; +} + +void DirectedEnergyAreaAimpoint::setPadding(uint16_t pX) { + _padding = pX; +} + +uint16_t DirectedEnergyAreaAimpoint::getBeamAntennaPatternRecordCount() + const { + return _beamAntennaParameterList.size(); +} + +uint16_t +DirectedEnergyAreaAimpoint::getDirectedEnergyTargetEnergyDepositionRecordCount() + const { + return _directedEnergyTargetEnergyDepositionRecordList.size(); +} + +std::vector& +DirectedEnergyAreaAimpoint::getBeamAntennaParameterList() { + return _beamAntennaParameterList; +} + +const std::vector& +DirectedEnergyAreaAimpoint::getBeamAntennaParameterList() const { + return _beamAntennaParameterList; +} + +void DirectedEnergyAreaAimpoint::setBeamAntennaParameterList( + const std::vector& pX) { + _beamAntennaParameterList = pX; +} + +std::vector& DirectedEnergyAreaAimpoint:: + getDirectedEnergyTargetEnergyDepositionRecordList() { + return _directedEnergyTargetEnergyDepositionRecordList; +} + +const std::vector& +DirectedEnergyAreaAimpoint::getDirectedEnergyTargetEnergyDepositionRecordList() + const { + return _directedEnergyTargetEnergyDepositionRecordList; +} + +void DirectedEnergyAreaAimpoint:: + setDirectedEnergyTargetEnergyDepositionRecordList( + const std::vector& pX) { + _directedEnergyTargetEnergyDepositionRecordList = pX; +} + +void DirectedEnergyAreaAimpoint::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _padding; + dataStream << (uint16_t)_beamAntennaParameterList.size(); + dataStream << (uint16_t) + _directedEnergyTargetEnergyDepositionRecordList.size(); + + for (size_t idx = 0; idx < _beamAntennaParameterList.size(); idx++) { + BeamAntennaPattern x = _beamAntennaParameterList[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; + idx < _directedEnergyTargetEnergyDepositionRecordList.size(); idx++) { + DirectedEnergyTargetEnergyDeposition x = + _directedEnergyTargetEnergyDepositionRecordList[idx]; + x.marshal(dataStream); + } +} + +void DirectedEnergyAreaAimpoint::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _padding; + dataStream >> _beamAntennaPatternRecordCount; + dataStream >> _directedEnergyTargetEnergyDepositionRecordCount; + + _beamAntennaParameterList.clear(); + for (size_t idx = 0; idx < _beamAntennaPatternRecordCount; idx++) { + BeamAntennaPattern x; + x.unmarshal(dataStream); + _beamAntennaParameterList.push_back(x); + } + + _directedEnergyTargetEnergyDepositionRecordList.clear(); + for (size_t idx = 0; idx < _directedEnergyTargetEnergyDepositionRecordCount; + idx++) { + DirectedEnergyTargetEnergyDeposition x; + x.unmarshal(dataStream); + _directedEnergyTargetEnergyDepositionRecordList.push_back(x); + } +} + +bool DirectedEnergyAreaAimpoint::operator==( + const DirectedEnergyAreaAimpoint& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + for (size_t idx = 0; idx < _beamAntennaParameterList.size(); idx++) { + if (!(_beamAntennaParameterList[idx] == rhs._beamAntennaParameterList[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; + idx < _directedEnergyTargetEnergyDepositionRecordList.size(); idx++) { + if (!(_directedEnergyTargetEnergyDepositionRecordList[idx] == + rhs._directedEnergyTargetEnergyDepositionRecordList[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int DirectedEnergyAreaAimpoint::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 2; // _padding + marshalSize = marshalSize + 2; // _beamAntennaPatternRecordCount + marshalSize = + marshalSize + 2; // _directedEnergyTargetEnergyDepositionRecordCount + + for (uint64_t idx = 0; idx < _beamAntennaParameterList.size(); + idx++) { + BeamAntennaPattern listElement = _beamAntennaParameterList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; + idx < _directedEnergyTargetEnergyDepositionRecordList.size(); idx++) { + DirectedEnergyTargetEnergyDeposition listElement = + _directedEnergyTargetEnergyDepositionRecordList[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DirectedEnergyAreaAimpoint.h b/src/dis7/common/DirectedEnergyAreaAimpoint.h new file mode 100644 index 00000000..d4603d00 --- /dev/null +++ b/src/dis7/common/DirectedEnergyAreaAimpoint.h @@ -0,0 +1,108 @@ +#pragma once + +#include + +#include "dis7/BeamAntennaPattern.h" +#include "dis7/DirectedEnergyTargetEnergyDeposition.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// DE Precision Aimpoint Record. NOT COMPLETE. Section 6.2.21.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DirectedEnergyAreaAimpoint { + protected: + /** Type of Record */ + uint32_t _recordType; + + /** Length of Record */ + uint16_t _recordLength; + + /** Padding */ + uint16_t _padding; + + /** Number of beam antenna pattern records */ + uint16_t _beamAntennaPatternRecordCount; + + /** Number of DE target energy depositon records */ + uint16_t _directedEnergyTargetEnergyDepositionRecordCount; + + /** list of beam antenna records. See 6.2.9.2 */ + std::vector _beamAntennaParameterList; + + /** list of DE target deposition records. See 6.2.21.4 */ + std::vector + _directedEnergyTargetEnergyDepositionRecordList; + + public: + DirectedEnergyAreaAimpoint(); + virtual ~DirectedEnergyAreaAimpoint(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + uint16_t getBeamAntennaPatternRecordCount() const; + + uint16_t getDirectedEnergyTargetEnergyDepositionRecordCount() const; + + std::vector& getBeamAntennaParameterList(); + const std::vector& getBeamAntennaParameterList() const; + void setBeamAntennaParameterList(const std::vector& pX); + + std::vector& + getDirectedEnergyTargetEnergyDepositionRecordList(); + const std::vector& + getDirectedEnergyTargetEnergyDepositionRecordList() const; + void setDirectedEnergyTargetEnergyDepositionRecordList( + const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DirectedEnergyAreaAimpoint& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DirectedEnergyPrecisionAimpoint.cpp b/src/dis7/common/DirectedEnergyPrecisionAimpoint.cpp new file mode 100644 index 00000000..d2f9636c --- /dev/null +++ b/src/dis7/common/DirectedEnergyPrecisionAimpoint.cpp @@ -0,0 +1,273 @@ +#include "dis7/DirectedEnergyPrecisionAimpoint.h" + +using namespace DIS; + +DirectedEnergyPrecisionAimpoint::DirectedEnergyPrecisionAimpoint() + : _recordType(4000), + _recordLength(88), + _padding(0), + _targetSpotLocation(), + _targetSpotEntityLocation(), + _targetSpotVelocity(), + _targetSpotAcceleration(), + _targetEntityID(), + _targetComponentID(0), + _SpotShape(0), + _BeamSpotXSecSemiMajorAxis(0), + _BeamSpotCrossSectionSemiMinorAxis(0), + _BeamSpotCrossSectionOrientAngle(0) {} + +DirectedEnergyPrecisionAimpoint::~DirectedEnergyPrecisionAimpoint() {} + +uint32_t DirectedEnergyPrecisionAimpoint::getRecordType() const { + return _recordType; +} + +void DirectedEnergyPrecisionAimpoint::setRecordType(uint32_t pX) { + _recordType = pX; +} + +uint16_t DirectedEnergyPrecisionAimpoint::getRecordLength() const { + return _recordLength; +} + +void DirectedEnergyPrecisionAimpoint::setRecordLength(uint16_t pX) { + _recordLength = pX; +} + +uint16_t DirectedEnergyPrecisionAimpoint::getPadding() const { + return _padding; +} + +void DirectedEnergyPrecisionAimpoint::setPadding(uint16_t pX) { + _padding = pX; +} + +Vector3Double& DirectedEnergyPrecisionAimpoint::getTargetSpotLocation() { + return _targetSpotLocation; +} + +const Vector3Double& DirectedEnergyPrecisionAimpoint::getTargetSpotLocation() + const { + return _targetSpotLocation; +} + +void DirectedEnergyPrecisionAimpoint::setTargetSpotLocation( + const Vector3Double& pX) { + _targetSpotLocation = pX; +} + +Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotEntityLocation() { + return _targetSpotEntityLocation; +} + +const Vector3Float& +DirectedEnergyPrecisionAimpoint::getTargetSpotEntityLocation() const { + return _targetSpotEntityLocation; +} + +void DirectedEnergyPrecisionAimpoint::setTargetSpotEntityLocation( + const Vector3Float& pX) { + _targetSpotEntityLocation = pX; +} + +Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotVelocity() { + return _targetSpotVelocity; +} + +const Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotVelocity() + const { + return _targetSpotVelocity; +} + +void DirectedEnergyPrecisionAimpoint::setTargetSpotVelocity( + const Vector3Float& pX) { + _targetSpotVelocity = pX; +} + +Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotAcceleration() { + return _targetSpotAcceleration; +} + +const Vector3Float& DirectedEnergyPrecisionAimpoint::getTargetSpotAcceleration() + const { + return _targetSpotAcceleration; +} + +void DirectedEnergyPrecisionAimpoint::setTargetSpotAcceleration( + const Vector3Float& pX) { + _targetSpotAcceleration = pX; +} + +EntityID& DirectedEnergyPrecisionAimpoint::getTargetEntityID() { + return _targetEntityID; +} + +const EntityID& DirectedEnergyPrecisionAimpoint::getTargetEntityID() const { + return _targetEntityID; +} + +void DirectedEnergyPrecisionAimpoint::setTargetEntityID(const EntityID& pX) { + _targetEntityID = pX; +} + +uint8_t DirectedEnergyPrecisionAimpoint::getTargetComponentID() const { + return _targetComponentID; +} + +void DirectedEnergyPrecisionAimpoint::setTargetComponentID(uint8_t pX) { + _targetComponentID = pX; +} + +uint8_t DirectedEnergyPrecisionAimpoint::getSpotShape() const { + return _SpotShape; +} + +void DirectedEnergyPrecisionAimpoint::setSpotShape(uint8_t pX) { + _SpotShape = pX; +} + +float DirectedEnergyPrecisionAimpoint::getBeamSpotXSecSemiMajorAxis() const { + return _BeamSpotXSecSemiMajorAxis; +} + +void DirectedEnergyPrecisionAimpoint::setBeamSpotXSecSemiMajorAxis(float pX) { + _BeamSpotXSecSemiMajorAxis = pX; +} + +float DirectedEnergyPrecisionAimpoint::getBeamSpotCrossSectionSemiMinorAxis() + const { + return _BeamSpotCrossSectionSemiMinorAxis; +} + +void DirectedEnergyPrecisionAimpoint::setBeamSpotCrossSectionSemiMinorAxis( + float pX) { + _BeamSpotCrossSectionSemiMinorAxis = pX; +} + +float DirectedEnergyPrecisionAimpoint::getBeamSpotCrossSectionOrientAngle() + const { + return _BeamSpotCrossSectionOrientAngle; +} + +void DirectedEnergyPrecisionAimpoint::setBeamSpotCrossSectionOrientAngle( + float pX) { + _BeamSpotCrossSectionOrientAngle = pX; +} + +void DirectedEnergyPrecisionAimpoint::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _padding; + _targetSpotLocation.marshal(dataStream); + _targetSpotEntityLocation.marshal(dataStream); + _targetSpotVelocity.marshal(dataStream); + _targetSpotAcceleration.marshal(dataStream); + _targetEntityID.marshal(dataStream); + dataStream << _targetComponentID; + dataStream << _SpotShape; + dataStream << _BeamSpotXSecSemiMajorAxis; + dataStream << _BeamSpotCrossSectionSemiMinorAxis; + dataStream << _BeamSpotCrossSectionOrientAngle; +} + +void DirectedEnergyPrecisionAimpoint::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _padding; + _targetSpotLocation.unmarshal(dataStream); + _targetSpotEntityLocation.unmarshal(dataStream); + _targetSpotVelocity.unmarshal(dataStream); + _targetSpotAcceleration.unmarshal(dataStream); + _targetEntityID.unmarshal(dataStream); + dataStream >> _targetComponentID; + dataStream >> _SpotShape; + dataStream >> _BeamSpotXSecSemiMajorAxis; + dataStream >> _BeamSpotCrossSectionSemiMinorAxis; + dataStream >> _BeamSpotCrossSectionOrientAngle; +} + +bool DirectedEnergyPrecisionAimpoint::operator==( + const DirectedEnergyPrecisionAimpoint& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_targetSpotLocation == rhs._targetSpotLocation)) ivarsEqual = false; + if (!(_targetSpotEntityLocation == rhs._targetSpotEntityLocation)) + ivarsEqual = false; + if (!(_targetSpotVelocity == rhs._targetSpotVelocity)) ivarsEqual = false; + if (!(_targetSpotAcceleration == rhs._targetSpotAcceleration)) + ivarsEqual = false; + if (!(_targetEntityID == rhs._targetEntityID)) ivarsEqual = false; + if (!(_targetComponentID == rhs._targetComponentID)) ivarsEqual = false; + if (!(_SpotShape == rhs._SpotShape)) ivarsEqual = false; + if (!(_BeamSpotXSecSemiMajorAxis == rhs._BeamSpotXSecSemiMajorAxis)) + ivarsEqual = false; + if (!(_BeamSpotCrossSectionSemiMinorAxis == + rhs._BeamSpotCrossSectionSemiMinorAxis)) + ivarsEqual = false; + if (!(_BeamSpotCrossSectionOrientAngle == + rhs._BeamSpotCrossSectionOrientAngle)) + ivarsEqual = false; + + return ivarsEqual; +} + +int DirectedEnergyPrecisionAimpoint::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 2; // _padding + marshalSize = marshalSize + + _targetSpotLocation.getMarshalledSize(); // _targetSpotLocation + marshalSize = + marshalSize + _targetSpotEntityLocation + .getMarshalledSize(); // _targetSpotEntityLocation + marshalSize = marshalSize + + _targetSpotVelocity.getMarshalledSize(); // _targetSpotVelocity + marshalSize = + marshalSize + + _targetSpotAcceleration.getMarshalledSize(); // _targetSpotAcceleration + marshalSize = + marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID + marshalSize = marshalSize + 1; // _targetComponentID + marshalSize = marshalSize + 1; // _SpotShape + marshalSize = marshalSize + 4; // _BeamSpotXSecSemiMajorAxis + marshalSize = marshalSize + 4; // _BeamSpotCrossSectionSemiMinorAxis + marshalSize = marshalSize + 4; // _BeamSpotCrossSectionOrientAngle + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DirectedEnergyPrecisionAimpoint.h b/src/dis7/common/DirectedEnergyPrecisionAimpoint.h new file mode 100644 index 00000000..e4b2105c --- /dev/null +++ b/src/dis7/common/DirectedEnergyPrecisionAimpoint.h @@ -0,0 +1,144 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/Vector3Double.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// DE Precision Aimpoint Record. Section 6.2.21.3 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DirectedEnergyPrecisionAimpoint { + protected: + /** Type of Record */ + uint32_t _recordType; + + /** Length of Record */ + uint16_t _recordLength; + + /** Padding */ + uint16_t _padding; + + /** Position of Target Spot in World Coordinates. */ + Vector3Double _targetSpotLocation; + + /** Position (meters) of Target Spot relative to Entity Position. */ + Vector3Float _targetSpotEntityLocation; + + /** Velocity (meters/sec) of Target Spot. */ + Vector3Float _targetSpotVelocity; + + /** Acceleration (meters/sec/sec) of Target Spot. */ + Vector3Float _targetSpotAcceleration; + + /** Unique ID of the target entity. */ + EntityID _targetEntityID; + + /** Target Component ID ENUM, same as in DamageDescriptionRecord. */ + uint8_t _targetComponentID; + + /** Spot Shape ENUM. */ + uint8_t _SpotShape; + + /** Beam Spot Cross Section Semi-Major Axis. */ + float _BeamSpotXSecSemiMajorAxis; + + /** Beam Spot Cross Section Semi-Major Axis. */ + float _BeamSpotCrossSectionSemiMinorAxis; + + /** Beam Spot Cross Section Orientation Angle. */ + float _BeamSpotCrossSectionOrientAngle; + + public: + DirectedEnergyPrecisionAimpoint(); + virtual ~DirectedEnergyPrecisionAimpoint(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + Vector3Double& getTargetSpotLocation(); + const Vector3Double& getTargetSpotLocation() const; + void setTargetSpotLocation(const Vector3Double& pX); + + Vector3Float& getTargetSpotEntityLocation(); + const Vector3Float& getTargetSpotEntityLocation() const; + void setTargetSpotEntityLocation(const Vector3Float& pX); + + Vector3Float& getTargetSpotVelocity(); + const Vector3Float& getTargetSpotVelocity() const; + void setTargetSpotVelocity(const Vector3Float& pX); + + Vector3Float& getTargetSpotAcceleration(); + const Vector3Float& getTargetSpotAcceleration() const; + void setTargetSpotAcceleration(const Vector3Float& pX); + + EntityID& getTargetEntityID(); + const EntityID& getTargetEntityID() const; + void setTargetEntityID(const EntityID& pX); + + uint8_t getTargetComponentID() const; + void setTargetComponentID(uint8_t pX); + + uint8_t getSpotShape() const; + void setSpotShape(uint8_t pX); + + float getBeamSpotXSecSemiMajorAxis() const; + void setBeamSpotXSecSemiMajorAxis(float pX); + + float getBeamSpotCrossSectionSemiMinorAxis() const; + void setBeamSpotCrossSectionSemiMinorAxis(float pX); + + float getBeamSpotCrossSectionOrientAngle() const; + void setBeamSpotCrossSectionOrientAngle(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DirectedEnergyPrecisionAimpoint& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DirectedEnergyTargetEnergyDeposition.cpp b/src/dis7/common/DirectedEnergyTargetEnergyDeposition.cpp new file mode 100644 index 00000000..4cc6485b --- /dev/null +++ b/src/dis7/common/DirectedEnergyTargetEnergyDeposition.cpp @@ -0,0 +1,103 @@ +#include "dis7/DirectedEnergyTargetEnergyDeposition.h" + +using namespace DIS; + +DirectedEnergyTargetEnergyDeposition::DirectedEnergyTargetEnergyDeposition() + : _targetEntityID(), _padding(0), _peakIrradiance(0.0) {} + +DirectedEnergyTargetEnergyDeposition::~DirectedEnergyTargetEnergyDeposition() {} + +EntityID& DirectedEnergyTargetEnergyDeposition::getTargetEntityID() { + return _targetEntityID; +} + +const EntityID& DirectedEnergyTargetEnergyDeposition::getTargetEntityID() + const { + return _targetEntityID; +} + +void DirectedEnergyTargetEnergyDeposition::setTargetEntityID( + const EntityID& pX) { + _targetEntityID = pX; +} + +uint16_t DirectedEnergyTargetEnergyDeposition::getPadding() const { + return _padding; +} + +void DirectedEnergyTargetEnergyDeposition::setPadding(uint16_t pX) { + _padding = pX; +} + +float DirectedEnergyTargetEnergyDeposition::getPeakIrradiance() const { + return _peakIrradiance; +} + +void DirectedEnergyTargetEnergyDeposition::setPeakIrradiance(float pX) { + _peakIrradiance = pX; +} + +void DirectedEnergyTargetEnergyDeposition::marshal( + DataStream& dataStream) const { + _targetEntityID.marshal(dataStream); + dataStream << _padding; + dataStream << _peakIrradiance; +} + +void DirectedEnergyTargetEnergyDeposition::unmarshal(DataStream& dataStream) { + _targetEntityID.unmarshal(dataStream); + dataStream >> _padding; + dataStream >> _peakIrradiance; +} + +bool DirectedEnergyTargetEnergyDeposition::operator==( + const DirectedEnergyTargetEnergyDeposition& rhs) const { + bool ivarsEqual = true; + + if (!(_targetEntityID == rhs._targetEntityID)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_peakIrradiance == rhs._peakIrradiance)) ivarsEqual = false; + + return ivarsEqual; +} + +int DirectedEnergyTargetEnergyDeposition::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID + marshalSize = marshalSize + 2; // _padding + marshalSize = marshalSize + 4; // _peakIrradiance + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/DirectedEnergyTargetEnergyDeposition.h b/src/dis7/common/DirectedEnergyTargetEnergyDeposition.h new file mode 100644 index 00000000..7452bd78 --- /dev/null +++ b/src/dis7/common/DirectedEnergyTargetEnergyDeposition.h @@ -0,0 +1,78 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// DE energy depostion properties for a target entity. Section 6.2.21.4 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DirectedEnergyTargetEnergyDeposition { + protected: + /** Unique ID of the target entity. */ + EntityID _targetEntityID; + + /** padding */ + uint16_t _padding; + + /** Peak irrandiance */ + float _peakIrradiance; + + public: + DirectedEnergyTargetEnergyDeposition(); + virtual ~DirectedEnergyTargetEnergyDeposition(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getTargetEntityID(); + const EntityID& getTargetEntityID() const; + void setTargetEntityID(const EntityID& pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + float getPeakIrradiance() const; + void setPeakIrradiance(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DirectedEnergyTargetEnergyDeposition& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EightByteChunk.cpp b/src/dis7/common/EightByteChunk.cpp new file mode 100644 index 00000000..0e5d3e23 --- /dev/null +++ b/src/dis7/common/EightByteChunk.cpp @@ -0,0 +1,86 @@ +#include "dis7/EightByteChunk.h" + +using namespace DIS; + +EightByteChunk::EightByteChunk() { + // Initialize fixed length array + for (int lengthotherParameters = 0; lengthotherParameters < 8; + lengthotherParameters++) { + _otherParameters[lengthotherParameters] = 0; + } +} + +EightByteChunk::~EightByteChunk() {} + +char* EightByteChunk::getOtherParameters() { return _otherParameters; } + +const char* EightByteChunk::getOtherParameters() const { + return _otherParameters; +} + +void EightByteChunk::setOtherParameters(const char* x) { + for (int i = 0; i < 8; i++) { + _otherParameters[i] = x[i]; + } +} + +void EightByteChunk::marshal(DataStream& dataStream) const { + for (size_t idx = 0; idx < 8; idx++) { + dataStream << _otherParameters[idx]; + } +} + +void EightByteChunk::unmarshal(DataStream& dataStream) { + for (size_t idx = 0; idx < 8; idx++) { + dataStream >> _otherParameters[idx]; + } +} + +bool EightByteChunk::operator==(const EightByteChunk& rhs) const { + bool ivarsEqual = true; + + for (uint8_t idx = 0; idx < 8; idx++) { + if (!(_otherParameters[idx] == rhs._otherParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int EightByteChunk::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 8 * 1; // _otherParameters + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EightByteChunk.h b/src/dis7/common/EightByteChunk.h new file mode 100644 index 00000000..7995d211 --- /dev/null +++ b/src/dis7/common/EightByteChunk.h @@ -0,0 +1,65 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// 64 bit piece of data + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EightByteChunk { + protected: + /** Eight bytes of arbitrary data */ + char _otherParameters[8]; + + public: + EightByteChunk(); + virtual ~EightByteChunk(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + char* getOtherParameters(); + const char* getOtherParameters() const; + void setOtherParameters(const char* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EightByteChunk& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EngineFuel.cpp b/src/dis7/common/EngineFuel.cpp new file mode 100644 index 00000000..b87e8407 --- /dev/null +++ b/src/dis7/common/EngineFuel.cpp @@ -0,0 +1,106 @@ +#include "dis7/EngineFuel.h" + +using namespace DIS; + +EngineFuel::EngineFuel() + : _fuelQuantity(0), + _fuelMeasurementUnits(0), + _fuelType(0), + _fuelLocation(0), + _padding(0) {} + +EngineFuel::~EngineFuel() {} + +uint32_t EngineFuel::getFuelQuantity() const { return _fuelQuantity; } + +void EngineFuel::setFuelQuantity(uint32_t pX) { _fuelQuantity = pX; } + +uint8_t EngineFuel::getFuelMeasurementUnits() const { + return _fuelMeasurementUnits; +} + +void EngineFuel::setFuelMeasurementUnits(uint8_t pX) { + _fuelMeasurementUnits = pX; +} + +uint8_t EngineFuel::getFuelType() const { return _fuelType; } + +void EngineFuel::setFuelType(uint8_t pX) { _fuelType = pX; } + +uint8_t EngineFuel::getFuelLocation() const { return _fuelLocation; } + +void EngineFuel::setFuelLocation(uint8_t pX) { _fuelLocation = pX; } + +uint8_t EngineFuel::getPadding() const { return _padding; } + +void EngineFuel::setPadding(uint8_t pX) { _padding = pX; } + +void EngineFuel::marshal(DataStream& dataStream) const { + dataStream << _fuelQuantity; + dataStream << _fuelMeasurementUnits; + dataStream << _fuelType; + dataStream << _fuelLocation; + dataStream << _padding; +} + +void EngineFuel::unmarshal(DataStream& dataStream) { + dataStream >> _fuelQuantity; + dataStream >> _fuelMeasurementUnits; + dataStream >> _fuelType; + dataStream >> _fuelLocation; + dataStream >> _padding; +} + +bool EngineFuel::operator==(const EngineFuel& rhs) const { + bool ivarsEqual = true; + + if (!(_fuelQuantity == rhs._fuelQuantity)) ivarsEqual = false; + if (!(_fuelMeasurementUnits == rhs._fuelMeasurementUnits)) ivarsEqual = false; + if (!(_fuelType == rhs._fuelType)) ivarsEqual = false; + if (!(_fuelLocation == rhs._fuelLocation)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int EngineFuel::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _fuelQuantity + marshalSize = marshalSize + 1; // _fuelMeasurementUnits + marshalSize = marshalSize + 1; // _fuelType + marshalSize = marshalSize + 1; // _fuelLocation + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EngineFuel.h b/src/dis7/common/EngineFuel.h new file mode 100644 index 00000000..11096534 --- /dev/null +++ b/src/dis7/common/EngineFuel.h @@ -0,0 +1,88 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about an entity's engine fuel. Section 6.2.24. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EngineFuel { + protected: + /** Fuel quantity, units specified by next field */ + uint32_t _fuelQuantity; + + /** Units in which the fuel is measured */ + uint8_t _fuelMeasurementUnits; + + /** Type of fuel */ + uint8_t _fuelType; + + /** Location of fuel as related to entity. See section 14 of EBV document */ + uint8_t _fuelLocation; + + /** padding */ + uint8_t _padding; + + public: + EngineFuel(); + virtual ~EngineFuel(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getFuelQuantity() const; + void setFuelQuantity(uint32_t pX); + + uint8_t getFuelMeasurementUnits() const; + void setFuelMeasurementUnits(uint8_t pX); + + uint8_t getFuelType() const; + void setFuelType(uint8_t pX); + + uint8_t getFuelLocation() const; + void setFuelLocation(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EngineFuel& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EngineFuelReload.cpp b/src/dis7/common/EngineFuelReload.cpp new file mode 100644 index 00000000..32d01f41 --- /dev/null +++ b/src/dis7/common/EngineFuelReload.cpp @@ -0,0 +1,144 @@ +#include "dis7/EngineFuelReload.h" + +using namespace DIS; + +EngineFuelReload::EngineFuelReload() + : _standardQuantity(0), + _maximumQuantity(0), + _standardQuantityReloadTime(0), + _maximumQuantityReloadTime(0), + _fuelMeasurmentUnits(0), + _fuelLocation(0), + _padding(0) {} + +EngineFuelReload::~EngineFuelReload() {} + +uint32_t EngineFuelReload::getStandardQuantity() const { + return _standardQuantity; +} + +void EngineFuelReload::setStandardQuantity(uint32_t pX) { + _standardQuantity = pX; +} + +uint32_t EngineFuelReload::getMaximumQuantity() const { + return _maximumQuantity; +} + +void EngineFuelReload::setMaximumQuantity(uint32_t pX) { + _maximumQuantity = pX; +} + +uint32_t EngineFuelReload::getStandardQuantityReloadTime() const { + return _standardQuantityReloadTime; +} + +void EngineFuelReload::setStandardQuantityReloadTime(uint32_t pX) { + _standardQuantityReloadTime = pX; +} + +uint32_t EngineFuelReload::getMaximumQuantityReloadTime() const { + return _maximumQuantityReloadTime; +} + +void EngineFuelReload::setMaximumQuantityReloadTime(uint32_t pX) { + _maximumQuantityReloadTime = pX; +} + +uint8_t EngineFuelReload::getFuelMeasurmentUnits() const { + return _fuelMeasurmentUnits; +} + +void EngineFuelReload::setFuelMeasurmentUnits(uint8_t pX) { + _fuelMeasurmentUnits = pX; +} + +uint8_t EngineFuelReload::getFuelLocation() const { + return _fuelLocation; +} + +void EngineFuelReload::setFuelLocation(uint8_t pX) { _fuelLocation = pX; } + +uint8_t EngineFuelReload::getPadding() const { return _padding; } + +void EngineFuelReload::setPadding(uint8_t pX) { _padding = pX; } + +void EngineFuelReload::marshal(DataStream& dataStream) const { + dataStream << _standardQuantity; + dataStream << _maximumQuantity; + dataStream << _standardQuantityReloadTime; + dataStream << _maximumQuantityReloadTime; + dataStream << _fuelMeasurmentUnits; + dataStream << _fuelLocation; + dataStream << _padding; +} + +void EngineFuelReload::unmarshal(DataStream& dataStream) { + dataStream >> _standardQuantity; + dataStream >> _maximumQuantity; + dataStream >> _standardQuantityReloadTime; + dataStream >> _maximumQuantityReloadTime; + dataStream >> _fuelMeasurmentUnits; + dataStream >> _fuelLocation; + dataStream >> _padding; +} + +bool EngineFuelReload::operator==(const EngineFuelReload& rhs) const { + bool ivarsEqual = true; + + if (!(_standardQuantity == rhs._standardQuantity)) ivarsEqual = false; + if (!(_maximumQuantity == rhs._maximumQuantity)) ivarsEqual = false; + if (!(_standardQuantityReloadTime == rhs._standardQuantityReloadTime)) + ivarsEqual = false; + if (!(_maximumQuantityReloadTime == rhs._maximumQuantityReloadTime)) + ivarsEqual = false; + if (!(_fuelMeasurmentUnits == rhs._fuelMeasurmentUnits)) ivarsEqual = false; + if (!(_fuelLocation == rhs._fuelLocation)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int EngineFuelReload::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _standardQuantity + marshalSize = marshalSize + 4; // _maximumQuantity + marshalSize = marshalSize + 4; // _standardQuantityReloadTime + marshalSize = marshalSize + 4; // _maximumQuantityReloadTime + marshalSize = marshalSize + 1; // _fuelMeasurmentUnits + marshalSize = marshalSize + 1; // _fuelLocation + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EngineFuelReload.h b/src/dis7/common/EngineFuelReload.h new file mode 100644 index 00000000..ddbb71c6 --- /dev/null +++ b/src/dis7/common/EngineFuelReload.h @@ -0,0 +1,102 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// For each type or location of engine fuell, this record specifies the type, +// location, fuel measurement units, and reload quantity and maximum quantity. +// Section 6.2.25. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EngineFuelReload { + protected: + /** standard quantity of fuel loaded */ + uint32_t _standardQuantity; + + /** maximum quantity of fuel loaded */ + uint32_t _maximumQuantity; + + /** seconds normally required to to reload standard qty */ + uint32_t _standardQuantityReloadTime; + + /** seconds normally required to to reload maximum qty */ + uint32_t _maximumQuantityReloadTime; + + /** Units of measure */ + uint8_t _fuelMeasurmentUnits; + + /** fuel location as related to the entity */ + uint8_t _fuelLocation; + + /** padding */ + uint8_t _padding; + + public: + EngineFuelReload(); + virtual ~EngineFuelReload(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getStandardQuantity() const; + void setStandardQuantity(uint32_t pX); + + uint32_t getMaximumQuantity() const; + void setMaximumQuantity(uint32_t pX); + + uint32_t getStandardQuantityReloadTime() const; + void setStandardQuantityReloadTime(uint32_t pX); + + uint32_t getMaximumQuantityReloadTime() const; + void setMaximumQuantityReloadTime(uint32_t pX); + + uint8_t getFuelMeasurmentUnits() const; + void setFuelMeasurmentUnits(uint8_t pX); + + uint8_t getFuelLocation() const; + void setFuelLocation(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EngineFuelReload& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EntityAssociation.cpp b/src/dis7/common/EntityAssociation.cpp new file mode 100644 index 00000000..a534f5fe --- /dev/null +++ b/src/dis7/common/EntityAssociation.cpp @@ -0,0 +1,167 @@ +#include "dis7/EntityAssociation.h" + +using namespace DIS; + +EntityAssociation::EntityAssociation() + : _recordType(2), + _changeIndicator(0), + _associationStatus(0), + _associationType(0), + _entityID(), + _owsSttionLocation(0), + _physicalConnectionType(0), + _groupMemberType(0), + _groupNumber(0) {} + +EntityAssociation::~EntityAssociation() {} + +uint8_t EntityAssociation::getRecordType() const { return _recordType; } + +void EntityAssociation::setRecordType(uint8_t pX) { _recordType = pX; } + +uint8_t EntityAssociation::getChangeIndicator() const { + return _changeIndicator; +} + +void EntityAssociation::setChangeIndicator(uint8_t pX) { + _changeIndicator = pX; +} + +uint8_t EntityAssociation::getAssociationStatus() const { + return _associationStatus; +} + +void EntityAssociation::setAssociationStatus(uint8_t pX) { + _associationStatus = pX; +} + +uint8_t EntityAssociation::getAssociationType() const { + return _associationType; +} + +void EntityAssociation::setAssociationType(uint8_t pX) { + _associationType = pX; +} + +EntityID& EntityAssociation::getEntityID() { return _entityID; } + +const EntityID& EntityAssociation::getEntityID() const { return _entityID; } + +void EntityAssociation::setEntityID(const EntityID& pX) { _entityID = pX; } + +uint16_t EntityAssociation::getOwsSttionLocation() const { + return _owsSttionLocation; +} + +void EntityAssociation::setOwsSttionLocation(uint16_t pX) { + _owsSttionLocation = pX; +} + +uint16_t EntityAssociation::getPhysicalConnectionType() const { + return _physicalConnectionType; +} + +void EntityAssociation::setPhysicalConnectionType(uint16_t pX) { + _physicalConnectionType = pX; +} + +uint8_t EntityAssociation::getGroupMemberType() const { + return _groupMemberType; +} + +void EntityAssociation::setGroupMemberType(uint8_t pX) { + _groupMemberType = pX; +} + +uint16_t EntityAssociation::getGroupNumber() const { + return _groupNumber; +} + +void EntityAssociation::setGroupNumber(uint16_t pX) { _groupNumber = pX; } + +void EntityAssociation::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _changeIndicator; + dataStream << _associationStatus; + dataStream << _associationType; + _entityID.marshal(dataStream); + dataStream << _owsSttionLocation; + dataStream << _physicalConnectionType; + dataStream << _groupMemberType; + dataStream << _groupNumber; +} + +void EntityAssociation::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _changeIndicator; + dataStream >> _associationStatus; + dataStream >> _associationType; + _entityID.unmarshal(dataStream); + dataStream >> _owsSttionLocation; + dataStream >> _physicalConnectionType; + dataStream >> _groupMemberType; + dataStream >> _groupNumber; +} + +bool EntityAssociation::operator==(const EntityAssociation& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_changeIndicator == rhs._changeIndicator)) ivarsEqual = false; + if (!(_associationStatus == rhs._associationStatus)) ivarsEqual = false; + if (!(_associationType == rhs._associationType)) ivarsEqual = false; + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_owsSttionLocation == rhs._owsSttionLocation)) ivarsEqual = false; + if (!(_physicalConnectionType == rhs._physicalConnectionType)) + ivarsEqual = false; + if (!(_groupMemberType == rhs._groupMemberType)) ivarsEqual = false; + if (!(_groupNumber == rhs._groupNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int EntityAssociation::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _recordType + marshalSize = marshalSize + 1; // _changeIndicator + marshalSize = marshalSize + 1; // _associationStatus + marshalSize = marshalSize + 1; // _associationType + marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID + marshalSize = marshalSize + 2; // _owsSttionLocation + marshalSize = marshalSize + 2; // _physicalConnectionType + marshalSize = marshalSize + 1; // _groupMemberType + marshalSize = marshalSize + 2; // _groupNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EntityAssociation.h b/src/dis7/common/EntityAssociation.h new file mode 100644 index 00000000..88d71258 --- /dev/null +++ b/src/dis7/common/EntityAssociation.h @@ -0,0 +1,115 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Association or disassociation of two entities. Section 6.2.93.4 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityAssociation { + protected: + /** the identification of the Variable Parameter record. Enumeration from EBV + */ + uint8_t _recordType; + + /** Indicates if this VP has changed since last issuance */ + uint8_t _changeIndicator; + + /** Indicates association status between two entities; 8 bit enum */ + uint8_t _associationStatus; + + /** Type of association; 8 bit enum */ + uint8_t _associationType; + + /** Object ID of entity associated with this entity */ + EntityID _entityID; + + /** Station location on one's own entity. EBV doc. */ + uint16_t _owsSttionLocation; + + /** Type of physical connection. EBV doc */ + uint16_t _physicalConnectionType; + + /** Type of member the entity is within th egroup */ + uint8_t _groupMemberType; + + /** Group if any to which the entity belongs */ + uint16_t _groupNumber; + + public: + EntityAssociation(); + virtual ~EntityAssociation(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRecordType() const; + void setRecordType(uint8_t pX); + + uint8_t getChangeIndicator() const; + void setChangeIndicator(uint8_t pX); + + uint8_t getAssociationStatus() const; + void setAssociationStatus(uint8_t pX); + + uint8_t getAssociationType() const; + void setAssociationType(uint8_t pX); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + uint16_t getOwsSttionLocation() const; + void setOwsSttionLocation(uint16_t pX); + + uint16_t getPhysicalConnectionType() const; + void setPhysicalConnectionType(uint16_t pX); + + uint8_t getGroupMemberType() const; + void setGroupMemberType(uint8_t pX); + + uint16_t getGroupNumber() const; + void setGroupNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityAssociation& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EntityID.cpp b/src/dis7/common/EntityID.cpp new file mode 100644 index 00000000..ce75803a --- /dev/null +++ b/src/dis7/common/EntityID.cpp @@ -0,0 +1,82 @@ +#include "dis7/EntityID.h" + +using namespace DIS; + +EntityID::EntityID() : _simulationAddress(), _entityNumber(0) {} + +EntityID::~EntityID() {} + +SimulationAddress& EntityID::getSimulationAddress() { + return _simulationAddress; +} + +const SimulationAddress& EntityID::getSimulationAddress() const { + return _simulationAddress; +} + +void EntityID::setSimulationAddress(const SimulationAddress& pX) { + _simulationAddress = pX; +} + +uint16_t EntityID::getEntityNumber() const { return _entityNumber; } + +void EntityID::setEntityNumber(uint16_t pX) { _entityNumber = pX; } + +void EntityID::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _entityNumber; +} + +void EntityID::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _entityNumber; +} + +bool EntityID::operator==(const EntityID& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_entityNumber == rhs._entityNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int EntityID::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _entityNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EntityID.h b/src/dis7/common/EntityID.h new file mode 100644 index 00000000..04155a1d --- /dev/null +++ b/src/dis7/common/EntityID.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Entity Identifier. Unique ID for entities in the world. Consists of an +// simulation address and a entity number. Section 6.2.28. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityID { + protected: + /** Site and application IDs */ + SimulationAddress _simulationAddress; + + /** Entity number */ + uint16_t _entityNumber; + + public: + EntityID(); + virtual ~EntityID(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getSimulationAddress(); + const SimulationAddress& getSimulationAddress() const; + void setSimulationAddress(const SimulationAddress& pX); + + uint16_t getEntityNumber() const; + void setEntityNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityID& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EntityType.cpp b/src/dis7/common/EntityType.cpp new file mode 100644 index 00000000..5ed920b1 --- /dev/null +++ b/src/dis7/common/EntityType.cpp @@ -0,0 +1,120 @@ +#include "dis7/EntityType.h" + +using namespace DIS; + +EntityType::EntityType() + : _entityKind(0), + _domain(0), + _country(0), + _category(0), + _subcategory(0), + _specific(0), + _extra(0) {} + +EntityType::~EntityType() {} + +uint8_t EntityType::getEntityKind() const { return _entityKind; } + +void EntityType::setEntityKind(uint8_t pX) { _entityKind = pX; } + +uint8_t EntityType::getDomain() const { return _domain; } + +void EntityType::setDomain(uint8_t pX) { _domain = pX; } + +uint16_t EntityType::getCountry() const { return _country; } + +void EntityType::setCountry(uint16_t pX) { _country = pX; } + +uint8_t EntityType::getCategory() const { return _category; } + +void EntityType::setCategory(uint8_t pX) { _category = pX; } + +uint8_t EntityType::getSubcategory() const { return _subcategory; } + +void EntityType::setSubcategory(uint8_t pX) { _subcategory = pX; } + +uint8_t EntityType::getSpecific() const { return _specific; } + +void EntityType::setSpecific(uint8_t pX) { _specific = pX; } + +uint8_t EntityType::getExtra() const { return _extra; } + +void EntityType::setExtra(uint8_t pX) { _extra = pX; } + +void EntityType::marshal(DataStream& dataStream) const { + dataStream << _entityKind; + dataStream << _domain; + dataStream << _country; + dataStream << _category; + dataStream << _subcategory; + dataStream << _specific; + dataStream << _extra; +} + +void EntityType::unmarshal(DataStream& dataStream) { + dataStream >> _entityKind; + dataStream >> _domain; + dataStream >> _country; + dataStream >> _category; + dataStream >> _subcategory; + dataStream >> _specific; + dataStream >> _extra; +} + +bool EntityType::operator==(const EntityType& rhs) const { + bool ivarsEqual = true; + + if (!(_entityKind == rhs._entityKind)) ivarsEqual = false; + if (!(_domain == rhs._domain)) ivarsEqual = false; + if (!(_country == rhs._country)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_subcategory == rhs._subcategory)) ivarsEqual = false; + if (!(_specific == rhs._specific)) ivarsEqual = false; + if (!(_extra == rhs._extra)) ivarsEqual = false; + + return ivarsEqual; +} + +int EntityType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _entityKind + marshalSize = marshalSize + 1; // _domain + marshalSize = marshalSize + 2; // _country + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _subcategory + marshalSize = marshalSize + 1; // _specific + marshalSize = marshalSize + 1; // _extra + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EntityType.h b/src/dis7/common/EntityType.h new file mode 100644 index 00000000..9b2e682a --- /dev/null +++ b/src/dis7/common/EntityType.h @@ -0,0 +1,101 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Identifies the type of entity, including kind of entity, domain (surface, +// subsurface, air, etc) country, category, etc. Section 6.2.30 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityType { + protected: + /** Kind of entity */ + uint8_t _entityKind; + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _domain; + + /** country to which the design of the entity is attributed */ + uint16_t _country; + + /** category of entity */ + uint8_t _category; + + /** subcategory of entity */ + uint8_t _subcategory; + + /** specific info based on subcategory field. Renamed from specific because + * that is a reserved word in SQL. */ + uint8_t _specific; + + uint8_t _extra; + + public: + EntityType(); + virtual ~EntityType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getEntityKind() const; + void setEntityKind(uint8_t pX); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint16_t getCountry() const; + void setCountry(uint16_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + uint8_t getSpecific() const; + void setSpecific(uint8_t pX); + + uint8_t getExtra() const; + void setExtra(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EntityTypeVP.cpp b/src/dis7/common/EntityTypeVP.cpp new file mode 100644 index 00000000..5e4d7d47 --- /dev/null +++ b/src/dis7/common/EntityTypeVP.cpp @@ -0,0 +1,108 @@ +#include "dis7/EntityTypeVP.h" + +using namespace DIS; + +EntityTypeVP::EntityTypeVP() + : _recordType(3), + _changeIndicator(0), + _entityType(), + _padding(0), + _padding1(0) {} + +EntityTypeVP::~EntityTypeVP() {} + +uint8_t EntityTypeVP::getRecordType() const { return _recordType; } + +void EntityTypeVP::setRecordType(uint8_t pX) { _recordType = pX; } + +uint8_t EntityTypeVP::getChangeIndicator() const { + return _changeIndicator; +} + +void EntityTypeVP::setChangeIndicator(uint8_t pX) { + _changeIndicator = pX; +} + +EntityType& EntityTypeVP::getEntityType() { return _entityType; } + +const EntityType& EntityTypeVP::getEntityType() const { return _entityType; } + +void EntityTypeVP::setEntityType(const EntityType& pX) { _entityType = pX; } + +uint16_t EntityTypeVP::getPadding() const { return _padding; } + +void EntityTypeVP::setPadding(uint16_t pX) { _padding = pX; } + +uint32_t EntityTypeVP::getPadding1() const { return _padding1; } + +void EntityTypeVP::setPadding1(uint32_t pX) { _padding1 = pX; } + +void EntityTypeVP::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _changeIndicator; + _entityType.marshal(dataStream); + dataStream << _padding; + dataStream << _padding1; +} + +void EntityTypeVP::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _changeIndicator; + _entityType.unmarshal(dataStream); + dataStream >> _padding; + dataStream >> _padding1; +} + +bool EntityTypeVP::operator==(const EntityTypeVP& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_changeIndicator == rhs._changeIndicator)) ivarsEqual = false; + if (!(_entityType == rhs._entityType)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + + return ivarsEqual; +} + +int EntityTypeVP::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _recordType + marshalSize = marshalSize + 1; // _changeIndicator + marshalSize = marshalSize + _entityType.getMarshalledSize(); // _entityType + marshalSize = marshalSize + 2; // _padding + marshalSize = marshalSize + 4; // _padding1 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EntityTypeVP.h b/src/dis7/common/EntityTypeVP.h new file mode 100644 index 00000000..8413d8e3 --- /dev/null +++ b/src/dis7/common/EntityTypeVP.h @@ -0,0 +1,91 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Association or disassociation of two entities. Section 6.2.93.5 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityTypeVP { + protected: + /** the identification of the Variable Parameter record. Enumeration from EBV + */ + uint8_t _recordType; + + /** Indicates if this VP has changed since last issuance */ + uint8_t _changeIndicator; + + /** */ + EntityType _entityType; + + /** padding */ + uint16_t _padding; + + /** padding */ + uint32_t _padding1; + + public: + EntityTypeVP(); + virtual ~EntityTypeVP(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRecordType() const; + void setRecordType(uint8_t pX); + + uint8_t getChangeIndicator() const; + void setChangeIndicator(uint8_t pX); + + EntityType& getEntityType(); + const EntityType& getEntityType() const; + void setEntityType(const EntityType& pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + uint32_t getPadding1() const; + void setPadding1(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityTypeVP& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Environment.cpp b/src/dis7/common/Environment.cpp new file mode 100644 index 00000000..45b80381 --- /dev/null +++ b/src/dis7/common/Environment.cpp @@ -0,0 +1,92 @@ +#include "dis7/Environment.h" + +using namespace DIS; + +Environment::Environment() + : _environmentType(0), _length(0), _index(0), _padding(0) {} + +Environment::~Environment() {} + +uint32_t Environment::getEnvironmentType() const { + return _environmentType; +} + +void Environment::setEnvironmentType(uint32_t pX) { _environmentType = pX; } + +uint16_t Environment::getLength() const { return _length; } + +void Environment::setLength(uint16_t pX) { _length = pX; } + +uint8_t Environment::getIndex() const { return _index; } + +void Environment::setIndex(uint8_t pX) { _index = pX; } + +uint8_t Environment::getPadding() const { return _padding; } + +void Environment::setPadding(uint8_t pX) { _padding = pX; } + +void Environment::marshal(DataStream& dataStream) const { + dataStream << _environmentType; + dataStream << _length; + dataStream << _index; + dataStream << _padding; +} + +void Environment::unmarshal(DataStream& dataStream) { + dataStream >> _environmentType; + dataStream >> _length; + dataStream >> _index; + dataStream >> _padding; +} + +bool Environment::operator==(const Environment& rhs) const { + bool ivarsEqual = true; + + if (!(_environmentType == rhs._environmentType)) ivarsEqual = false; + if (!(_length == rhs._length)) ivarsEqual = false; + if (!(_index == rhs._index)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int Environment::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _environmentType + marshalSize = marshalSize + 2; // _length + marshalSize = marshalSize + 1; // _index + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Environment.h b/src/dis7/common/Environment.h new file mode 100644 index 00000000..5913f693 --- /dev/null +++ b/src/dis7/common/Environment.h @@ -0,0 +1,82 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Incomplete environment record; requires hand coding to fix. Section 6.2.31.1 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Environment { + protected: + /** type */ + uint32_t _environmentType; + + /** length, in bits, of the record */ + uint16_t _length; + + /** identifies the sequntially numbered record index */ + uint8_t _index; + + /** padding */ + uint8_t _padding; + + public: + Environment(); + virtual ~Environment(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getEnvironmentType() const; + void setEnvironmentType(uint32_t pX); + + uint16_t getLength() const; + void setLength(uint16_t pX); + + uint8_t getIndex() const; + void setIndex(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Environment& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EnvironmentGeneral.cpp b/src/dis7/common/EnvironmentGeneral.cpp new file mode 100644 index 00000000..9f5e051f --- /dev/null +++ b/src/dis7/common/EnvironmentGeneral.cpp @@ -0,0 +1,115 @@ +#include "dis7/EnvironmentGeneral.h" + +using namespace DIS; + +EnvironmentGeneral::EnvironmentGeneral() + : _environmentType(0), + _length(0), + _index(0), + _padding1(0), + _geometry(0), + _padding2(0) {} + +EnvironmentGeneral::~EnvironmentGeneral() {} + +uint32_t EnvironmentGeneral::getEnvironmentType() const { + return _environmentType; +} + +void EnvironmentGeneral::setEnvironmentType(uint32_t pX) { + _environmentType = pX; +} + +uint8_t EnvironmentGeneral::getLength() const { return _length; } + +void EnvironmentGeneral::setLength(uint8_t pX) { _length = pX; } + +uint8_t EnvironmentGeneral::getIndex() const { return _index; } + +void EnvironmentGeneral::setIndex(uint8_t pX) { _index = pX; } + +uint8_t EnvironmentGeneral::getPadding1() const { return _padding1; } + +void EnvironmentGeneral::setPadding1(uint8_t pX) { _padding1 = pX; } + +uint8_t EnvironmentGeneral::getGeometry() const { return _geometry; } + +void EnvironmentGeneral::setGeometry(uint8_t pX) { _geometry = pX; } + +uint8_t EnvironmentGeneral::getPadding2() const { return _padding2; } + +void EnvironmentGeneral::setPadding2(uint8_t pX) { _padding2 = pX; } + +void EnvironmentGeneral::marshal(DataStream& dataStream) const { + dataStream << _environmentType; + dataStream << _length; + dataStream << _index; + dataStream << _padding1; + dataStream << _geometry; + dataStream << _padding2; +} + +void EnvironmentGeneral::unmarshal(DataStream& dataStream) { + dataStream >> _environmentType; + dataStream >> _length; + dataStream >> _index; + dataStream >> _padding1; + dataStream >> _geometry; + dataStream >> _padding2; +} + +bool EnvironmentGeneral::operator==(const EnvironmentGeneral& rhs) const { + bool ivarsEqual = true; + + if (!(_environmentType == rhs._environmentType)) ivarsEqual = false; + if (!(_length == rhs._length)) ivarsEqual = false; + if (!(_index == rhs._index)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_geometry == rhs._geometry)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + return ivarsEqual; +} + +int EnvironmentGeneral::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _environmentType + marshalSize = marshalSize + 1; // _length + marshalSize = marshalSize + 1; // _index + marshalSize = marshalSize + 1; // _padding1 + marshalSize = marshalSize + 1; // _geometry + marshalSize = marshalSize + 1; // _padding2 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EnvironmentGeneral.h b/src/dis7/common/EnvironmentGeneral.h new file mode 100644 index 00000000..3aba289b --- /dev/null +++ b/src/dis7/common/EnvironmentGeneral.h @@ -0,0 +1,96 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about a geometry, a state associated with a geometry, a bounding +// volume, or an associated entity ID. NOTE: this class requires hand +// coding. 6.2.31 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EnvironmentGeneral { + protected: + /** Record type */ + uint32_t _environmentType; + + /** length, in bits */ + uint8_t _length; + + /** Identify the sequentially numbered record index */ + uint8_t _index; + + /** padding */ + uint8_t _padding1; + + /** Geometry or state record */ + uint8_t _geometry; + + /** padding to bring the total size up to a 64 bit boundry */ + uint8_t _padding2; + + public: + EnvironmentGeneral(); + virtual ~EnvironmentGeneral(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getEnvironmentType() const; + void setEnvironmentType(uint32_t pX); + + uint8_t getLength() const; + void setLength(uint8_t pX); + + uint8_t getIndex() const; + void setIndex(uint8_t pX); + + uint8_t getPadding1() const; + void setPadding1(uint8_t pX); + + uint8_t getGeometry() const; + void setGeometry(uint8_t pX); + + uint8_t getPadding2() const; + void setPadding2(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EnvironmentGeneral& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EnvironmentType.cpp b/src/dis7/common/EnvironmentType.cpp new file mode 100644 index 00000000..b8f1a02b --- /dev/null +++ b/src/dis7/common/EnvironmentType.cpp @@ -0,0 +1,120 @@ +#include "dis7/EnvironmentType.h" + +using namespace DIS; + +EnvironmentType::EnvironmentType() + : _entityKind(0), + _domain(0), + _entityClass(0), + _category(0), + _subcategory(0), + _specific(0), + _extra(0) {} + +EnvironmentType::~EnvironmentType() {} + +uint8_t EnvironmentType::getEntityKind() const { return _entityKind; } + +void EnvironmentType::setEntityKind(uint8_t pX) { _entityKind = pX; } + +uint8_t EnvironmentType::getDomain() const { return _domain; } + +void EnvironmentType::setDomain(uint8_t pX) { _domain = pX; } + +uint16_t EnvironmentType::getEntityClass() const { return _entityClass; } + +void EnvironmentType::setEntityClass(uint16_t pX) { _entityClass = pX; } + +uint8_t EnvironmentType::getCategory() const { return _category; } + +void EnvironmentType::setCategory(uint8_t pX) { _category = pX; } + +uint8_t EnvironmentType::getSubcategory() const { return _subcategory; } + +void EnvironmentType::setSubcategory(uint8_t pX) { _subcategory = pX; } + +uint8_t EnvironmentType::getSpecific() const { return _specific; } + +void EnvironmentType::setSpecific(uint8_t pX) { _specific = pX; } + +uint8_t EnvironmentType::getExtra() const { return _extra; } + +void EnvironmentType::setExtra(uint8_t pX) { _extra = pX; } + +void EnvironmentType::marshal(DataStream& dataStream) const { + dataStream << _entityKind; + dataStream << _domain; + dataStream << _entityClass; + dataStream << _category; + dataStream << _subcategory; + dataStream << _specific; + dataStream << _extra; +} + +void EnvironmentType::unmarshal(DataStream& dataStream) { + dataStream >> _entityKind; + dataStream >> _domain; + dataStream >> _entityClass; + dataStream >> _category; + dataStream >> _subcategory; + dataStream >> _specific; + dataStream >> _extra; +} + +bool EnvironmentType::operator==(const EnvironmentType& rhs) const { + bool ivarsEqual = true; + + if (!(_entityKind == rhs._entityKind)) ivarsEqual = false; + if (!(_domain == rhs._domain)) ivarsEqual = false; + if (!(_entityClass == rhs._entityClass)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_subcategory == rhs._subcategory)) ivarsEqual = false; + if (!(_specific == rhs._specific)) ivarsEqual = false; + if (!(_extra == rhs._extra)) ivarsEqual = false; + + return ivarsEqual; +} + +int EnvironmentType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _entityKind + marshalSize = marshalSize + 1; // _domain + marshalSize = marshalSize + 2; // _entityClass + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _subcategory + marshalSize = marshalSize + 1; // _specific + marshalSize = marshalSize + 1; // _extra + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EnvironmentType.h b/src/dis7/common/EnvironmentType.h new file mode 100644 index 00000000..6318a636 --- /dev/null +++ b/src/dis7/common/EnvironmentType.h @@ -0,0 +1,100 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Description of environmental data in environmental process and gridded data +// PDUs. Section 6.2.32 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EnvironmentType { + protected: + /** Kind of entity */ + uint8_t _entityKind; + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _domain; + + /** class of environmental entity */ + uint16_t _entityClass; + + /** category of entity */ + uint8_t _category; + + /** subcategory of entity */ + uint8_t _subcategory; + + /** specific info based on subcategory field */ + uint8_t _specific; + + uint8_t _extra; + + public: + EnvironmentType(); + virtual ~EnvironmentType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getEntityKind() const; + void setEntityKind(uint8_t pX); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint16_t getEntityClass() const; + void setEntityClass(uint16_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + uint8_t getSpecific() const; + void setSpecific(uint8_t pX); + + uint8_t getExtra() const; + void setExtra(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EnvironmentType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EulerAngles.cpp b/src/dis7/common/EulerAngles.cpp new file mode 100644 index 00000000..e8889a97 --- /dev/null +++ b/src/dis7/common/EulerAngles.cpp @@ -0,0 +1,81 @@ +#include "dis7/EulerAngles.h" + +using namespace DIS; + +EulerAngles::EulerAngles() : _psi(0.0), _theta(0.0), _phi(0.0) {} + +EulerAngles::~EulerAngles() {} + +float EulerAngles::getPsi() const { return _psi; } + +void EulerAngles::setPsi(float pX) { _psi = pX; } + +float EulerAngles::getTheta() const { return _theta; } + +void EulerAngles::setTheta(float pX) { _theta = pX; } + +float EulerAngles::getPhi() const { return _phi; } + +void EulerAngles::setPhi(float pX) { _phi = pX; } + +void EulerAngles::marshal(DataStream& dataStream) const { + dataStream << _psi; + dataStream << _theta; + dataStream << _phi; +} + +void EulerAngles::unmarshal(DataStream& dataStream) { + dataStream >> _psi; + dataStream >> _theta; + dataStream >> _phi; +} + +bool EulerAngles::operator==(const EulerAngles& rhs) const { + bool ivarsEqual = true; + + if (!(_psi == rhs._psi)) ivarsEqual = false; + if (!(_theta == rhs._theta)) ivarsEqual = false; + if (!(_phi == rhs._phi)) ivarsEqual = false; + + return ivarsEqual; +} + +int EulerAngles::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _psi + marshalSize = marshalSize + 4; // _theta + marshalSize = marshalSize + 4; // _phi + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EulerAngles.h b/src/dis7/common/EulerAngles.h new file mode 100644 index 00000000..cab26d14 --- /dev/null +++ b/src/dis7/common/EulerAngles.h @@ -0,0 +1,74 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Three floating point values representing an orientation, psi, theta, and phi, +// aka the euler angles, in radians. Section 6.2.33 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EulerAngles { + protected: + float _psi; + + float _theta; + + float _phi; + + public: + EulerAngles(); + virtual ~EulerAngles(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getPsi() const; + void setPsi(float pX); + + float getTheta() const; + void setTheta(float pX); + + float getPhi() const; + void setPhi(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EulerAngles& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EventIdentifier.cpp b/src/dis7/common/EventIdentifier.cpp new file mode 100644 index 00000000..f1c00bd1 --- /dev/null +++ b/src/dis7/common/EventIdentifier.cpp @@ -0,0 +1,82 @@ +#include "dis7/EventIdentifier.h" + +using namespace DIS; + +EventIdentifier::EventIdentifier() : _simulationAddress(), _eventNumber(0) {} + +EventIdentifier::~EventIdentifier() {} + +SimulationAddress& EventIdentifier::getSimulationAddress() { + return _simulationAddress; +} + +const SimulationAddress& EventIdentifier::getSimulationAddress() const { + return _simulationAddress; +} + +void EventIdentifier::setSimulationAddress(const SimulationAddress& pX) { + _simulationAddress = pX; +} + +uint16_t EventIdentifier::getEventNumber() const { return _eventNumber; } + +void EventIdentifier::setEventNumber(uint16_t pX) { _eventNumber = pX; } + +void EventIdentifier::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _eventNumber; +} + +void EventIdentifier::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _eventNumber; +} + +bool EventIdentifier::operator==(const EventIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_eventNumber == rhs._eventNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int EventIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _eventNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EventIdentifier.h b/src/dis7/common/EventIdentifier.h new file mode 100644 index 00000000..e5e9ecb8 --- /dev/null +++ b/src/dis7/common/EventIdentifier.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Identifies an event in the world. Use this format for every PDU EXCEPT the +// LiveEntityPdu. Section 6.2.34. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EventIdentifier { + protected: + /** Site and application IDs */ + SimulationAddress _simulationAddress; + + uint16_t _eventNumber; + + public: + EventIdentifier(); + virtual ~EventIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getSimulationAddress(); + const SimulationAddress& getSimulationAddress() const; + void setSimulationAddress(const SimulationAddress& pX); + + uint16_t getEventNumber() const; + void setEventNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EventIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EventIdentifierLiveEntity.cpp b/src/dis7/common/EventIdentifierLiveEntity.cpp new file mode 100644 index 00000000..4cb18e09 --- /dev/null +++ b/src/dis7/common/EventIdentifierLiveEntity.cpp @@ -0,0 +1,95 @@ +#include "dis7/EventIdentifierLiveEntity.h" + +using namespace DIS; + +EventIdentifierLiveEntity::EventIdentifierLiveEntity() + : _siteNumber(0), _applicationNumber(0), _eventNumber(0) {} + +EventIdentifierLiveEntity::~EventIdentifierLiveEntity() {} + +uint8_t EventIdentifierLiveEntity::getSiteNumber() const { + return _siteNumber; +} + +void EventIdentifierLiveEntity::setSiteNumber(uint8_t pX) { + _siteNumber = pX; +} + +uint8_t EventIdentifierLiveEntity::getApplicationNumber() const { + return _applicationNumber; +} + +void EventIdentifierLiveEntity::setApplicationNumber(uint8_t pX) { + _applicationNumber = pX; +} + +uint16_t EventIdentifierLiveEntity::getEventNumber() const { + return _eventNumber; +} + +void EventIdentifierLiveEntity::setEventNumber(uint16_t pX) { + _eventNumber = pX; +} + +void EventIdentifierLiveEntity::marshal(DataStream& dataStream) const { + dataStream << _siteNumber; + dataStream << _applicationNumber; + dataStream << _eventNumber; +} + +void EventIdentifierLiveEntity::unmarshal(DataStream& dataStream) { + dataStream >> _siteNumber; + dataStream >> _applicationNumber; + dataStream >> _eventNumber; +} + +bool EventIdentifierLiveEntity::operator==( + const EventIdentifierLiveEntity& rhs) const { + bool ivarsEqual = true; + + if (!(_siteNumber == rhs._siteNumber)) ivarsEqual = false; + if (!(_applicationNumber == rhs._applicationNumber)) ivarsEqual = false; + if (!(_eventNumber == rhs._eventNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int EventIdentifierLiveEntity::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _siteNumber + marshalSize = marshalSize + 1; // _applicationNumber + marshalSize = marshalSize + 2; // _eventNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/EventIdentifierLiveEntity.h b/src/dis7/common/EventIdentifierLiveEntity.h new file mode 100644 index 00000000..d7288ad5 --- /dev/null +++ b/src/dis7/common/EventIdentifierLiveEntity.h @@ -0,0 +1,74 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Identifies an event in the world. Use this format for ONLY the LiveEntityPdu. +// Section 6.2.34. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EventIdentifierLiveEntity { + protected: + uint8_t _siteNumber; + + uint8_t _applicationNumber; + + uint16_t _eventNumber; + + public: + EventIdentifierLiveEntity(); + virtual ~EventIdentifierLiveEntity(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getSiteNumber() const; + void setSiteNumber(uint8_t pX); + + uint8_t getApplicationNumber() const; + void setApplicationNumber(uint8_t pX); + + uint16_t getEventNumber() const; + void setEventNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EventIdentifierLiveEntity& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Expendable.cpp b/src/dis7/common/Expendable.cpp new file mode 100644 index 00000000..6d56858f --- /dev/null +++ b/src/dis7/common/Expendable.cpp @@ -0,0 +1,108 @@ +#include "dis7/Expendable.h" + +using namespace DIS; + +Expendable::Expendable() + : _expendable(), + _station(0), + _quantity(0), + _expendableStatus(0), + _padding(0) {} + +Expendable::~Expendable() {} + +EntityType& Expendable::getExpendable() { return _expendable; } + +const EntityType& Expendable::getExpendable() const { return _expendable; } + +void Expendable::setExpendable(const EntityType& pX) { _expendable = pX; } + +uint32_t Expendable::getStation() const { return _station; } + +void Expendable::setStation(uint32_t pX) { _station = pX; } + +uint16_t Expendable::getQuantity() const { return _quantity; } + +void Expendable::setQuantity(uint16_t pX) { _quantity = pX; } + +uint8_t Expendable::getExpendableStatus() const { + return _expendableStatus; +} + +void Expendable::setExpendableStatus(uint8_t pX) { + _expendableStatus = pX; +} + +uint8_t Expendable::getPadding() const { return _padding; } + +void Expendable::setPadding(uint8_t pX) { _padding = pX; } + +void Expendable::marshal(DataStream& dataStream) const { + _expendable.marshal(dataStream); + dataStream << _station; + dataStream << _quantity; + dataStream << _expendableStatus; + dataStream << _padding; +} + +void Expendable::unmarshal(DataStream& dataStream) { + _expendable.unmarshal(dataStream); + dataStream >> _station; + dataStream >> _quantity; + dataStream >> _expendableStatus; + dataStream >> _padding; +} + +bool Expendable::operator==(const Expendable& rhs) const { + bool ivarsEqual = true; + + if (!(_expendable == rhs._expendable)) ivarsEqual = false; + if (!(_station == rhs._station)) ivarsEqual = false; + if (!(_quantity == rhs._quantity)) ivarsEqual = false; + if (!(_expendableStatus == rhs._expendableStatus)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int Expendable::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _expendable.getMarshalledSize(); // _expendable + marshalSize = marshalSize + 4; // _station + marshalSize = marshalSize + 2; // _quantity + marshalSize = marshalSize + 1; // _expendableStatus + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Expendable.h b/src/dis7/common/Expendable.h new file mode 100644 index 00000000..30899a14 --- /dev/null +++ b/src/dis7/common/Expendable.h @@ -0,0 +1,86 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// An entity's expendable (chaff, flares, etc) information. Section 6.2.36 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Expendable { + protected: + /** Type of expendable */ + EntityType _expendable; + + uint32_t _station; + + uint16_t _quantity; + + uint8_t _expendableStatus; + + uint8_t _padding; + + public: + Expendable(); + virtual ~Expendable(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getExpendable(); + const EntityType& getExpendable() const; + void setExpendable(const EntityType& pX); + + uint32_t getStation() const; + void setStation(uint32_t pX); + + uint16_t getQuantity() const; + void setQuantity(uint16_t pX); + + uint8_t getExpendableStatus() const; + void setExpendableStatus(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Expendable& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ExpendableDescriptor.cpp b/src/dis7/common/ExpendableDescriptor.cpp new file mode 100644 index 00000000..9ba74064 --- /dev/null +++ b/src/dis7/common/ExpendableDescriptor.cpp @@ -0,0 +1,82 @@ +#include "dis7/ExpendableDescriptor.h" + +using namespace DIS; + +ExpendableDescriptor::ExpendableDescriptor() : _expendableType(), _padding(0) {} + +ExpendableDescriptor::~ExpendableDescriptor() {} + +EntityType& ExpendableDescriptor::getExpendableType() { + return _expendableType; +} + +const EntityType& ExpendableDescriptor::getExpendableType() const { + return _expendableType; +} + +void ExpendableDescriptor::setExpendableType(const EntityType& pX) { + _expendableType = pX; +} + +int64_t ExpendableDescriptor::getPadding() const { return _padding; } + +void ExpendableDescriptor::setPadding(int64_t pX) { _padding = pX; } + +void ExpendableDescriptor::marshal(DataStream& dataStream) const { + _expendableType.marshal(dataStream); + dataStream << _padding; +} + +void ExpendableDescriptor::unmarshal(DataStream& dataStream) { + _expendableType.unmarshal(dataStream); + dataStream >> _padding; +} + +bool ExpendableDescriptor::operator==(const ExpendableDescriptor& rhs) const { + bool ivarsEqual = true; + + if (!(_expendableType == rhs._expendableType)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int ExpendableDescriptor::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _expendableType.getMarshalledSize(); // _expendableType + marshalSize = marshalSize + 8; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ExpendableDescriptor.h b/src/dis7/common/ExpendableDescriptor.h new file mode 100644 index 00000000..df5ce11b --- /dev/null +++ b/src/dis7/common/ExpendableDescriptor.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Burst of chaff or expendible device. Section 6.2.20.4 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ExpendableDescriptor { + protected: + /** Type of the object that exploded */ + EntityType _expendableType; + + /** Padding */ + int64_t _padding; + + public: + ExpendableDescriptor(); + virtual ~ExpendableDescriptor(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getExpendableType(); + const EntityType& getExpendableType() const; + void setExpendableType(const EntityType& pX); + + int64_t getPadding() const; + void setPadding(int64_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ExpendableDescriptor& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ExpendableReload.cpp b/src/dis7/common/ExpendableReload.cpp new file mode 100644 index 00000000..da030c61 --- /dev/null +++ b/src/dis7/common/ExpendableReload.cpp @@ -0,0 +1,133 @@ +#include "dis7/ExpendableReload.h" + +using namespace DIS; + +ExpendableReload::ExpendableReload() + : _expendable(), + _station(0), + _standardQuantity(0), + _maximumQuantity(0), + _standardQuantityReloadTime(0), + _maximumQuantityReloadTime(0) {} + +ExpendableReload::~ExpendableReload() {} + +EntityType& ExpendableReload::getExpendable() { return _expendable; } + +const EntityType& ExpendableReload::getExpendable() const { + return _expendable; +} + +void ExpendableReload::setExpendable(const EntityType& pX) { _expendable = pX; } + +uint32_t ExpendableReload::getStation() const { return _station; } + +void ExpendableReload::setStation(uint32_t pX) { _station = pX; } + +uint16_t ExpendableReload::getStandardQuantity() const { + return _standardQuantity; +} + +void ExpendableReload::setStandardQuantity(uint16_t pX) { + _standardQuantity = pX; +} + +uint16_t ExpendableReload::getMaximumQuantity() const { + return _maximumQuantity; +} + +void ExpendableReload::setMaximumQuantity(uint16_t pX) { + _maximumQuantity = pX; +} + +uint32_t ExpendableReload::getStandardQuantityReloadTime() const { + return _standardQuantityReloadTime; +} + +void ExpendableReload::setStandardQuantityReloadTime(uint32_t pX) { + _standardQuantityReloadTime = pX; +} + +uint32_t ExpendableReload::getMaximumQuantityReloadTime() const { + return _maximumQuantityReloadTime; +} + +void ExpendableReload::setMaximumQuantityReloadTime(uint32_t pX) { + _maximumQuantityReloadTime = pX; +} + +void ExpendableReload::marshal(DataStream& dataStream) const { + _expendable.marshal(dataStream); + dataStream << _station; + dataStream << _standardQuantity; + dataStream << _maximumQuantity; + dataStream << _standardQuantityReloadTime; + dataStream << _maximumQuantityReloadTime; +} + +void ExpendableReload::unmarshal(DataStream& dataStream) { + _expendable.unmarshal(dataStream); + dataStream >> _station; + dataStream >> _standardQuantity; + dataStream >> _maximumQuantity; + dataStream >> _standardQuantityReloadTime; + dataStream >> _maximumQuantityReloadTime; +} + +bool ExpendableReload::operator==(const ExpendableReload& rhs) const { + bool ivarsEqual = true; + + if (!(_expendable == rhs._expendable)) ivarsEqual = false; + if (!(_station == rhs._station)) ivarsEqual = false; + if (!(_standardQuantity == rhs._standardQuantity)) ivarsEqual = false; + if (!(_maximumQuantity == rhs._maximumQuantity)) ivarsEqual = false; + if (!(_standardQuantityReloadTime == rhs._standardQuantityReloadTime)) + ivarsEqual = false; + if (!(_maximumQuantityReloadTime == rhs._maximumQuantityReloadTime)) + ivarsEqual = false; + + return ivarsEqual; +} + +int ExpendableReload::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _expendable.getMarshalledSize(); // _expendable + marshalSize = marshalSize + 4; // _station + marshalSize = marshalSize + 2; // _standardQuantity + marshalSize = marshalSize + 2; // _maximumQuantity + marshalSize = marshalSize + 4; // _standardQuantityReloadTime + marshalSize = marshalSize + 4; // _maximumQuantityReloadTime + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ExpendableReload.h b/src/dis7/common/ExpendableReload.h new file mode 100644 index 00000000..8bb79b5b --- /dev/null +++ b/src/dis7/common/ExpendableReload.h @@ -0,0 +1,91 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// An entity's expendable (chaff, flares, etc) information. Section 6.2.37 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ExpendableReload { + protected: + /** Type of expendable */ + EntityType _expendable; + + uint32_t _station; + + uint16_t _standardQuantity; + + uint16_t _maximumQuantity; + + uint32_t _standardQuantityReloadTime; + + uint32_t _maximumQuantityReloadTime; + + public: + ExpendableReload(); + virtual ~ExpendableReload(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getExpendable(); + const EntityType& getExpendable() const; + void setExpendable(const EntityType& pX); + + uint32_t getStation() const; + void setStation(uint32_t pX); + + uint16_t getStandardQuantity() const; + void setStandardQuantity(uint16_t pX); + + uint16_t getMaximumQuantity() const; + void setMaximumQuantity(uint16_t pX); + + uint32_t getStandardQuantityReloadTime() const; + void setStandardQuantityReloadTime(uint32_t pX); + + uint32_t getMaximumQuantityReloadTime() const; + void setMaximumQuantityReloadTime(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ExpendableReload& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ExplosionDescriptor.cpp b/src/dis7/common/ExplosionDescriptor.cpp new file mode 100644 index 00000000..497e45e0 --- /dev/null +++ b/src/dis7/common/ExplosionDescriptor.cpp @@ -0,0 +1,106 @@ +#include "dis7/ExplosionDescriptor.h" + +using namespace DIS; + +ExplosionDescriptor::ExplosionDescriptor() + : _explodingObject(), + _explosiveMaterial(0), + _padding(0), + _explosiveForce(0.0) {} + +ExplosionDescriptor::~ExplosionDescriptor() {} + +EntityType& ExplosionDescriptor::getExplodingObject() { + return _explodingObject; +} + +const EntityType& ExplosionDescriptor::getExplodingObject() const { + return _explodingObject; +} + +void ExplosionDescriptor::setExplodingObject(const EntityType& pX) { + _explodingObject = pX; +} + +uint16_t ExplosionDescriptor::getExplosiveMaterial() const { + return _explosiveMaterial; +} + +void ExplosionDescriptor::setExplosiveMaterial(uint16_t pX) { + _explosiveMaterial = pX; +} + +uint16_t ExplosionDescriptor::getPadding() const { return _padding; } + +void ExplosionDescriptor::setPadding(uint16_t pX) { _padding = pX; } + +float ExplosionDescriptor::getExplosiveForce() const { return _explosiveForce; } + +void ExplosionDescriptor::setExplosiveForce(float pX) { _explosiveForce = pX; } + +void ExplosionDescriptor::marshal(DataStream& dataStream) const { + _explodingObject.marshal(dataStream); + dataStream << _explosiveMaterial; + dataStream << _padding; + dataStream << _explosiveForce; +} + +void ExplosionDescriptor::unmarshal(DataStream& dataStream) { + _explodingObject.unmarshal(dataStream); + dataStream >> _explosiveMaterial; + dataStream >> _padding; + dataStream >> _explosiveForce; +} + +bool ExplosionDescriptor::operator==(const ExplosionDescriptor& rhs) const { + bool ivarsEqual = true; + + if (!(_explodingObject == rhs._explodingObject)) ivarsEqual = false; + if (!(_explosiveMaterial == rhs._explosiveMaterial)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_explosiveForce == rhs._explosiveForce)) ivarsEqual = false; + + return ivarsEqual; +} + +int ExplosionDescriptor::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _explodingObject.getMarshalledSize(); // _explodingObject + marshalSize = marshalSize + 2; // _explosiveMaterial + marshalSize = marshalSize + 2; // _padding + marshalSize = marshalSize + 4; // _explosiveForce + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ExplosionDescriptor.h b/src/dis7/common/ExplosionDescriptor.h new file mode 100644 index 00000000..6b634824 --- /dev/null +++ b/src/dis7/common/ExplosionDescriptor.h @@ -0,0 +1,84 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Explosion of a non-munition. Section 6.2.20.3 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ExplosionDescriptor { + protected: + /** Type of the object that exploded. See 6.2.30 */ + EntityType _explodingObject; + + /** Material that exploded. Can be grain dust, tnt, gasoline, etc. */ + uint16_t _explosiveMaterial; + + /** padding */ + uint16_t _padding; + + /** Force of explosion, in equivalent KG of TNT */ + float _explosiveForce; + + public: + ExplosionDescriptor(); + virtual ~ExplosionDescriptor(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getExplodingObject(); + const EntityType& getExplodingObject() const; + void setExplodingObject(const EntityType& pX); + + uint16_t getExplosiveMaterial() const; + void setExplosiveMaterial(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + float getExplosiveForce() const; + void setExplosiveForce(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ExplosionDescriptor& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/FalseTargetsAttribute.cpp b/src/dis7/common/FalseTargetsAttribute.cpp new file mode 100644 index 00000000..52a8f8dc --- /dev/null +++ b/src/dis7/common/FalseTargetsAttribute.cpp @@ -0,0 +1,213 @@ +#include "dis7/FalseTargetsAttribute.h" + +using namespace DIS; + +FalseTargetsAttribute::FalseTargetsAttribute() + : _recordType(3502), + _recordLength(40), + _padding(0), + _emitterNumber(0), + _beamNumber(0), + _stateIndicator(0), + _padding2(0), + _falseTargetCount(0.0), + _walkSpeed(0.0), + _walkAcceleration(0.0), + _maximumWalkDistance(0.0), + _keepTime(0.0), + _echoSpacing(0.0), + _padding3(0) {} + +FalseTargetsAttribute::~FalseTargetsAttribute() {} + +uint32_t FalseTargetsAttribute::getRecordType() const { + return _recordType; +} + +void FalseTargetsAttribute::setRecordType(uint32_t pX) { _recordType = pX; } + +uint16_t FalseTargetsAttribute::getRecordLength() const { + return _recordLength; +} + +void FalseTargetsAttribute::setRecordLength(uint16_t pX) { + _recordLength = pX; +} + +uint16_t FalseTargetsAttribute::getPadding() const { return _padding; } + +void FalseTargetsAttribute::setPadding(uint16_t pX) { _padding = pX; } + +uint8_t FalseTargetsAttribute::getEmitterNumber() const { + return _emitterNumber; +} + +void FalseTargetsAttribute::setEmitterNumber(uint8_t pX) { + _emitterNumber = pX; +} + +uint8_t FalseTargetsAttribute::getBeamNumber() const { + return _beamNumber; +} + +void FalseTargetsAttribute::setBeamNumber(uint8_t pX) { + _beamNumber = pX; +} + +uint8_t FalseTargetsAttribute::getStateIndicator() const { + return _stateIndicator; +} + +void FalseTargetsAttribute::setStateIndicator(uint8_t pX) { + _stateIndicator = pX; +} + +uint8_t FalseTargetsAttribute::getPadding2() const { return _padding2; } + +void FalseTargetsAttribute::setPadding2(uint8_t pX) { _padding2 = pX; } + +float FalseTargetsAttribute::getFalseTargetCount() const { + return _falseTargetCount; +} + +void FalseTargetsAttribute::setFalseTargetCount(float pX) { + _falseTargetCount = pX; +} + +float FalseTargetsAttribute::getWalkSpeed() const { return _walkSpeed; } + +void FalseTargetsAttribute::setWalkSpeed(float pX) { _walkSpeed = pX; } + +float FalseTargetsAttribute::getWalkAcceleration() const { + return _walkAcceleration; +} + +void FalseTargetsAttribute::setWalkAcceleration(float pX) { + _walkAcceleration = pX; +} + +float FalseTargetsAttribute::getMaximumWalkDistance() const { + return _maximumWalkDistance; +} + +void FalseTargetsAttribute::setMaximumWalkDistance(float pX) { + _maximumWalkDistance = pX; +} + +float FalseTargetsAttribute::getKeepTime() const { return _keepTime; } + +void FalseTargetsAttribute::setKeepTime(float pX) { _keepTime = pX; } + +float FalseTargetsAttribute::getEchoSpacing() const { return _echoSpacing; } + +void FalseTargetsAttribute::setEchoSpacing(float pX) { _echoSpacing = pX; } + +uint32_t FalseTargetsAttribute::getPadding3() const { return _padding3; } + +void FalseTargetsAttribute::setPadding3(uint32_t pX) { _padding3 = pX; } + +void FalseTargetsAttribute::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _padding; + dataStream << _emitterNumber; + dataStream << _beamNumber; + dataStream << _stateIndicator; + dataStream << _padding2; + dataStream << _falseTargetCount; + dataStream << _walkSpeed; + dataStream << _walkAcceleration; + dataStream << _maximumWalkDistance; + dataStream << _keepTime; + dataStream << _echoSpacing; + dataStream << _padding3; +} + +void FalseTargetsAttribute::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _padding; + dataStream >> _emitterNumber; + dataStream >> _beamNumber; + dataStream >> _stateIndicator; + dataStream >> _padding2; + dataStream >> _falseTargetCount; + dataStream >> _walkSpeed; + dataStream >> _walkAcceleration; + dataStream >> _maximumWalkDistance; + dataStream >> _keepTime; + dataStream >> _echoSpacing; + dataStream >> _padding3; +} + +bool FalseTargetsAttribute::operator==(const FalseTargetsAttribute& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_emitterNumber == rhs._emitterNumber)) ivarsEqual = false; + if (!(_beamNumber == rhs._beamNumber)) ivarsEqual = false; + if (!(_stateIndicator == rhs._stateIndicator)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_falseTargetCount == rhs._falseTargetCount)) ivarsEqual = false; + if (!(_walkSpeed == rhs._walkSpeed)) ivarsEqual = false; + if (!(_walkAcceleration == rhs._walkAcceleration)) ivarsEqual = false; + if (!(_maximumWalkDistance == rhs._maximumWalkDistance)) ivarsEqual = false; + if (!(_keepTime == rhs._keepTime)) ivarsEqual = false; + if (!(_echoSpacing == rhs._echoSpacing)) ivarsEqual = false; + if (!(_padding3 == rhs._padding3)) ivarsEqual = false; + + return ivarsEqual; +} + +int FalseTargetsAttribute::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 2; // _padding + marshalSize = marshalSize + 1; // _emitterNumber + marshalSize = marshalSize + 1; // _beamNumber + marshalSize = marshalSize + 1; // _stateIndicator + marshalSize = marshalSize + 1; // _padding2 + marshalSize = marshalSize + 4; // _falseTargetCount + marshalSize = marshalSize + 4; // _walkSpeed + marshalSize = marshalSize + 4; // _walkAcceleration + marshalSize = marshalSize + 4; // _maximumWalkDistance + marshalSize = marshalSize + 4; // _keepTime + marshalSize = marshalSize + 4; // _echoSpacing + marshalSize = marshalSize + 4; // _padding3 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/FalseTargetsAttribute.h b/src/dis7/common/FalseTargetsAttribute.h new file mode 100644 index 00000000..e77e9a03 --- /dev/null +++ b/src/dis7/common/FalseTargetsAttribute.h @@ -0,0 +1,133 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The False Targets attribute record shall be used to communicate discrete +// values that are associated with false targets jamming that cannot be +// referenced to an emitter mode. The values provided in the False Targets +// attri- bute record shall be considered valid only for the victim radar beams +// listed in the jamming beam's Track/Jam Data records (provided in the +// associated Electromagnetic Emission PDU). Section 6.2.12.3 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT FalseTargetsAttribute { + protected: + uint32_t _recordType; + + uint16_t _recordLength; + + uint16_t _padding; + + uint8_t _emitterNumber; + + uint8_t _beamNumber; + + uint8_t _stateIndicator; + + uint8_t _padding2; + + float _falseTargetCount; + + float _walkSpeed; + + float _walkAcceleration; + + float _maximumWalkDistance; + + float _keepTime; + + float _echoSpacing; + + uint32_t _padding3; + + public: + FalseTargetsAttribute(); + virtual ~FalseTargetsAttribute(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + uint8_t getEmitterNumber() const; + void setEmitterNumber(uint8_t pX); + + uint8_t getBeamNumber() const; + void setBeamNumber(uint8_t pX); + + uint8_t getStateIndicator() const; + void setStateIndicator(uint8_t pX); + + uint8_t getPadding2() const; + void setPadding2(uint8_t pX); + + float getFalseTargetCount() const; + void setFalseTargetCount(float pX); + + float getWalkSpeed() const; + void setWalkSpeed(float pX); + + float getWalkAcceleration() const; + void setWalkAcceleration(float pX); + + float getMaximumWalkDistance() const; + void setMaximumWalkDistance(float pX); + + float getKeepTime() const; + void setKeepTime(float pX); + + float getEchoSpacing() const; + void setEchoSpacing(float pX); + + uint32_t getPadding3() const; + void setPadding3(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FalseTargetsAttribute& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/FixedDatum.cpp b/src/dis7/common/FixedDatum.cpp new file mode 100644 index 00000000..c3637f06 --- /dev/null +++ b/src/dis7/common/FixedDatum.cpp @@ -0,0 +1,73 @@ +#include "dis7/FixedDatum.h" + +using namespace DIS; + +FixedDatum::FixedDatum() : _fixedDatumID(0), _fixedDatumValue(0) {} + +FixedDatum::~FixedDatum() {} + +uint32_t FixedDatum::getFixedDatumID() const { return _fixedDatumID; } + +void FixedDatum::setFixedDatumID(uint32_t pX) { _fixedDatumID = pX; } + +uint32_t FixedDatum::getFixedDatumValue() const { return _fixedDatumValue; } + +void FixedDatum::setFixedDatumValue(uint32_t pX) { _fixedDatumValue = pX; } + +void FixedDatum::marshal(DataStream& dataStream) const { + dataStream << _fixedDatumID; + dataStream << _fixedDatumValue; +} + +void FixedDatum::unmarshal(DataStream& dataStream) { + dataStream >> _fixedDatumID; + dataStream >> _fixedDatumValue; +} + +bool FixedDatum::operator==(const FixedDatum& rhs) const { + bool ivarsEqual = true; + + if (!(_fixedDatumID == rhs._fixedDatumID)) ivarsEqual = false; + if (!(_fixedDatumValue == rhs._fixedDatumValue)) ivarsEqual = false; + + return ivarsEqual; +} + +int FixedDatum::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _fixedDatumID + marshalSize = marshalSize + 4; // _fixedDatumValue + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/FixedDatum.h b/src/dis7/common/FixedDatum.h new file mode 100644 index 00000000..d9b23b07 --- /dev/null +++ b/src/dis7/common/FixedDatum.h @@ -0,0 +1,70 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Fixed Datum Record. Section 6.2.38 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT FixedDatum { + protected: + /** ID of the fixed datum, an enumeration */ + uint32_t _fixedDatumID; + + /** Value for the fixed datum */ + uint32_t _fixedDatumValue; + + public: + FixedDatum(); + virtual ~FixedDatum(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getFixedDatumID() const; + void setFixedDatumID(uint32_t pX); + + uint32_t getFixedDatumValue() const; + void setFixedDatumValue(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FixedDatum& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/FourByteChunk.cpp b/src/dis7/common/FourByteChunk.cpp new file mode 100644 index 00000000..9562524d --- /dev/null +++ b/src/dis7/common/FourByteChunk.cpp @@ -0,0 +1,86 @@ +#include "dis7/FourByteChunk.h" + +using namespace DIS; + +FourByteChunk::FourByteChunk() { + // Initialize fixed length array + for (int lengthotherParameters = 0; lengthotherParameters < 4; + lengthotherParameters++) { + _otherParameters[lengthotherParameters] = 0; + } +} + +FourByteChunk::~FourByteChunk() {} + +char* FourByteChunk::getOtherParameters() { return _otherParameters; } + +const char* FourByteChunk::getOtherParameters() const { + return _otherParameters; +} + +void FourByteChunk::setOtherParameters(const char* x) { + for (int i = 0; i < 4; i++) { + _otherParameters[i] = x[i]; + } +} + +void FourByteChunk::marshal(DataStream& dataStream) const { + for (size_t idx = 0; idx < 4; idx++) { + dataStream << _otherParameters[idx]; + } +} + +void FourByteChunk::unmarshal(DataStream& dataStream) { + for (size_t idx = 0; idx < 4; idx++) { + dataStream >> _otherParameters[idx]; + } +} + +bool FourByteChunk::operator==(const FourByteChunk& rhs) const { + bool ivarsEqual = true; + + for (uint8_t idx = 0; idx < 4; idx++) { + if (!(_otherParameters[idx] == rhs._otherParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int FourByteChunk::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4 * 1; // _otherParameters + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/FourByteChunk.h b/src/dis7/common/FourByteChunk.h new file mode 100644 index 00000000..07118f5a --- /dev/null +++ b/src/dis7/common/FourByteChunk.h @@ -0,0 +1,65 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// 32 bit piece of data + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT FourByteChunk { + protected: + /** four bytes of arbitrary data */ + char _otherParameters[4]; + + public: + FourByteChunk(); + virtual ~FourByteChunk(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + char* getOtherParameters(); + const char* getOtherParameters() const; + void setOtherParameters(const char* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FourByteChunk& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/GridAxis.cpp b/src/dis7/common/GridAxis.cpp new file mode 100644 index 00000000..f9dc8fe8 --- /dev/null +++ b/src/dis7/common/GridAxis.cpp @@ -0,0 +1,125 @@ +#include "dis7/GridAxis.h" + +using namespace DIS; + +GridAxis::GridAxis() + : _domainInitialXi(0.0), + _domainFinalXi(0.0), + _domainPointsXi(0), + _interleafFactor(0), + _axisType(0), + _numberOfPointsOnXiAxis(0), + _initialIndex(0) {} + +GridAxis::~GridAxis() {} + +double GridAxis::getDomainInitialXi() const { return _domainInitialXi; } + +void GridAxis::setDomainInitialXi(double pX) { _domainInitialXi = pX; } + +double GridAxis::getDomainFinalXi() const { return _domainFinalXi; } + +void GridAxis::setDomainFinalXi(double pX) { _domainFinalXi = pX; } + +uint16_t GridAxis::getDomainPointsXi() const { return _domainPointsXi; } + +void GridAxis::setDomainPointsXi(uint16_t pX) { _domainPointsXi = pX; } + +uint8_t GridAxis::getInterleafFactor() const { return _interleafFactor; } + +void GridAxis::setInterleafFactor(uint8_t pX) { _interleafFactor = pX; } + +uint8_t GridAxis::getAxisType() const { return _axisType; } + +void GridAxis::setAxisType(uint8_t pX) { _axisType = pX; } + +uint16_t GridAxis::getNumberOfPointsOnXiAxis() const { + return _numberOfPointsOnXiAxis; +} + +void GridAxis::setNumberOfPointsOnXiAxis(uint16_t pX) { + _numberOfPointsOnXiAxis = pX; +} + +uint16_t GridAxis::getInitialIndex() const { return _initialIndex; } + +void GridAxis::setInitialIndex(uint16_t pX) { _initialIndex = pX; } + +void GridAxis::marshal(DataStream& dataStream) const { + dataStream << _domainInitialXi; + dataStream << _domainFinalXi; + dataStream << _domainPointsXi; + dataStream << _interleafFactor; + dataStream << _axisType; + dataStream << _numberOfPointsOnXiAxis; + dataStream << _initialIndex; +} + +void GridAxis::unmarshal(DataStream& dataStream) { + dataStream >> _domainInitialXi; + dataStream >> _domainFinalXi; + dataStream >> _domainPointsXi; + dataStream >> _interleafFactor; + dataStream >> _axisType; + dataStream >> _numberOfPointsOnXiAxis; + dataStream >> _initialIndex; +} + +bool GridAxis::operator==(const GridAxis& rhs) const { + bool ivarsEqual = true; + + if (!(_domainInitialXi == rhs._domainInitialXi)) ivarsEqual = false; + if (!(_domainFinalXi == rhs._domainFinalXi)) ivarsEqual = false; + if (!(_domainPointsXi == rhs._domainPointsXi)) ivarsEqual = false; + if (!(_interleafFactor == rhs._interleafFactor)) ivarsEqual = false; + if (!(_axisType == rhs._axisType)) ivarsEqual = false; + if (!(_numberOfPointsOnXiAxis == rhs._numberOfPointsOnXiAxis)) + ivarsEqual = false; + if (!(_initialIndex == rhs._initialIndex)) ivarsEqual = false; + + return ivarsEqual; +} + +int GridAxis::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 8; // _domainInitialXi + marshalSize = marshalSize + 8; // _domainFinalXi + marshalSize = marshalSize + 2; // _domainPointsXi + marshalSize = marshalSize + 1; // _interleafFactor + marshalSize = marshalSize + 1; // _axisType + marshalSize = marshalSize + 2; // _numberOfPointsOnXiAxis + marshalSize = marshalSize + 2; // _initialIndex + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/GridAxis.h b/src/dis7/common/GridAxis.h new file mode 100644 index 00000000..cbbf9838 --- /dev/null +++ b/src/dis7/common/GridAxis.h @@ -0,0 +1,101 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Grid axis record for fixed data. Section 6.2.41 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT GridAxis { + protected: + /** coordinate of the grid origin or initial value */ + double _domainInitialXi; + + /** coordinate of the endpoint or final value */ + double _domainFinalXi; + + /** The number of grid points along the Xi domain axis for the enviornmental + * state data */ + uint16_t _domainPointsXi; + + /** interleaf factor along the domain axis. */ + uint8_t _interleafFactor; + + /** type of grid axis */ + uint8_t _axisType; + + /** Number of grid locations along Xi axis */ + uint16_t _numberOfPointsOnXiAxis; + + /** initial grid point for the current pdu */ + uint16_t _initialIndex; + + public: + GridAxis(); + virtual ~GridAxis(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + double getDomainInitialXi() const; + void setDomainInitialXi(double pX); + + double getDomainFinalXi() const; + void setDomainFinalXi(double pX); + + uint16_t getDomainPointsXi() const; + void setDomainPointsXi(uint16_t pX); + + uint8_t getInterleafFactor() const; + void setInterleafFactor(uint8_t pX); + + uint8_t getAxisType() const; + void setAxisType(uint8_t pX); + + uint16_t getNumberOfPointsOnXiAxis() const; + void setNumberOfPointsOnXiAxis(uint16_t pX); + + uint16_t getInitialIndex() const; + void setInitialIndex(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const GridAxis& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/GroupIdentifier.cpp b/src/dis7/common/GroupIdentifier.cpp new file mode 100644 index 00000000..405aa7e9 --- /dev/null +++ b/src/dis7/common/GroupIdentifier.cpp @@ -0,0 +1,82 @@ +#include "dis7/GroupIdentifier.h" + +using namespace DIS; + +GroupIdentifier::GroupIdentifier() : _simulationAddress(), _groupNumber(0) {} + +GroupIdentifier::~GroupIdentifier() {} + +EntityType& GroupIdentifier::getSimulationAddress() { + return _simulationAddress; +} + +const EntityType& GroupIdentifier::getSimulationAddress() const { + return _simulationAddress; +} + +void GroupIdentifier::setSimulationAddress(const EntityType& pX) { + _simulationAddress = pX; +} + +uint16_t GroupIdentifier::getGroupNumber() const { return _groupNumber; } + +void GroupIdentifier::setGroupNumber(uint16_t pX) { _groupNumber = pX; } + +void GroupIdentifier::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _groupNumber; +} + +void GroupIdentifier::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _groupNumber; +} + +bool GroupIdentifier::operator==(const GroupIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_groupNumber == rhs._groupNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int GroupIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _groupNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/GroupIdentifier.h b/src/dis7/common/GroupIdentifier.h new file mode 100644 index 00000000..c25689dc --- /dev/null +++ b/src/dis7/common/GroupIdentifier.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Unique designation of a group of entities contained in the isGroupOfPdu. +// Represents a group of entities rather than a single entity. Section 6.2.43 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT GroupIdentifier { + protected: + /** Simulation address (site and application number) */ + EntityType _simulationAddress; + + /** group number */ + uint16_t _groupNumber; + + public: + GroupIdentifier(); + virtual ~GroupIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getSimulationAddress(); + const EntityType& getSimulationAddress() const; + void setSimulationAddress(const EntityType& pX); + + uint16_t getGroupNumber() const; + void setGroupNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const GroupIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IOCommunicationsNode.cpp b/src/dis7/common/IOCommunicationsNode.cpp new file mode 100644 index 00000000..bbe1892f --- /dev/null +++ b/src/dis7/common/IOCommunicationsNode.cpp @@ -0,0 +1,129 @@ +#include "dis7/IOCommunicationsNode.h" + +using namespace DIS; + +IOCommunicationsNode::IOCommunicationsNode() + : _recordType(5501), + _recordLength(16), + _communcationsNodeType(0), + _padding(0), + _communicationsNode(), + _elementID(0) {} + +IOCommunicationsNode::~IOCommunicationsNode() {} + +uint32_t IOCommunicationsNode::getRecordType() const { return _recordType; } + +void IOCommunicationsNode::setRecordType(uint32_t pX) { _recordType = pX; } + +uint16_t IOCommunicationsNode::getRecordLength() const { + return _recordLength; +} + +void IOCommunicationsNode::setRecordLength(uint16_t pX) { + _recordLength = pX; +} + +uint8_t IOCommunicationsNode::getCommuncationsNodeType() const { + return _communcationsNodeType; +} + +void IOCommunicationsNode::setCommuncationsNodeType(uint8_t pX) { + _communcationsNodeType = pX; +} + +uint8_t IOCommunicationsNode::getPadding() const { return _padding; } + +void IOCommunicationsNode::setPadding(uint8_t pX) { _padding = pX; } + +EntityID& IOCommunicationsNode::getCommunicationsNode() { + return _communicationsNode; +} + +const EntityID& IOCommunicationsNode::getCommunicationsNode() const { + return _communicationsNode; +} + +void IOCommunicationsNode::setCommunicationsNode(const EntityID& pX) { + _communicationsNode = pX; +} + +uint16_t IOCommunicationsNode::getElementID() const { return _elementID; } + +void IOCommunicationsNode::setElementID(uint16_t pX) { _elementID = pX; } + +void IOCommunicationsNode::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _communcationsNodeType; + dataStream << _padding; + _communicationsNode.marshal(dataStream); + dataStream << _elementID; +} + +void IOCommunicationsNode::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _communcationsNodeType; + dataStream >> _padding; + _communicationsNode.unmarshal(dataStream); + dataStream >> _elementID; +} + +bool IOCommunicationsNode::operator==(const IOCommunicationsNode& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_communcationsNodeType == rhs._communcationsNodeType)) + ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_communicationsNode == rhs._communicationsNode)) ivarsEqual = false; + if (!(_elementID == rhs._elementID)) ivarsEqual = false; + + return ivarsEqual; +} + +int IOCommunicationsNode::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 1; // _communcationsNodeType + marshalSize = marshalSize + 1; // _padding + marshalSize = marshalSize + + _communicationsNode.getMarshalledSize(); // _communicationsNode + marshalSize = marshalSize + 2; // _elementID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IOCommunicationsNode.h b/src/dis7/common/IOCommunicationsNode.h new file mode 100644 index 00000000..cc115f0e --- /dev/null +++ b/src/dis7/common/IOCommunicationsNode.h @@ -0,0 +1,91 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// A communications node that is part of a simulted communcations network. +// Section 6.2.49.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT IOCommunicationsNode { + protected: + uint32_t _recordType; + + uint16_t _recordLength; + + uint8_t _communcationsNodeType; + + uint8_t _padding; + + EntityID _communicationsNode; + + uint16_t _elementID; + + public: + IOCommunicationsNode(); + virtual ~IOCommunicationsNode(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint8_t getCommuncationsNodeType() const; + void setCommuncationsNodeType(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + EntityID& getCommunicationsNode(); + const EntityID& getCommunicationsNode() const; + void setCommunicationsNode(const EntityID& pX); + + uint16_t getElementID() const; + void setElementID(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IOCommunicationsNode& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IOEffect.cpp b/src/dis7/common/IOEffect.cpp new file mode 100644 index 00000000..4f6c2340 --- /dev/null +++ b/src/dis7/common/IOEffect.cpp @@ -0,0 +1,148 @@ +#include "dis7/IOEffect.h" + +using namespace DIS; + +IOEffect::IOEffect() + : _recordType(5500), + _recordLength(16), + _ioStatus(0), + _ioLinkType(0), + _ioEffect(), + _ioEffectDutyCycle(0), + _ioEffectDuration(0), + _ioProcess(0), + _padding(0) {} + +IOEffect::~IOEffect() {} + +uint32_t IOEffect::getRecordType() const { return _recordType; } + +void IOEffect::setRecordType(uint32_t pX) { _recordType = pX; } + +uint16_t IOEffect::getRecordLength() const { return _recordLength; } + +void IOEffect::setRecordLength(uint16_t pX) { _recordLength = pX; } + +uint8_t IOEffect::getIoStatus() const { return _ioStatus; } + +void IOEffect::setIoStatus(uint8_t pX) { _ioStatus = pX; } + +uint8_t IOEffect::getIoLinkType() const { return _ioLinkType; } + +void IOEffect::setIoLinkType(uint8_t pX) { _ioLinkType = pX; } + +EntityID& IOEffect::getIoEffect() { return _ioEffect; } + +const EntityID& IOEffect::getIoEffect() const { return _ioEffect; } + +void IOEffect::setIoEffect(const EntityID& pX) { _ioEffect = pX; } + +uint8_t IOEffect::getIoEffectDutyCycle() const { + return _ioEffectDutyCycle; +} + +void IOEffect::setIoEffectDutyCycle(uint8_t pX) { + _ioEffectDutyCycle = pX; +} + +uint16_t IOEffect::getIoEffectDuration() const { + return _ioEffectDuration; +} + +void IOEffect::setIoEffectDuration(uint16_t pX) { + _ioEffectDuration = pX; +} + +uint16_t IOEffect::getIoProcess() const { return _ioProcess; } + +void IOEffect::setIoProcess(uint16_t pX) { _ioProcess = pX; } + +uint16_t IOEffect::getPadding() const { return _padding; } + +void IOEffect::setPadding(uint16_t pX) { _padding = pX; } + +void IOEffect::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _ioStatus; + dataStream << _ioLinkType; + _ioEffect.marshal(dataStream); + dataStream << _ioEffectDutyCycle; + dataStream << _ioEffectDuration; + dataStream << _ioProcess; + dataStream << _padding; +} + +void IOEffect::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _ioStatus; + dataStream >> _ioLinkType; + _ioEffect.unmarshal(dataStream); + dataStream >> _ioEffectDutyCycle; + dataStream >> _ioEffectDuration; + dataStream >> _ioProcess; + dataStream >> _padding; +} + +bool IOEffect::operator==(const IOEffect& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_ioStatus == rhs._ioStatus)) ivarsEqual = false; + if (!(_ioLinkType == rhs._ioLinkType)) ivarsEqual = false; + if (!(_ioEffect == rhs._ioEffect)) ivarsEqual = false; + if (!(_ioEffectDutyCycle == rhs._ioEffectDutyCycle)) ivarsEqual = false; + if (!(_ioEffectDuration == rhs._ioEffectDuration)) ivarsEqual = false; + if (!(_ioProcess == rhs._ioProcess)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int IOEffect::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 1; // _ioStatus + marshalSize = marshalSize + 1; // _ioLinkType + marshalSize = marshalSize + _ioEffect.getMarshalledSize(); // _ioEffect + marshalSize = marshalSize + 1; // _ioEffectDutyCycle + marshalSize = marshalSize + 2; // _ioEffectDuration + marshalSize = marshalSize + 2; // _ioProcess + marshalSize = marshalSize + 2; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IOEffect.h b/src/dis7/common/IOEffect.h new file mode 100644 index 00000000..e0992904 --- /dev/null +++ b/src/dis7/common/IOEffect.h @@ -0,0 +1,105 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Effect of IO on an entity. Section 6.2.49.3 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT IOEffect { + protected: + uint32_t _recordType; + + uint16_t _recordLength; + + uint8_t _ioStatus; + + uint8_t _ioLinkType; + + EntityID _ioEffect; + + uint8_t _ioEffectDutyCycle; + + uint16_t _ioEffectDuration; + + uint16_t _ioProcess; + + uint16_t _padding; + + public: + IOEffect(); + virtual ~IOEffect(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint8_t getIoStatus() const; + void setIoStatus(uint8_t pX); + + uint8_t getIoLinkType() const; + void setIoLinkType(uint8_t pX); + + EntityID& getIoEffect(); + const EntityID& getIoEffect() const; + void setIoEffect(const EntityID& pX); + + uint8_t getIoEffectDutyCycle() const; + void setIoEffectDutyCycle(uint8_t pX); + + uint16_t getIoEffectDuration() const; + void setIoEffectDuration(uint16_t pX); + + uint16_t getIoProcess() const; + void setIoProcess(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IOEffect& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IffDataSpecification.cpp b/src/dis7/common/IffDataSpecification.cpp new file mode 100644 index 00000000..f0a1092f --- /dev/null +++ b/src/dis7/common/IffDataSpecification.cpp @@ -0,0 +1,76 @@ +#include "dis7/IffDataSpecification.h" + +using namespace DIS; + +IffDataSpecification::IffDataSpecification() : _numberOfIffDataRecords() {} + +IffDataSpecification::~IffDataSpecification() {} + +EntityType& IffDataSpecification::getNumberOfIffDataRecords() { + return _numberOfIffDataRecords; +} + +const EntityType& IffDataSpecification::getNumberOfIffDataRecords() const { + return _numberOfIffDataRecords; +} + +void IffDataSpecification::setNumberOfIffDataRecords(const EntityType& pX) { + _numberOfIffDataRecords = pX; +} + +void IffDataSpecification::marshal(DataStream& dataStream) const { + _numberOfIffDataRecords.marshal(dataStream); +} + +void IffDataSpecification::unmarshal(DataStream& dataStream) { + _numberOfIffDataRecords.unmarshal(dataStream); +} + +bool IffDataSpecification::operator==(const IffDataSpecification& rhs) const { + bool ivarsEqual = true; + + if (!(_numberOfIffDataRecords == rhs._numberOfIffDataRecords)) + ivarsEqual = false; + + return ivarsEqual; +} + +int IffDataSpecification::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + + _numberOfIffDataRecords.getMarshalledSize(); // _numberOfIffDataRecords + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IffDataSpecification.h b/src/dis7/common/IffDataSpecification.h new file mode 100644 index 00000000..0708973e --- /dev/null +++ b/src/dis7/common/IffDataSpecification.h @@ -0,0 +1,66 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Requires hand coding to be useful. Section 6.2.44 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT IffDataSpecification { + protected: + /** Number of iff records */ + EntityType _numberOfIffDataRecords; + + public: + IffDataSpecification(); + virtual ~IffDataSpecification(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getNumberOfIffDataRecords(); + const EntityType& getNumberOfIffDataRecords() const; + void setNumberOfIffDataRecords(const EntityType& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IffDataSpecification& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IntercomCommunicationsParameters.cpp b/src/dis7/common/IntercomCommunicationsParameters.cpp new file mode 100644 index 00000000..4f64868e --- /dev/null +++ b/src/dis7/common/IntercomCommunicationsParameters.cpp @@ -0,0 +1,95 @@ +#include "dis7/IntercomCommunicationsParameters.h" + +using namespace DIS; + +IntercomCommunicationsParameters::IntercomCommunicationsParameters() + : _recordType(0), _recordLength(0), _recordSpecificField(0) {} + +IntercomCommunicationsParameters::~IntercomCommunicationsParameters() {} + +uint16_t IntercomCommunicationsParameters::getRecordType() const { + return _recordType; +} + +void IntercomCommunicationsParameters::setRecordType(uint16_t pX) { + _recordType = pX; +} + +uint16_t IntercomCommunicationsParameters::getRecordLength() const { + return _recordLength; +} + +void IntercomCommunicationsParameters::setRecordLength(uint16_t pX) { + _recordLength = pX; +} + +uint32_t IntercomCommunicationsParameters::getRecordSpecificField() const { + return _recordSpecificField; +} + +void IntercomCommunicationsParameters::setRecordSpecificField(uint32_t pX) { + _recordSpecificField = pX; +} + +void IntercomCommunicationsParameters::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _recordSpecificField; +} + +void IntercomCommunicationsParameters::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _recordSpecificField; +} + +bool IntercomCommunicationsParameters::operator==( + const IntercomCommunicationsParameters& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_recordSpecificField == rhs._recordSpecificField)) ivarsEqual = false; + + return ivarsEqual; +} + +int IntercomCommunicationsParameters::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 4; // _recordSpecificField + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IntercomCommunicationsParameters.h b/src/dis7/common/IntercomCommunicationsParameters.h new file mode 100644 index 00000000..fb7eea52 --- /dev/null +++ b/src/dis7/common/IntercomCommunicationsParameters.h @@ -0,0 +1,76 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Intercom communcations parameters. Section 6.2.47. This requires hand coding + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT IntercomCommunicationsParameters { + protected: + /** Type of intercom parameters record */ + uint16_t _recordType; + + /** length of record */ + uint16_t _recordLength; + + /** This is a placeholder. */ + uint32_t _recordSpecificField; + + public: + IntercomCommunicationsParameters(); + virtual ~IntercomCommunicationsParameters(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getRecordType() const; + void setRecordType(uint16_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint32_t getRecordSpecificField() const; + void setRecordSpecificField(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IntercomCommunicationsParameters& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IntercomIdentifier.cpp b/src/dis7/common/IntercomIdentifier.cpp new file mode 100644 index 00000000..d3c5537f --- /dev/null +++ b/src/dis7/common/IntercomIdentifier.cpp @@ -0,0 +1,105 @@ +#include "dis7/IntercomIdentifier.h" + +using namespace DIS; + +IntercomIdentifier::IntercomIdentifier() + : _siteNumber(0), + _applicationNumber(0), + _referenceNumber(0), + _intercomNumber(0) {} + +IntercomIdentifier::~IntercomIdentifier() {} + +uint16_t IntercomIdentifier::getSiteNumber() const { return _siteNumber; } + +void IntercomIdentifier::setSiteNumber(uint16_t pX) { _siteNumber = pX; } + +uint16_t IntercomIdentifier::getApplicationNumber() const { + return _applicationNumber; +} + +void IntercomIdentifier::setApplicationNumber(uint16_t pX) { + _applicationNumber = pX; +} + +uint16_t IntercomIdentifier::getReferenceNumber() const { + return _referenceNumber; +} + +void IntercomIdentifier::setReferenceNumber(uint16_t pX) { + _referenceNumber = pX; +} + +uint16_t IntercomIdentifier::getIntercomNumber() const { + return _intercomNumber; +} + +void IntercomIdentifier::setIntercomNumber(uint16_t pX) { + _intercomNumber = pX; +} + +void IntercomIdentifier::marshal(DataStream& dataStream) const { + dataStream << _siteNumber; + dataStream << _applicationNumber; + dataStream << _referenceNumber; + dataStream << _intercomNumber; +} + +void IntercomIdentifier::unmarshal(DataStream& dataStream) { + dataStream >> _siteNumber; + dataStream >> _applicationNumber; + dataStream >> _referenceNumber; + dataStream >> _intercomNumber; +} + +bool IntercomIdentifier::operator==(const IntercomIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_siteNumber == rhs._siteNumber)) ivarsEqual = false; + if (!(_applicationNumber == rhs._applicationNumber)) ivarsEqual = false; + if (!(_referenceNumber == rhs._referenceNumber)) ivarsEqual = false; + if (!(_intercomNumber == rhs._intercomNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int IntercomIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _siteNumber + marshalSize = marshalSize + 2; // _applicationNumber + marshalSize = marshalSize + 2; // _referenceNumber + marshalSize = marshalSize + 2; // _intercomNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/IntercomIdentifier.h b/src/dis7/common/IntercomIdentifier.h new file mode 100644 index 00000000..60718d30 --- /dev/null +++ b/src/dis7/common/IntercomIdentifier.h @@ -0,0 +1,79 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Unique designation of an attached or unattached intercom in an event or +// exercirse. Section 6.2.48 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT IntercomIdentifier { + protected: + uint16_t _siteNumber; + + uint16_t _applicationNumber; + + uint16_t _referenceNumber; + + uint16_t _intercomNumber; + + public: + IntercomIdentifier(); + virtual ~IntercomIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSiteNumber() const; + void setSiteNumber(uint16_t pX); + + uint16_t getApplicationNumber() const; + void setApplicationNumber(uint16_t pX); + + uint16_t getReferenceNumber() const; + void setReferenceNumber(uint16_t pX); + + uint16_t getIntercomNumber() const; + void setIntercomNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IntercomIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/LaunchedMunitionRecord.cpp b/src/dis7/common/LaunchedMunitionRecord.cpp new file mode 100644 index 00000000..4c225f1d --- /dev/null +++ b/src/dis7/common/LaunchedMunitionRecord.cpp @@ -0,0 +1,156 @@ +#include "dis7/LaunchedMunitionRecord.h" + +using namespace DIS; + +LaunchedMunitionRecord::LaunchedMunitionRecord() + : _fireEventID(), + _padding(0), + _firingEntityID(), + _padding2(0), + _targetEntityID(), + _padding3(0), + _targetLocation() {} + +LaunchedMunitionRecord::~LaunchedMunitionRecord() {} + +EventIdentifier& LaunchedMunitionRecord::getFireEventID() { + return _fireEventID; +} + +const EventIdentifier& LaunchedMunitionRecord::getFireEventID() const { + return _fireEventID; +} + +void LaunchedMunitionRecord::setFireEventID(const EventIdentifier& pX) { + _fireEventID = pX; +} + +uint16_t LaunchedMunitionRecord::getPadding() const { return _padding; } + +void LaunchedMunitionRecord::setPadding(uint16_t pX) { _padding = pX; } + +EventIdentifier& LaunchedMunitionRecord::getFiringEntityID() { + return _firingEntityID; +} + +const EventIdentifier& LaunchedMunitionRecord::getFiringEntityID() const { + return _firingEntityID; +} + +void LaunchedMunitionRecord::setFiringEntityID(const EventIdentifier& pX) { + _firingEntityID = pX; +} + +uint16_t LaunchedMunitionRecord::getPadding2() const { return _padding2; } + +void LaunchedMunitionRecord::setPadding2(uint16_t pX) { _padding2 = pX; } + +EventIdentifier& LaunchedMunitionRecord::getTargetEntityID() { + return _targetEntityID; +} + +const EventIdentifier& LaunchedMunitionRecord::getTargetEntityID() const { + return _targetEntityID; +} + +void LaunchedMunitionRecord::setTargetEntityID(const EventIdentifier& pX) { + _targetEntityID = pX; +} + +uint16_t LaunchedMunitionRecord::getPadding3() const { return _padding3; } + +void LaunchedMunitionRecord::setPadding3(uint16_t pX) { _padding3 = pX; } + +Vector3Double& LaunchedMunitionRecord::getTargetLocation() { + return _targetLocation; +} + +const Vector3Double& LaunchedMunitionRecord::getTargetLocation() const { + return _targetLocation; +} + +void LaunchedMunitionRecord::setTargetLocation(const Vector3Double& pX) { + _targetLocation = pX; +} + +void LaunchedMunitionRecord::marshal(DataStream& dataStream) const { + _fireEventID.marshal(dataStream); + dataStream << _padding; + _firingEntityID.marshal(dataStream); + dataStream << _padding2; + _targetEntityID.marshal(dataStream); + dataStream << _padding3; + _targetLocation.marshal(dataStream); +} + +void LaunchedMunitionRecord::unmarshal(DataStream& dataStream) { + _fireEventID.unmarshal(dataStream); + dataStream >> _padding; + _firingEntityID.unmarshal(dataStream); + dataStream >> _padding2; + _targetEntityID.unmarshal(dataStream); + dataStream >> _padding3; + _targetLocation.unmarshal(dataStream); +} + +bool LaunchedMunitionRecord::operator==( + const LaunchedMunitionRecord& rhs) const { + bool ivarsEqual = true; + + if (!(_fireEventID == rhs._fireEventID)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_firingEntityID == rhs._firingEntityID)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_targetEntityID == rhs._targetEntityID)) ivarsEqual = false; + if (!(_padding3 == rhs._padding3)) ivarsEqual = false; + if (!(_targetLocation == rhs._targetLocation)) ivarsEqual = false; + + return ivarsEqual; +} + +int LaunchedMunitionRecord::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _fireEventID.getMarshalledSize(); // _fireEventID + marshalSize = marshalSize + 2; // _padding + marshalSize = + marshalSize + _firingEntityID.getMarshalledSize(); // _firingEntityID + marshalSize = marshalSize + 2; // _padding2 + marshalSize = + marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID + marshalSize = marshalSize + 2; // _padding3 + marshalSize = + marshalSize + _targetLocation.getMarshalledSize(); // _targetLocation + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/LaunchedMunitionRecord.h b/src/dis7/common/LaunchedMunitionRecord.h new file mode 100644 index 00000000..d7c96b53 --- /dev/null +++ b/src/dis7/common/LaunchedMunitionRecord.h @@ -0,0 +1,99 @@ +#pragma once + +#include "dis7/EventIdentifier.h" +#include "dis7/Vector3Double.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Identity of a communications node. Section 6.2.51 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT LaunchedMunitionRecord { + protected: + EventIdentifier _fireEventID; + + uint16_t _padding; + + EventIdentifier _firingEntityID; + + uint16_t _padding2; + + EventIdentifier _targetEntityID; + + uint16_t _padding3; + + Vector3Double _targetLocation; + + public: + LaunchedMunitionRecord(); + virtual ~LaunchedMunitionRecord(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EventIdentifier& getFireEventID(); + const EventIdentifier& getFireEventID() const; + void setFireEventID(const EventIdentifier& pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + EventIdentifier& getFiringEntityID(); + const EventIdentifier& getFiringEntityID() const; + void setFiringEntityID(const EventIdentifier& pX); + + uint16_t getPadding2() const; + void setPadding2(uint16_t pX); + + EventIdentifier& getTargetEntityID(); + const EventIdentifier& getTargetEntityID() const; + void setTargetEntityID(const EventIdentifier& pX); + + uint16_t getPadding3() const; + void setPadding3(uint16_t pX); + + Vector3Double& getTargetLocation(); + const Vector3Double& getTargetLocation() const; + void setTargetLocation(const Vector3Double& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LaunchedMunitionRecord& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/LiveEntityIdentifier.cpp b/src/dis7/common/LiveEntityIdentifier.cpp new file mode 100644 index 00000000..9197bc64 --- /dev/null +++ b/src/dis7/common/LiveEntityIdentifier.cpp @@ -0,0 +1,91 @@ +#include "dis7/LiveEntityIdentifier.h" + +using namespace DIS; + +LiveEntityIdentifier::LiveEntityIdentifier() + : _liveSimulationAddress(), _entityNumber(0) {} + +LiveEntityIdentifier::~LiveEntityIdentifier() {} + +LiveSimulationAddress& LiveEntityIdentifier::getLiveSimulationAddress() { + return _liveSimulationAddress; +} + +const LiveSimulationAddress& LiveEntityIdentifier::getLiveSimulationAddress() + const { + return _liveSimulationAddress; +} + +void LiveEntityIdentifier::setLiveSimulationAddress( + const LiveSimulationAddress& pX) { + _liveSimulationAddress = pX; +} + +uint16_t LiveEntityIdentifier::getEntityNumber() const { + return _entityNumber; +} + +void LiveEntityIdentifier::setEntityNumber(uint16_t pX) { + _entityNumber = pX; +} + +void LiveEntityIdentifier::marshal(DataStream& dataStream) const { + _liveSimulationAddress.marshal(dataStream); + dataStream << _entityNumber; +} + +void LiveEntityIdentifier::unmarshal(DataStream& dataStream) { + _liveSimulationAddress.unmarshal(dataStream); + dataStream >> _entityNumber; +} + +bool LiveEntityIdentifier::operator==(const LiveEntityIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_liveSimulationAddress == rhs._liveSimulationAddress)) + ivarsEqual = false; + if (!(_entityNumber == rhs._entityNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int LiveEntityIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + + _liveSimulationAddress.getMarshalledSize(); // _liveSimulationAddress + marshalSize = marshalSize + 2; // _entityNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/LiveEntityIdentifier.h b/src/dis7/common/LiveEntityIdentifier.h new file mode 100644 index 00000000..dbd7cbb5 --- /dev/null +++ b/src/dis7/common/LiveEntityIdentifier.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis7/LiveSimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of each entity in an event or exercise that is +// contained in a Live Entity PDU. Section 6.2.54 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT LiveEntityIdentifier { + protected: + /** Live Simulation Address record (see 6.2.55) */ + LiveSimulationAddress _liveSimulationAddress; + + /** Live entity number */ + uint16_t _entityNumber; + + public: + LiveEntityIdentifier(); + virtual ~LiveEntityIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + LiveSimulationAddress& getLiveSimulationAddress(); + const LiveSimulationAddress& getLiveSimulationAddress() const; + void setLiveSimulationAddress(const LiveSimulationAddress& pX); + + uint16_t getEntityNumber() const; + void setEntityNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LiveEntityIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/LiveEntityPdu.cpp b/src/dis7/common/LiveEntityPdu.cpp new file mode 100644 index 00000000..56be7710 --- /dev/null +++ b/src/dis7/common/LiveEntityPdu.cpp @@ -0,0 +1,85 @@ +#include "dis7/LiveEntityPdu.h" + +using namespace DIS; + +LiveEntityPdu::LiveEntityPdu() + : PduSuperclass(), _subprotocolNumber(0), _padding(0) {} + +LiveEntityPdu::~LiveEntityPdu() {} + +uint16_t LiveEntityPdu::getSubprotocolNumber() const { + return _subprotocolNumber; +} + +void LiveEntityPdu::setSubprotocolNumber(uint16_t pX) { + _subprotocolNumber = pX; +} + +uint8_t LiveEntityPdu::getPadding() const { return _padding; } + +void LiveEntityPdu::setPadding(uint8_t pX) { _padding = pX; } + +void LiveEntityPdu::marshal(DataStream& dataStream) const { + PduSuperclass::marshal( + dataStream); // Marshal information in superclass first + dataStream << _subprotocolNumber; + dataStream << _padding; +} + +void LiveEntityPdu::unmarshal(DataStream& dataStream) { + PduSuperclass::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _subprotocolNumber; + dataStream >> _padding; +} + +bool LiveEntityPdu::operator==(const LiveEntityPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = PduSuperclass::operator==(rhs); + + if (!(_subprotocolNumber == rhs._subprotocolNumber)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int LiveEntityPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = PduSuperclass::getMarshalledSize(); + marshalSize = marshalSize + 2; // _subprotocolNumber + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/LiveEntityPdu.h b/src/dis7/common/LiveEntityPdu.h new file mode 100644 index 00000000..103d7674 --- /dev/null +++ b/src/dis7/common/LiveEntityPdu.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/PduSuperclass.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The live entity PDUs have a header with some different field names, but the +// same length. Section 9.3.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT LiveEntityPdu : public PduSuperclass { + protected: + /** Subprotocol used to decode the PDU. Section 13 of EBV. */ + uint16_t _subprotocolNumber; + + /** zero-filled array of padding */ + uint8_t _padding; + + public: + LiveEntityPdu(); + virtual ~LiveEntityPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSubprotocolNumber() const; + void setSubprotocolNumber(uint16_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LiveEntityPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/LiveSimulationAddress.cpp b/src/dis7/common/LiveSimulationAddress.cpp new file mode 100644 index 00000000..74eaa255 --- /dev/null +++ b/src/dis7/common/LiveSimulationAddress.cpp @@ -0,0 +1,83 @@ +#include "dis7/LiveSimulationAddress.h" + +using namespace DIS; + +LiveSimulationAddress::LiveSimulationAddress() + : _liveSiteNumber(0), _liveApplicationNumber(0) {} + +LiveSimulationAddress::~LiveSimulationAddress() {} + +uint8_t LiveSimulationAddress::getLiveSiteNumber() const { + return _liveSiteNumber; +} + +void LiveSimulationAddress::setLiveSiteNumber(uint8_t pX) { + _liveSiteNumber = pX; +} + +uint16_t LiveSimulationAddress::getLiveApplicationNumber() const { + return _liveApplicationNumber; +} + +void LiveSimulationAddress::setLiveApplicationNumber(uint16_t pX) { + _liveApplicationNumber = pX; +} + +void LiveSimulationAddress::marshal(DataStream& dataStream) const { + dataStream << _liveSiteNumber; + dataStream << _liveApplicationNumber; +} + +void LiveSimulationAddress::unmarshal(DataStream& dataStream) { + dataStream >> _liveSiteNumber; + dataStream >> _liveApplicationNumber; +} + +bool LiveSimulationAddress::operator==(const LiveSimulationAddress& rhs) const { + bool ivarsEqual = true; + + if (!(_liveSiteNumber == rhs._liveSiteNumber)) ivarsEqual = false; + if (!(_liveApplicationNumber == rhs._liveApplicationNumber)) + ivarsEqual = false; + + return ivarsEqual; +} + +int LiveSimulationAddress::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _liveSiteNumber + marshalSize = marshalSize + 2; // _liveApplicationNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/LiveSimulationAddress.h b/src/dis7/common/LiveSimulationAddress.h new file mode 100644 index 00000000..4c9b270e --- /dev/null +++ b/src/dis7/common/LiveSimulationAddress.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// A simulation's designation associated with all Live Entity IDs contained in +// Live Entity PDUs. Section 6.2.55 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT LiveSimulationAddress { + protected: + /** facility, installation, organizational unit or geographic location may + * have multiple sites associated with it. The Site Number is the first + * component of the Live Simulation Address, which defines a live simulation. + */ + uint8_t _liveSiteNumber; + + /** An application associated with a live site is termed a live application. + * Each live application participating in an event */ + uint16_t _liveApplicationNumber; + + public: + LiveSimulationAddress(); + virtual ~LiveSimulationAddress(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getLiveSiteNumber() const; + void setLiveSiteNumber(uint8_t pX); + + uint16_t getLiveApplicationNumber() const; + void setLiveApplicationNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LiveSimulationAddress& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/MineEntityIdentifier.cpp b/src/dis7/common/MineEntityIdentifier.cpp new file mode 100644 index 00000000..bbb1a053 --- /dev/null +++ b/src/dis7/common/MineEntityIdentifier.cpp @@ -0,0 +1,87 @@ +#include "dis7/MineEntityIdentifier.h" + +using namespace DIS; + +MineEntityIdentifier::MineEntityIdentifier() + : _simulationAddress(), _mineEntityNumber(0) {} + +MineEntityIdentifier::~MineEntityIdentifier() {} + +SimulationAddress& MineEntityIdentifier::getSimulationAddress() { + return _simulationAddress; +} + +const SimulationAddress& MineEntityIdentifier::getSimulationAddress() const { + return _simulationAddress; +} + +void MineEntityIdentifier::setSimulationAddress(const SimulationAddress& pX) { + _simulationAddress = pX; +} + +uint16_t MineEntityIdentifier::getMineEntityNumber() const { + return _mineEntityNumber; +} + +void MineEntityIdentifier::setMineEntityNumber(uint16_t pX) { + _mineEntityNumber = pX; +} + +void MineEntityIdentifier::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _mineEntityNumber; +} + +void MineEntityIdentifier::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _mineEntityNumber; +} + +bool MineEntityIdentifier::operator==(const MineEntityIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_mineEntityNumber == rhs._mineEntityNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int MineEntityIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _mineEntityNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/MineEntityIdentifier.h b/src/dis7/common/MineEntityIdentifier.h new file mode 100644 index 00000000..2d3bb65e --- /dev/null +++ b/src/dis7/common/MineEntityIdentifier.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of a mine contained in the Minefield Data PDU. No +// espdus are issued for mine entities. Section 6.2.56 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT MineEntityIdentifier { + protected: + /** */ + SimulationAddress _simulationAddress; + + /** */ + uint16_t _mineEntityNumber; + + public: + MineEntityIdentifier(); + virtual ~MineEntityIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getSimulationAddress(); + const SimulationAddress& getSimulationAddress() const; + void setSimulationAddress(const SimulationAddress& pX); + + uint16_t getMineEntityNumber() const; + void setMineEntityNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MineEntityIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/ModulationParameters.cpp b/src/dis7/common/ModulationParameters.cpp similarity index 79% rename from src/dis7/ModulationParameters.cpp rename to src/dis7/common/ModulationParameters.cpp index 0f181afd..ae3d216d 100644 --- a/src/dis7/ModulationParameters.cpp +++ b/src/dis7/common/ModulationParameters.cpp @@ -1,45 +1,32 @@ -#include +#include "dis7/ModulationParameters.h" using namespace DIS; +ModulationParameters::ModulationParameters() {} -ModulationParameters::ModulationParameters() -{ -} - -ModulationParameters::~ModulationParameters() -{ -} - -void ModulationParameters::marshal(DataStream& dataStream) const -{ -} - -void ModulationParameters::unmarshal(DataStream& dataStream) -{ -} +ModulationParameters::~ModulationParameters() {} +void ModulationParameters::marshal(DataStream& dataStream) const {} -bool ModulationParameters::operator ==(const ModulationParameters& rhs) const - { - bool ivarsEqual = true; +void ModulationParameters::unmarshal(DataStream& dataStream) {} +bool ModulationParameters::operator==(const ModulationParameters& rhs) const { + bool ivarsEqual = true; - return ivarsEqual; - } + return ivarsEqual; +} -int ModulationParameters::getMarshalledSize() const -{ - int marshalSize = 0; +int ModulationParameters::getMarshalledSize() const { + int marshalSize = 0; - return marshalSize; + return marshalSize; } // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright @@ -52,7 +39,7 @@ int ModulationParameters::getMarshalledSize() const // nor the names of its contributors may be used to endorse or // promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/src/dis7/ModulationParameters.h b/src/dis7/common/ModulationParameters.h similarity index 79% rename from src/dis7/ModulationParameters.h rename to src/dis7/common/ModulationParameters.h index 0adfd44d..ee65c796 100644 --- a/src/dis7/ModulationParameters.h +++ b/src/dis7/common/ModulationParameters.h @@ -1,40 +1,37 @@ #pragma once -#include -#include +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" +namespace DIS { +// Modulation parameters associated with a specific radio system. +// INCOMPLETE. 6.2.58 -namespace DIS -{ -// Modulation parameters associated with a specific radio system. INCOMPLETE. 6.2.58 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. // // @author DMcG, jkg -class OPENDIS7_EXPORT ModulationParameters -{ -protected: - +class OPENDIS7_EXPORT ModulationParameters { + protected: public: - ModulationParameters(); - virtual ~ModulationParameters(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); + ModulationParameters(); + virtual ~ModulationParameters(); + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); -virtual int getMarshalledSize() const; + virtual int getMarshalledSize() const; - bool operator ==(const ModulationParameters& rhs) const; + bool operator==(const ModulationParameters& rhs) const; }; -} +} // namespace DIS // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright @@ -47,7 +44,7 @@ virtual int getMarshalledSize() const; // nor the names of its contributors may be used to endorse or // promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/src/dis7/common/ModulationType.cpp b/src/dis7/common/ModulationType.cpp new file mode 100644 index 00000000..dc7c2037 --- /dev/null +++ b/src/dis7/common/ModulationType.cpp @@ -0,0 +1,98 @@ +#include "dis7/ModulationType.h" + +using namespace DIS; + +ModulationType::ModulationType() + : _spreadSpectrum(0), _majorModulation(0), _detail(0), _radioSystem(0) {} + +ModulationType::~ModulationType() {} + +uint16_t ModulationType::getSpreadSpectrum() const { + return _spreadSpectrum; +} + +void ModulationType::setSpreadSpectrum(uint16_t pX) { + _spreadSpectrum = pX; +} + +uint16_t ModulationType::getMajorModulation() const { + return _majorModulation; +} + +void ModulationType::setMajorModulation(uint16_t pX) { + _majorModulation = pX; +} + +uint16_t ModulationType::getDetail() const { return _detail; } + +void ModulationType::setDetail(uint16_t pX) { _detail = pX; } + +uint16_t ModulationType::getRadioSystem() const { return _radioSystem; } + +void ModulationType::setRadioSystem(uint16_t pX) { _radioSystem = pX; } + +void ModulationType::marshal(DataStream& dataStream) const { + dataStream << _spreadSpectrum; + dataStream << _majorModulation; + dataStream << _detail; + dataStream << _radioSystem; +} + +void ModulationType::unmarshal(DataStream& dataStream) { + dataStream >> _spreadSpectrum; + dataStream >> _majorModulation; + dataStream >> _detail; + dataStream >> _radioSystem; +} + +bool ModulationType::operator==(const ModulationType& rhs) const { + bool ivarsEqual = true; + + if (!(_spreadSpectrum == rhs._spreadSpectrum)) ivarsEqual = false; + if (!(_majorModulation == rhs._majorModulation)) ivarsEqual = false; + if (!(_detail == rhs._detail)) ivarsEqual = false; + if (!(_radioSystem == rhs._radioSystem)) ivarsEqual = false; + + return ivarsEqual; +} + +int ModulationType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _spreadSpectrum + marshalSize = marshalSize + 2; // _majorModulation + marshalSize = marshalSize + 2; // _detail + marshalSize = marshalSize + 2; // _radioSystem + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ModulationType.h b/src/dis7/common/ModulationType.h new file mode 100644 index 00000000..4b1ae5f1 --- /dev/null +++ b/src/dis7/common/ModulationType.h @@ -0,0 +1,86 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about the type of modulation used for radio transmission. 6.2.59 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ModulationType { + protected: + /** This field shall indicate the spread spectrum technique or combination of + * spread spectrum techniques in use. Bt field. */ + uint16_t _spreadSpectrum; + + /** the major classification of the modulation type. */ + uint16_t _majorModulation; + + /** provide certain detailed information depending upon the major modulation + * type */ + uint16_t _detail; + + /** the radio system associated with this Transmitter PDU and shall be used as + * the basis to interpret other fields whose values depend on a specific radio + * system. */ + uint16_t _radioSystem; + + public: + ModulationType(); + virtual ~ModulationType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSpreadSpectrum() const; + void setSpreadSpectrum(uint16_t pX); + + uint16_t getMajorModulation() const; + void setMajorModulation(uint16_t pX); + + uint16_t getDetail() const; + void setDetail(uint16_t pX); + + uint16_t getRadioSystem() const; + void setRadioSystem(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ModulationType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Munition.cpp b/src/dis7/common/Munition.cpp new file mode 100644 index 00000000..372ce28d --- /dev/null +++ b/src/dis7/common/Munition.cpp @@ -0,0 +1,105 @@ +#include "dis7/Munition.h" + +using namespace DIS; + +Munition::Munition() + : _munitionType(), + _station(0), + _quantity(0), + _munitionStatus(0), + _padding(0) {} + +Munition::~Munition() {} + +EntityType& Munition::getMunitionType() { return _munitionType; } + +const EntityType& Munition::getMunitionType() const { return _munitionType; } + +void Munition::setMunitionType(const EntityType& pX) { _munitionType = pX; } + +uint32_t Munition::getStation() const { return _station; } + +void Munition::setStation(uint32_t pX) { _station = pX; } + +uint16_t Munition::getQuantity() const { return _quantity; } + +void Munition::setQuantity(uint16_t pX) { _quantity = pX; } + +uint8_t Munition::getMunitionStatus() const { return _munitionStatus; } + +void Munition::setMunitionStatus(uint8_t pX) { _munitionStatus = pX; } + +uint8_t Munition::getPadding() const { return _padding; } + +void Munition::setPadding(uint8_t pX) { _padding = pX; } + +void Munition::marshal(DataStream& dataStream) const { + _munitionType.marshal(dataStream); + dataStream << _station; + dataStream << _quantity; + dataStream << _munitionStatus; + dataStream << _padding; +} + +void Munition::unmarshal(DataStream& dataStream) { + _munitionType.unmarshal(dataStream); + dataStream >> _station; + dataStream >> _quantity; + dataStream >> _munitionStatus; + dataStream >> _padding; +} + +bool Munition::operator==(const Munition& rhs) const { + bool ivarsEqual = true; + + if (!(_munitionType == rhs._munitionType)) ivarsEqual = false; + if (!(_station == rhs._station)) ivarsEqual = false; + if (!(_quantity == rhs._quantity)) ivarsEqual = false; + if (!(_munitionStatus == rhs._munitionStatus)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int Munition::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _munitionType.getMarshalledSize(); // _munitionType + marshalSize = marshalSize + 4; // _station + marshalSize = marshalSize + 2; // _quantity + marshalSize = marshalSize + 1; // _munitionStatus + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Munition.h b/src/dis7/common/Munition.h new file mode 100644 index 00000000..83b2d33b --- /dev/null +++ b/src/dis7/common/Munition.h @@ -0,0 +1,95 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// An entity's munition (e.g., bomb, missile) information shall be represented +// by one or more Munition records. For each type or location of munition, this +// record shall specify the type, location, quantity and status of munitions +// that an entity contains. Section 6.2.60 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Munition { + protected: + /** This field shall identify the entity type of the munition. See + * section 6.2.30. */ + EntityType _munitionType; + + /** the station or launcher to which the munition is assigned. See Annex I */ + uint32_t _station; + + /** the quantity remaining of this munition. */ + uint16_t _quantity; + + /** the status of the munition. It shall be represented by an 8-bit + * enumeration. */ + uint8_t _munitionStatus; + + /** padding */ + uint8_t _padding; + + public: + Munition(); + virtual ~Munition(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getMunitionType(); + const EntityType& getMunitionType() const; + void setMunitionType(const EntityType& pX); + + uint32_t getStation() const; + void setStation(uint32_t pX); + + uint16_t getQuantity() const; + void setQuantity(uint16_t pX); + + uint8_t getMunitionStatus() const; + void setMunitionStatus(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Munition& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/MunitionReload.cpp b/src/dis7/common/MunitionReload.cpp new file mode 100644 index 00000000..e444ea8a --- /dev/null +++ b/src/dis7/common/MunitionReload.cpp @@ -0,0 +1,130 @@ +#include "dis7/MunitionReload.h" + +using namespace DIS; + +MunitionReload::MunitionReload() + : _munitionType(), + _station(0), + _standardQuantity(0), + _maximumQuantity(0), + _stationName(0), + _stationNumber(0) {} + +MunitionReload::~MunitionReload() {} + +EntityType& MunitionReload::getMunitionType() { return _munitionType; } + +const EntityType& MunitionReload::getMunitionType() const { + return _munitionType; +} + +void MunitionReload::setMunitionType(const EntityType& pX) { + _munitionType = pX; +} + +uint32_t MunitionReload::getStation() const { return _station; } + +void MunitionReload::setStation(uint32_t pX) { _station = pX; } + +uint16_t MunitionReload::getStandardQuantity() const { + return _standardQuantity; +} + +void MunitionReload::setStandardQuantity(uint16_t pX) { + _standardQuantity = pX; +} + +uint16_t MunitionReload::getMaximumQuantity() const { + return _maximumQuantity; +} + +void MunitionReload::setMaximumQuantity(uint16_t pX) { + _maximumQuantity = pX; +} + +uint16_t MunitionReload::getStationName() const { return _stationName; } + +void MunitionReload::setStationName(uint16_t pX) { _stationName = pX; } + +uint16_t MunitionReload::getStationNumber() const { + return _stationNumber; +} + +void MunitionReload::setStationNumber(uint16_t pX) { + _stationNumber = pX; +} + +void MunitionReload::marshal(DataStream& dataStream) const { + _munitionType.marshal(dataStream); + dataStream << _station; + dataStream << _standardQuantity; + dataStream << _maximumQuantity; + dataStream << _stationName; + dataStream << _stationNumber; +} + +void MunitionReload::unmarshal(DataStream& dataStream) { + _munitionType.unmarshal(dataStream); + dataStream >> _station; + dataStream >> _standardQuantity; + dataStream >> _maximumQuantity; + dataStream >> _stationName; + dataStream >> _stationNumber; +} + +bool MunitionReload::operator==(const MunitionReload& rhs) const { + bool ivarsEqual = true; + + if (!(_munitionType == rhs._munitionType)) ivarsEqual = false; + if (!(_station == rhs._station)) ivarsEqual = false; + if (!(_standardQuantity == rhs._standardQuantity)) ivarsEqual = false; + if (!(_maximumQuantity == rhs._maximumQuantity)) ivarsEqual = false; + if (!(_stationName == rhs._stationName)) ivarsEqual = false; + if (!(_stationNumber == rhs._stationNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int MunitionReload::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _munitionType.getMarshalledSize(); // _munitionType + marshalSize = marshalSize + 4; // _station + marshalSize = marshalSize + 2; // _standardQuantity + marshalSize = marshalSize + 2; // _maximumQuantity + marshalSize = marshalSize + 2; // _stationName + marshalSize = marshalSize + 2; // _stationNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/MunitionReload.h b/src/dis7/common/MunitionReload.h new file mode 100644 index 00000000..10377d26 --- /dev/null +++ b/src/dis7/common/MunitionReload.h @@ -0,0 +1,101 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// indicate weapons (munitions) previously communicated via the Munition record. +// Section 6.2.61 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT MunitionReload { + protected: + /** This field shall identify the entity type of the munition. See + * section 6.2.30. */ + EntityType _munitionType; + + /** the station or launcher to which the munition is assigned. See Annex I */ + uint32_t _station; + + /** the standard quantity of this munition type normally loaded at this + * station/launcher if a station/launcher is specified. */ + uint16_t _standardQuantity; + + /** the maximum quantity of this munition type that this station/launcher is + * capable of holding when a station/launcher is specified */ + uint16_t _maximumQuantity; + + /** the station name within the host at which the part entity is located. */ + uint16_t _stationName; + + /** the number of the particular wing station, cargo hold etc., at which the + * part is attached. */ + uint16_t _stationNumber; + + public: + MunitionReload(); + virtual ~MunitionReload(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getMunitionType(); + const EntityType& getMunitionType() const; + void setMunitionType(const EntityType& pX); + + uint32_t getStation() const; + void setStation(uint32_t pX); + + uint16_t getStandardQuantity() const; + void setStandardQuantity(uint16_t pX); + + uint16_t getMaximumQuantity() const; + void setMaximumQuantity(uint16_t pX); + + uint16_t getStationName() const; + void setStationName(uint16_t pX); + + uint16_t getStationNumber() const; + void setStationNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MunitionReload& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ObjectIdentifier.cpp b/src/dis7/common/ObjectIdentifier.cpp new file mode 100644 index 00000000..783ead40 --- /dev/null +++ b/src/dis7/common/ObjectIdentifier.cpp @@ -0,0 +1,86 @@ +#include "dis7/ObjectIdentifier.h" + +using namespace DIS; + +ObjectIdentifier::ObjectIdentifier() : _simulationAddress(), _objectNumber(0) {} + +ObjectIdentifier::~ObjectIdentifier() {} + +SimulationAddress& ObjectIdentifier::getSimulationAddress() { + return _simulationAddress; +} + +const SimulationAddress& ObjectIdentifier::getSimulationAddress() const { + return _simulationAddress; +} + +void ObjectIdentifier::setSimulationAddress(const SimulationAddress& pX) { + _simulationAddress = pX; +} + +uint16_t ObjectIdentifier::getObjectNumber() const { + return _objectNumber; +} + +void ObjectIdentifier::setObjectNumber(uint16_t pX) { + _objectNumber = pX; +} + +void ObjectIdentifier::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _objectNumber; +} + +void ObjectIdentifier::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _objectNumber; +} + +bool ObjectIdentifier::operator==(const ObjectIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_objectNumber == rhs._objectNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int ObjectIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _objectNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/ObjectIdentifier.h b/src/dis7/common/ObjectIdentifier.h new file mode 100644 index 00000000..2817bd84 --- /dev/null +++ b/src/dis7/common/ObjectIdentifier.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of an environmental object. Section 6.2.63 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ObjectIdentifier { + protected: + /** Simulation Address */ + SimulationAddress _simulationAddress; + + /** */ + uint16_t _objectNumber; + + public: + ObjectIdentifier(); + virtual ~ObjectIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getSimulationAddress(); + const SimulationAddress& getSimulationAddress() const; + void setSimulationAddress(const SimulationAddress& pX); + + uint16_t getObjectNumber() const; + void setObjectNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ObjectIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/OwnershipStatus.cpp b/src/dis7/common/OwnershipStatus.cpp new file mode 100644 index 00000000..b9ad2b4b --- /dev/null +++ b/src/dis7/common/OwnershipStatus.cpp @@ -0,0 +1,88 @@ +#include "dis7/OwnershipStatus.h" + +using namespace DIS; + +OwnershipStatus::OwnershipStatus() + : _entityId(), _ownershipStatus(0), _padding(0) {} + +OwnershipStatus::~OwnershipStatus() {} + +EntityID& OwnershipStatus::getEntityId() { return _entityId; } + +const EntityID& OwnershipStatus::getEntityId() const { return _entityId; } + +void OwnershipStatus::setEntityId(const EntityID& pX) { _entityId = pX; } + +uint8_t OwnershipStatus::getOwnershipStatus() const { + return _ownershipStatus; +} + +void OwnershipStatus::setOwnershipStatus(uint8_t pX) { + _ownershipStatus = pX; +} + +uint8_t OwnershipStatus::getPadding() const { return _padding; } + +void OwnershipStatus::setPadding(uint8_t pX) { _padding = pX; } + +void OwnershipStatus::marshal(DataStream& dataStream) const { + _entityId.marshal(dataStream); + dataStream << _ownershipStatus; + dataStream << _padding; +} + +void OwnershipStatus::unmarshal(DataStream& dataStream) { + _entityId.unmarshal(dataStream); + dataStream >> _ownershipStatus; + dataStream >> _padding; +} + +bool OwnershipStatus::operator==(const OwnershipStatus& rhs) const { + bool ivarsEqual = true; + + if (!(_entityId == rhs._entityId)) ivarsEqual = false; + if (!(_ownershipStatus == rhs._ownershipStatus)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int OwnershipStatus::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _entityId.getMarshalledSize(); // _entityId + marshalSize = marshalSize + 1; // _ownershipStatus + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/OwnershipStatus.h b/src/dis7/common/OwnershipStatus.h new file mode 100644 index 00000000..28fa75cf --- /dev/null +++ b/src/dis7/common/OwnershipStatus.h @@ -0,0 +1,80 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// used to convey entity and conflict status information associated with +// transferring ownership of an entity. Section 6.2.65 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT OwnershipStatus { + protected: + /** EntityID */ + EntityID _entityId; + + /** The ownership and/or ownership conflict status of the entity represented + * by the Entity ID field. */ + uint8_t _ownershipStatus; + + /** padding */ + uint8_t _padding; + + public: + OwnershipStatus(); + virtual ~OwnershipStatus(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityId(); + const EntityID& getEntityId() const; + void setEntityId(const EntityID& pX); + + uint8_t getOwnershipStatus() const; + void setOwnershipStatus(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const OwnershipStatus& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Pdu.cpp b/src/dis7/common/Pdu.cpp new file mode 100644 index 00000000..0d5effa4 --- /dev/null +++ b/src/dis7/common/Pdu.cpp @@ -0,0 +1,80 @@ +#include "dis7/Pdu.h" + +using namespace DIS; + +Pdu::Pdu() : PduSuperclass(), _pduStatus(0), _padding(0) {} + +Pdu::~Pdu() {} + +uint8_t Pdu::getPduStatus() const { return _pduStatus; } + +void Pdu::setPduStatus(uint8_t pX) { _pduStatus = pX; } + +uint8_t Pdu::getPadding() const { return _padding; } + +void Pdu::setPadding(uint8_t pX) { _padding = pX; } + +void Pdu::marshal(DataStream& dataStream) const { + PduSuperclass::marshal( + dataStream); // Marshal information in superclass first + dataStream << _pduStatus; + dataStream << _padding; +} + +void Pdu::unmarshal(DataStream& dataStream) { + PduSuperclass::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _pduStatus; + dataStream >> _padding; +} + +bool Pdu::operator==(const Pdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = PduSuperclass::operator==(rhs); + + if (!(_pduStatus == rhs._pduStatus)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int Pdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = PduSuperclass::getMarshalledSize(); + marshalSize = marshalSize + 1; // _pduStatus + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Pdu.h b/src/dis7/common/Pdu.h new file mode 100644 index 00000000..bb2f22c8 --- /dev/null +++ b/src/dis7/common/Pdu.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/PduSuperclass.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Adds some fields to the the classic PDU + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Pdu : public PduSuperclass { + protected: + /** PDU Status Record. Described in 6.2.67. This field is not present in + * earlier DIS versions */ + uint8_t _pduStatus; + + /** zero-filled array of padding */ + uint8_t _padding; + + public: + Pdu(); + virtual ~Pdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getPduStatus() const; + void setPduStatus(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Pdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/PduContainer.cpp b/src/dis7/common/PduContainer.cpp new file mode 100644 index 00000000..87337902 --- /dev/null +++ b/src/dis7/common/PduContainer.cpp @@ -0,0 +1,89 @@ +#include "dis7/PduContainer.h" + +using namespace DIS; + +PduContainer::PduContainer() : _numberOfPdus(0) {} + +PduContainer::~PduContainer() { _pdus.clear(); } + +uint32_t PduContainer::getNumberOfPdus() const { return _pdus.size(); } + +std::vector& PduContainer::getPdus() { return _pdus; } + +const std::vector& PduContainer::getPdus() const { return _pdus; } + +void PduContainer::setPdus(const std::vector& pX) { _pdus = pX; } + +void PduContainer::marshal(DataStream& dataStream) const { + dataStream << (int)_pdus.size(); + + for (size_t idx = 0; idx < _pdus.size(); idx++) { + Pdu x = _pdus[idx]; + x.marshal(dataStream); + } +} + +void PduContainer::unmarshal(DataStream& dataStream) { + dataStream >> _numberOfPdus; + + _pdus.clear(); + for (size_t idx = 0; idx < _numberOfPdus; idx++) { + Pdu x; + x.unmarshal(dataStream); + _pdus.push_back(x); + } +} + +bool PduContainer::operator==(const PduContainer& rhs) const { + bool ivarsEqual = true; + + for (size_t idx = 0; idx < _pdus.size(); idx++) { + if (!(_pdus[idx] == rhs._pdus[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int PduContainer::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _numberOfPdus + + for (uint64_t idx = 0; idx < _pdus.size(); idx++) { + Pdu listElement = _pdus[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/PduContainer.h b/src/dis7/common/PduContainer.h new file mode 100644 index 00000000..d06ca539 --- /dev/null +++ b/src/dis7/common/PduContainer.h @@ -0,0 +1,73 @@ +#pragma once + +#include + +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Used for XML compatability. A container that holds PDUs + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT PduContainer { + protected: + /** Number of PDUs in the container list */ + uint32_t _numberOfPdus; + + /** record sets */ + std::vector _pdus; + + public: + PduContainer(); + virtual ~PduContainer(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfPdus() const; + + std::vector& getPdus(); + const std::vector& getPdus() const; + void setPdus(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const PduContainer& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/PduHeader.cpp b/src/dis7/common/PduHeader.cpp new file mode 100644 index 00000000..f8d800c4 --- /dev/null +++ b/src/dis7/common/PduHeader.cpp @@ -0,0 +1,129 @@ +#include "dis7/PduHeader.h" + +using namespace DIS; + +PduHeader::PduHeader() + : _protocolVersion(7), + _exerciseID(0), + _pduType(0), + _protocolFamily(0), + _timestamp(0), + _pduLength(0), + _pduStatus(0), + _padding(0) {} + +PduHeader::~PduHeader() {} + +uint8_t PduHeader::getProtocolVersion() const { return _protocolVersion; } + +void PduHeader::setProtocolVersion(uint8_t pX) { _protocolVersion = pX; } + +uint8_t PduHeader::getExerciseID() const { return _exerciseID; } + +void PduHeader::setExerciseID(uint8_t pX) { _exerciseID = pX; } + +uint8_t PduHeader::getPduType() const { return _pduType; } + +void PduHeader::setPduType(uint8_t pX) { _pduType = pX; } + +uint8_t PduHeader::getProtocolFamily() const { return _protocolFamily; } + +void PduHeader::setProtocolFamily(uint8_t pX) { _protocolFamily = pX; } + +uint32_t PduHeader::getTimestamp() const { return _timestamp; } + +void PduHeader::setTimestamp(uint32_t pX) { _timestamp = pX; } + +uint8_t PduHeader::getPduLength() const { return _pduLength; } + +void PduHeader::setPduLength(uint8_t pX) { _pduLength = pX; } + +uint16_t PduHeader::getPduStatus() const { return _pduStatus; } + +void PduHeader::setPduStatus(uint16_t pX) { _pduStatus = pX; } + +uint8_t PduHeader::getPadding() const { return _padding; } + +void PduHeader::setPadding(uint8_t pX) { _padding = pX; } + +void PduHeader::marshal(DataStream& dataStream) const { + dataStream << _protocolVersion; + dataStream << _exerciseID; + dataStream << _pduType; + dataStream << _protocolFamily; + dataStream << _timestamp; + dataStream << _pduLength; + dataStream << _pduStatus; + dataStream << _padding; +} + +void PduHeader::unmarshal(DataStream& dataStream) { + dataStream >> _protocolVersion; + dataStream >> _exerciseID; + dataStream >> _pduType; + dataStream >> _protocolFamily; + dataStream >> _timestamp; + dataStream >> _pduLength; + dataStream >> _pduStatus; + dataStream >> _padding; +} + +bool PduHeader::operator==(const PduHeader& rhs) const { + bool ivarsEqual = true; + + if (!(_protocolVersion == rhs._protocolVersion)) ivarsEqual = false; + if (!(_exerciseID == rhs._exerciseID)) ivarsEqual = false; + if (!(_pduType == rhs._pduType)) ivarsEqual = false; + if (!(_protocolFamily == rhs._protocolFamily)) ivarsEqual = false; + if (!(_timestamp == rhs._timestamp)) ivarsEqual = false; + if (!(_pduLength == rhs._pduLength)) ivarsEqual = false; + if (!(_pduStatus == rhs._pduStatus)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int PduHeader::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _protocolVersion + marshalSize = marshalSize + 1; // _exerciseID + marshalSize = marshalSize + 1; // _pduType + marshalSize = marshalSize + 1; // _protocolFamily + marshalSize = marshalSize + 4; // _timestamp + marshalSize = marshalSize + 1; // _pduLength + marshalSize = marshalSize + 2; // _pduStatus + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/PduHeader.h b/src/dis7/common/PduHeader.h new file mode 100644 index 00000000..8c63413b --- /dev/null +++ b/src/dis7/common/PduHeader.h @@ -0,0 +1,109 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Not used. The PDU Header Record is directly incoroporated into the PDU class. +// Here for completness only. Section 6.2.66 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT PduHeader { + protected: + /** The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2009. */ + uint8_t _protocolVersion; + + /** Exercise ID */ + uint8_t _exerciseID; + + /** Type of pdu, unique for each PDU class */ + uint8_t _pduType; + + /** value that refers to the protocol family, eg SimulationManagement, etc */ + uint8_t _protocolFamily; + + /** Timestamp value */ + uint32_t _timestamp; + + /** Length, in bytes, of the PDU. Changed name from length to avoid use of + * Hibernate QL reserved word. */ + uint8_t _pduLength; + + /** PDU Status Record. Described in 6.2.67. This field is not present in + * earlier DIS versions */ + uint16_t _pduStatus; + + /** zero filled array of padding */ + uint8_t _padding; + + public: + PduHeader(); + virtual ~PduHeader(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getProtocolVersion() const; + void setProtocolVersion(uint8_t pX); + + uint8_t getExerciseID() const; + void setExerciseID(uint8_t pX); + + uint8_t getPduType() const; + void setPduType(uint8_t pX); + + uint8_t getProtocolFamily() const; + void setProtocolFamily(uint8_t pX); + + uint32_t getTimestamp() const; + void setTimestamp(uint32_t pX); + + uint8_t getPduLength() const; + void setPduLength(uint8_t pX); + + uint16_t getPduStatus() const; + void setPduStatus(uint16_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const PduHeader& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/PduStatus.cpp b/src/dis7/common/PduStatus.cpp new file mode 100644 index 00000000..f1e59bc7 --- /dev/null +++ b/src/dis7/common/PduStatus.cpp @@ -0,0 +1,63 @@ +#include "dis7/PduStatus.h" + +using namespace DIS; + +PduStatus::PduStatus() : _pduStatus(0) {} + +PduStatus::~PduStatus() {} + +uint8_t PduStatus::getPduStatus() const { return _pduStatus; } + +void PduStatus::setPduStatus(uint8_t pX) { _pduStatus = pX; } + +void PduStatus::marshal(DataStream& dataStream) const { + dataStream << _pduStatus; +} + +void PduStatus::unmarshal(DataStream& dataStream) { dataStream >> _pduStatus; } + +bool PduStatus::operator==(const PduStatus& rhs) const { + bool ivarsEqual = true; + + if (!(_pduStatus == rhs._pduStatus)) ivarsEqual = false; + + return ivarsEqual; +} + +int PduStatus::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _pduStatus + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/PduStatus.h b/src/dis7/common/PduStatus.h similarity index 77% rename from src/dis7/PduStatus.h rename to src/dis7/common/PduStatus.h index 1aa2ba93..18ea2bd6 100644 --- a/src/dis7/PduStatus.h +++ b/src/dis7/common/PduStatus.h @@ -1,46 +1,43 @@ #pragma once -#include -#include +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" +namespace DIS { +// PDU Status. These are a series of bit fields. Represented here as just a +// byte. Section 6.2.67 -namespace DIS -{ -// PDU Status. These are a series of bit fields. Represented here as just a byte. Section 6.2.67 - -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. // // @author DMcG, jkg -class OPENDIS7_EXPORT PduStatus -{ -protected: +class OPENDIS7_EXPORT PduStatus { + protected: /** Bit fields */ - unsigned char _pduStatus; - + uint8_t _pduStatus; public: - PduStatus(); - virtual ~PduStatus(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); + PduStatus(); + virtual ~PduStatus(); - unsigned char getPduStatus() const; - void setPduStatus(unsigned char pX); + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + uint8_t getPduStatus() const; + void setPduStatus(uint8_t pX); -virtual int getMarshalledSize() const; + virtual int getMarshalledSize() const; - bool operator ==(const PduStatus& rhs) const; + bool operator==(const PduStatus& rhs) const; }; -} +} // namespace DIS // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright @@ -53,7 +50,7 @@ virtual int getMarshalledSize() const; // nor the names of its contributors may be used to endorse or // promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/src/dis7/common/PduSuperclass.cpp b/src/dis7/common/PduSuperclass.cpp new file mode 100644 index 00000000..adf13dc2 --- /dev/null +++ b/src/dis7/common/PduSuperclass.cpp @@ -0,0 +1,119 @@ +#include "dis7/PduSuperclass.h" + +using namespace DIS; + +PduSuperclass::PduSuperclass() + : _protocolVersion(7), + _exerciseID(0), + _pduType(0), + _protocolFamily(0), + _timestamp(0), + _length(0) {} + +PduSuperclass::~PduSuperclass() {} + +uint8_t PduSuperclass::getProtocolVersion() const { + return _protocolVersion; +} + +void PduSuperclass::setProtocolVersion(uint8_t pX) { + _protocolVersion = pX; +} + +uint8_t PduSuperclass::getExerciseID() const { return _exerciseID; } + +void PduSuperclass::setExerciseID(uint8_t pX) { _exerciseID = pX; } + +uint8_t PduSuperclass::getPduType() const { return _pduType; } + +void PduSuperclass::setPduType(uint8_t pX) { _pduType = pX; } + +uint8_t PduSuperclass::getProtocolFamily() const { + return _protocolFamily; +} + +void PduSuperclass::setProtocolFamily(uint8_t pX) { + _protocolFamily = pX; +} + +uint32_t PduSuperclass::getTimestamp() const { return _timestamp; } + +void PduSuperclass::setTimestamp(uint32_t pX) { _timestamp = pX; } + +uint16_t PduSuperclass::getLength() const { return _length; } + +void PduSuperclass::setLength(uint16_t pX) { _length = pX; } + +void PduSuperclass::marshal(DataStream& dataStream) const { + dataStream << _protocolVersion; + dataStream << _exerciseID; + dataStream << _pduType; + dataStream << _protocolFamily; + dataStream << _timestamp; + dataStream << _length; +} + +void PduSuperclass::unmarshal(DataStream& dataStream) { + dataStream >> _protocolVersion; + dataStream >> _exerciseID; + dataStream >> _pduType; + dataStream >> _protocolFamily; + dataStream >> _timestamp; + dataStream >> _length; +} + +bool PduSuperclass::operator==(const PduSuperclass& rhs) const { + bool ivarsEqual = true; + + if (!(_protocolVersion == rhs._protocolVersion)) ivarsEqual = false; + if (!(_exerciseID == rhs._exerciseID)) ivarsEqual = false; + if (!(_pduType == rhs._pduType)) ivarsEqual = false; + if (!(_protocolFamily == rhs._protocolFamily)) ivarsEqual = false; + if (!(_timestamp == rhs._timestamp)) ivarsEqual = false; + if (!(_length == rhs._length)) ivarsEqual = false; + + return ivarsEqual; +} + +int PduSuperclass::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _protocolVersion + marshalSize = marshalSize + 1; // _exerciseID + marshalSize = marshalSize + 1; // _pduType + marshalSize = marshalSize + 1; // _protocolFamily + marshalSize = marshalSize + 4; // _timestamp + marshalSize = marshalSize + 2; // _length + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/PduSuperclass.h b/src/dis7/common/PduSuperclass.h new file mode 100644 index 00000000..d7603a17 --- /dev/null +++ b/src/dis7/common/PduSuperclass.h @@ -0,0 +1,95 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The superclass for all PDUs, including classic and Live Entity (LE) PDUs. +// This incorporates the PduHeader record, section 7.2.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT PduSuperclass { + protected: + /** The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2009. */ + uint8_t _protocolVersion; + + /** Exercise ID */ + uint8_t _exerciseID; + + /** Type of pdu, unique for each PDU class */ + uint8_t _pduType; + + /** value that refers to the protocol family, eg SimulationManagement, et */ + uint8_t _protocolFamily; + + /** Timestamp value */ + uint32_t _timestamp; + + /** Length, in bytes, of the PDU */ + uint16_t _length; + + public: + PduSuperclass(); + virtual ~PduSuperclass(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getProtocolVersion() const; + void setProtocolVersion(uint8_t pX); + + uint8_t getExerciseID() const; + void setExerciseID(uint8_t pX); + + uint8_t getPduType() const; + void setPduType(uint8_t pX); + + uint8_t getProtocolFamily() const; + void setProtocolFamily(uint8_t pX); + + uint32_t getTimestamp() const; + void setTimestamp(uint32_t pX); + + uint16_t getLength() const; + void setLength(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const PduSuperclass& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RadioIdentifier.cpp b/src/dis7/common/RadioIdentifier.cpp new file mode 100644 index 00000000..d16cfc2e --- /dev/null +++ b/src/dis7/common/RadioIdentifier.cpp @@ -0,0 +1,101 @@ +#include "dis7/RadioIdentifier.h" + +using namespace DIS; + +RadioIdentifier::RadioIdentifier() + : _siteNumber(0), + _applicationNumber(0), + _referenceNumber(0), + _radioNumber(0) {} + +RadioIdentifier::~RadioIdentifier() {} + +uint16_t RadioIdentifier::getSiteNumber() const { return _siteNumber; } + +void RadioIdentifier::setSiteNumber(uint16_t pX) { _siteNumber = pX; } + +uint16_t RadioIdentifier::getApplicationNumber() const { + return _applicationNumber; +} + +void RadioIdentifier::setApplicationNumber(uint16_t pX) { + _applicationNumber = pX; +} + +uint16_t RadioIdentifier::getReferenceNumber() const { + return _referenceNumber; +} + +void RadioIdentifier::setReferenceNumber(uint16_t pX) { + _referenceNumber = pX; +} + +uint16_t RadioIdentifier::getRadioNumber() const { return _radioNumber; } + +void RadioIdentifier::setRadioNumber(uint16_t pX) { _radioNumber = pX; } + +void RadioIdentifier::marshal(DataStream& dataStream) const { + dataStream << _siteNumber; + dataStream << _applicationNumber; + dataStream << _referenceNumber; + dataStream << _radioNumber; +} + +void RadioIdentifier::unmarshal(DataStream& dataStream) { + dataStream >> _siteNumber; + dataStream >> _applicationNumber; + dataStream >> _referenceNumber; + dataStream >> _radioNumber; +} + +bool RadioIdentifier::operator==(const RadioIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_siteNumber == rhs._siteNumber)) ivarsEqual = false; + if (!(_applicationNumber == rhs._applicationNumber)) ivarsEqual = false; + if (!(_referenceNumber == rhs._referenceNumber)) ivarsEqual = false; + if (!(_radioNumber == rhs._radioNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int RadioIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _siteNumber + marshalSize = marshalSize + 2; // _applicationNumber + marshalSize = marshalSize + 2; // _referenceNumber + marshalSize = marshalSize + 2; // _radioNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RadioIdentifier.h b/src/dis7/common/RadioIdentifier.h new file mode 100644 index 00000000..b46ec820 --- /dev/null +++ b/src/dis7/common/RadioIdentifier.h @@ -0,0 +1,83 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of an attached or unattached radio in an event or +// exercise Section 6.2.69 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RadioIdentifier { + protected: + /** site */ + uint16_t _siteNumber; + + /** application number */ + uint16_t _applicationNumber; + + /** reference number */ + uint16_t _referenceNumber; + + /** Radio number */ + uint16_t _radioNumber; + + public: + RadioIdentifier(); + virtual ~RadioIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSiteNumber() const; + void setSiteNumber(uint16_t pX); + + uint16_t getApplicationNumber() const; + void setApplicationNumber(uint16_t pX); + + uint16_t getReferenceNumber() const; + void setReferenceNumber(uint16_t pX); + + uint16_t getRadioNumber() const; + void setRadioNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RadioIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RadioType.cpp b/src/dis7/common/RadioType.cpp new file mode 100644 index 00000000..c24e9557 --- /dev/null +++ b/src/dis7/common/RadioType.cpp @@ -0,0 +1,120 @@ +#include "dis7/RadioType.h" + +using namespace DIS; + +RadioType::RadioType() + : _entityKind(0), + _domain(0), + _country(0), + _category(0), + _subcategory(0), + _specific(0), + _extra(0) {} + +RadioType::~RadioType() {} + +uint8_t RadioType::getEntityKind() const { return _entityKind; } + +void RadioType::setEntityKind(uint8_t pX) { _entityKind = pX; } + +uint8_t RadioType::getDomain() const { return _domain; } + +void RadioType::setDomain(uint8_t pX) { _domain = pX; } + +uint16_t RadioType::getCountry() const { return _country; } + +void RadioType::setCountry(uint16_t pX) { _country = pX; } + +uint8_t RadioType::getCategory() const { return _category; } + +void RadioType::setCategory(uint8_t pX) { _category = pX; } + +uint8_t RadioType::getSubcategory() const { return _subcategory; } + +void RadioType::setSubcategory(uint8_t pX) { _subcategory = pX; } + +uint8_t RadioType::getSpecific() const { return _specific; } + +void RadioType::setSpecific(uint8_t pX) { _specific = pX; } + +uint8_t RadioType::getExtra() const { return _extra; } + +void RadioType::setExtra(uint8_t pX) { _extra = pX; } + +void RadioType::marshal(DataStream& dataStream) const { + dataStream << _entityKind; + dataStream << _domain; + dataStream << _country; + dataStream << _category; + dataStream << _subcategory; + dataStream << _specific; + dataStream << _extra; +} + +void RadioType::unmarshal(DataStream& dataStream) { + dataStream >> _entityKind; + dataStream >> _domain; + dataStream >> _country; + dataStream >> _category; + dataStream >> _subcategory; + dataStream >> _specific; + dataStream >> _extra; +} + +bool RadioType::operator==(const RadioType& rhs) const { + bool ivarsEqual = true; + + if (!(_entityKind == rhs._entityKind)) ivarsEqual = false; + if (!(_domain == rhs._domain)) ivarsEqual = false; + if (!(_country == rhs._country)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_subcategory == rhs._subcategory)) ivarsEqual = false; + if (!(_specific == rhs._specific)) ivarsEqual = false; + if (!(_extra == rhs._extra)) ivarsEqual = false; + + return ivarsEqual; +} + +int RadioType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _entityKind + marshalSize = marshalSize + 1; // _domain + marshalSize = marshalSize + 2; // _country + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _subcategory + marshalSize = marshalSize + 1; // _specific + marshalSize = marshalSize + 1; // _extra + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RadioType.h b/src/dis7/common/RadioType.h new file mode 100644 index 00000000..555f6e3e --- /dev/null +++ b/src/dis7/common/RadioType.h @@ -0,0 +1,98 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Identifies the type of radio. Section 6.2.70 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RadioType { + protected: + /** Kind of entity */ + uint8_t _entityKind; + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _domain; + + /** country to which the design of the entity is attributed */ + uint16_t _country; + + /** category of entity */ + uint8_t _category; + + /** specific info based on subcategory field */ + uint8_t _subcategory; + + uint8_t _specific; + + uint8_t _extra; + + public: + RadioType(); + virtual ~RadioType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getEntityKind() const; + void setEntityKind(uint8_t pX); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint16_t getCountry() const; + void setCountry(uint16_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + uint8_t getSpecific() const; + void setSpecific(uint8_t pX); + + uint8_t getExtra() const; + void setExtra(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RadioType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RecordQuerySpecification.cpp b/src/dis7/common/RecordQuerySpecification.cpp new file mode 100644 index 00000000..11b1e986 --- /dev/null +++ b/src/dis7/common/RecordQuerySpecification.cpp @@ -0,0 +1,99 @@ +#include "dis7/RecordQuerySpecification.h" + +using namespace DIS; + +RecordQuerySpecification::RecordQuerySpecification() : _numberOfRecords(0) {} + +RecordQuerySpecification::~RecordQuerySpecification() { _records.clear(); } + +uint32_t RecordQuerySpecification::getNumberOfRecords() const { + return _records.size(); +} + +std::vector& RecordQuerySpecification::getRecords() { + return _records; +} + +const std::vector& RecordQuerySpecification::getRecords() const { + return _records; +} + +void RecordQuerySpecification::setRecords( + const std::vector& pX) { + _records = pX; +} + +void RecordQuerySpecification::marshal(DataStream& dataStream) const { + dataStream << (uint32_t)_records.size(); + + for (size_t idx = 0; idx < _records.size(); idx++) { + FourByteChunk x = _records[idx]; + x.marshal(dataStream); + } +} + +void RecordQuerySpecification::unmarshal(DataStream& dataStream) { + dataStream >> _numberOfRecords; + + _records.clear(); + for (size_t idx = 0; idx < _numberOfRecords; idx++) { + FourByteChunk x; + x.unmarshal(dataStream); + _records.push_back(x); + } +} + +bool RecordQuerySpecification::operator==( + const RecordQuerySpecification& rhs) const { + bool ivarsEqual = true; + + for (size_t idx = 0; idx < _records.size(); idx++) { + if (!(_records[idx] == rhs._records[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int RecordQuerySpecification::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _numberOfRecords + + for (uint64_t idx = 0; idx < _records.size(); idx++) { + FourByteChunk listElement = _records[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RecordQuerySpecification.h b/src/dis7/common/RecordQuerySpecification.h new file mode 100644 index 00000000..4c18a40a --- /dev/null +++ b/src/dis7/common/RecordQuerySpecification.h @@ -0,0 +1,72 @@ +#pragma once + +#include + +#include "dis7/FourByteChunk.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The identification of the records being queried 6.2.71 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RecordQuerySpecification { + protected: + uint32_t _numberOfRecords; + + /** variable length list of 32 bit records */ + std::vector _records; + + public: + RecordQuerySpecification(); + virtual ~RecordQuerySpecification(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfRecords() const; + + std::vector& getRecords(); + const std::vector& getRecords() const; + void setRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RecordQuerySpecification& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RecordSpecification.cpp b/src/dis7/common/RecordSpecification.cpp new file mode 100644 index 00000000..fd337f9c --- /dev/null +++ b/src/dis7/common/RecordSpecification.cpp @@ -0,0 +1,99 @@ +#include "dis7/RecordSpecification.h" + +using namespace DIS; + +RecordSpecification::RecordSpecification() : _numberOfRecordSets(0) {} + +RecordSpecification::~RecordSpecification() { _recordSets.clear(); } + +uint32_t RecordSpecification::getNumberOfRecordSets() const { + return _recordSets.size(); +} + +std::vector& RecordSpecification::getRecordSets() { + return _recordSets; +} + +const std::vector& +RecordSpecification::getRecordSets() const { + return _recordSets; +} + +void RecordSpecification::setRecordSets( + const std::vector& pX) { + _recordSets = pX; +} + +void RecordSpecification::marshal(DataStream& dataStream) const { + dataStream << (uint32_t)_recordSets.size(); + + for (size_t idx = 0; idx < _recordSets.size(); idx++) { + RecordSpecificationElement x = _recordSets[idx]; + x.marshal(dataStream); + } +} + +void RecordSpecification::unmarshal(DataStream& dataStream) { + dataStream >> _numberOfRecordSets; + + _recordSets.clear(); + for (size_t idx = 0; idx < _numberOfRecordSets; idx++) { + RecordSpecificationElement x; + x.unmarshal(dataStream); + _recordSets.push_back(x); + } +} + +bool RecordSpecification::operator==(const RecordSpecification& rhs) const { + bool ivarsEqual = true; + + for (size_t idx = 0; idx < _recordSets.size(); idx++) { + if (!(_recordSets[idx] == rhs._recordSets[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int RecordSpecification::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _numberOfRecordSets + + for (uint64_t idx = 0; idx < _recordSets.size(); idx++) { + RecordSpecificationElement listElement = _recordSets[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RecordSpecification.h b/src/dis7/common/RecordSpecification.h new file mode 100644 index 00000000..147e7a07 --- /dev/null +++ b/src/dis7/common/RecordSpecification.h @@ -0,0 +1,74 @@ +#pragma once + +#include + +#include "dis7/RecordSpecificationElement.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// This record shall specify the number of record sets contained in the Record +// Specification record and the record details. Section 6.2.72. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RecordSpecification { + protected: + /** The number of record sets */ + uint32_t _numberOfRecordSets; + + /** variable length list record specifications. */ + std::vector _recordSets; + + public: + RecordSpecification(); + virtual ~RecordSpecification(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfRecordSets() const; + + std::vector& getRecordSets(); + const std::vector& getRecordSets() const; + void setRecordSets(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RecordSpecification& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RecordSpecificationElement.cpp b/src/dis7/common/RecordSpecificationElement.cpp new file mode 100644 index 00000000..9e51a1ee --- /dev/null +++ b/src/dis7/common/RecordSpecificationElement.cpp @@ -0,0 +1,133 @@ +#include "dis7/RecordSpecificationElement.h" + +using namespace DIS; + +RecordSpecificationElement::RecordSpecificationElement() + : _recordID(0), + _recordSetSerialNumber(0), + _recordLength(0), + _recordCount(0), + _recordValues(0), + _pad4(0) {} + +RecordSpecificationElement::~RecordSpecificationElement() {} + +uint32_t RecordSpecificationElement::getRecordID() const { + return _recordID; +} + +void RecordSpecificationElement::setRecordID(uint32_t pX) { + _recordID = pX; +} + +uint32_t RecordSpecificationElement::getRecordSetSerialNumber() const { + return _recordSetSerialNumber; +} + +void RecordSpecificationElement::setRecordSetSerialNumber(uint32_t pX) { + _recordSetSerialNumber = pX; +} + +uint16_t RecordSpecificationElement::getRecordLength() const { + return _recordLength; +} + +void RecordSpecificationElement::setRecordLength(uint16_t pX) { + _recordLength = pX; +} + +uint16_t RecordSpecificationElement::getRecordCount() const { + return _recordCount; +} + +void RecordSpecificationElement::setRecordCount(uint16_t pX) { + _recordCount = pX; +} + +uint16_t RecordSpecificationElement::getRecordValues() const { + return _recordValues; +} + +void RecordSpecificationElement::setRecordValues(uint16_t pX) { + _recordValues = pX; +} + +uint8_t RecordSpecificationElement::getPad4() const { return _pad4; } + +void RecordSpecificationElement::setPad4(uint8_t pX) { _pad4 = pX; } + +void RecordSpecificationElement::marshal(DataStream& dataStream) const { + dataStream << _recordID; + dataStream << _recordSetSerialNumber; + dataStream << _recordLength; + dataStream << _recordCount; + dataStream << _recordValues; + dataStream << _pad4; +} + +void RecordSpecificationElement::unmarshal(DataStream& dataStream) { + dataStream >> _recordID; + dataStream >> _recordSetSerialNumber; + dataStream >> _recordLength; + dataStream >> _recordCount; + dataStream >> _recordValues; + dataStream >> _pad4; +} + +bool RecordSpecificationElement::operator==( + const RecordSpecificationElement& rhs) const { + bool ivarsEqual = true; + + if (!(_recordID == rhs._recordID)) ivarsEqual = false; + if (!(_recordSetSerialNumber == rhs._recordSetSerialNumber)) + ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_recordCount == rhs._recordCount)) ivarsEqual = false; + if (!(_recordValues == rhs._recordValues)) ivarsEqual = false; + if (!(_pad4 == rhs._pad4)) ivarsEqual = false; + + return ivarsEqual; +} + +int RecordSpecificationElement::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordID + marshalSize = marshalSize + 4; // _recordSetSerialNumber + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 2; // _recordCount + marshalSize = marshalSize + 2; // _recordValues + marshalSize = marshalSize + 1; // _pad4 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/RecordSpecificationElement.h b/src/dis7/common/RecordSpecificationElement.h new file mode 100644 index 00000000..ff24a495 --- /dev/null +++ b/src/dis7/common/RecordSpecificationElement.h @@ -0,0 +1,101 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Synthetic record, made up from section 6.2.72. This is used to acheive a +// repeating variable list element. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RecordSpecificationElement { + protected: + /** the data structure used to convey the parameter values of the record for + * each record. 32 bit enumeration. */ + uint32_t _recordID; + + /** the serial number of the first record in the block of records */ + uint32_t _recordSetSerialNumber; + + /** the length, in bits, of the record. Note, bits, not bytes. */ + uint16_t _recordLength; + + /** the number of records included in the record set */ + uint16_t _recordCount; + + /** the concatenated records of the format specified by the Record ID field. + * The length of this field is the Record Length multiplied by the Record + * Count, in units of bits. ^^^This is wrong--variable sized data records, bit + * values. THis MUST be patched after generation. */ + uint16_t _recordValues; + + /** Padding of 0 to 31 unused bits as required for 32-bit alignment of the + * Record Set field. ^^^This is wrong--variable sized padding. MUST be patched + * post-code generation */ + uint8_t _pad4; + + public: + RecordSpecificationElement(); + virtual ~RecordSpecificationElement(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordID() const; + void setRecordID(uint32_t pX); + + uint32_t getRecordSetSerialNumber() const; + void setRecordSetSerialNumber(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint16_t getRecordCount() const; + void setRecordCount(uint16_t pX); + + uint16_t getRecordValues() const; + void setRecordValues(uint16_t pX); + + uint8_t getPad4() const; + void setPad4(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RecordSpecificationElement& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Sensor.cpp b/src/dis7/common/Sensor.cpp new file mode 100644 index 00000000..178f4488 --- /dev/null +++ b/src/dis7/common/Sensor.cpp @@ -0,0 +1,113 @@ +#include "dis7/Sensor.h" + +using namespace DIS; + +Sensor::Sensor() + : _sensorTypeSource(0), + _sensorOnOffStatus(0), + _sensorType(0), + _station(0), + _quantity(0), + _padding(0) {} + +Sensor::~Sensor() {} + +uint8_t Sensor::getSensorTypeSource() const { return _sensorTypeSource; } + +void Sensor::setSensorTypeSource(uint8_t pX) { _sensorTypeSource = pX; } + +uint8_t Sensor::getSensorOnOffStatus() const { + return _sensorOnOffStatus; +} + +void Sensor::setSensorOnOffStatus(uint8_t pX) { _sensorOnOffStatus = pX; } + +uint16_t Sensor::getSensorType() const { return _sensorType; } + +void Sensor::setSensorType(uint16_t pX) { _sensorType = pX; } + +uint32_t Sensor::getStation() const { return _station; } + +void Sensor::setStation(uint32_t pX) { _station = pX; } + +uint16_t Sensor::getQuantity() const { return _quantity; } + +void Sensor::setQuantity(uint16_t pX) { _quantity = pX; } + +uint16_t Sensor::getPadding() const { return _padding; } + +void Sensor::setPadding(uint16_t pX) { _padding = pX; } + +void Sensor::marshal(DataStream& dataStream) const { + dataStream << _sensorTypeSource; + dataStream << _sensorOnOffStatus; + dataStream << _sensorType; + dataStream << _station; + dataStream << _quantity; + dataStream << _padding; +} + +void Sensor::unmarshal(DataStream& dataStream) { + dataStream >> _sensorTypeSource; + dataStream >> _sensorOnOffStatus; + dataStream >> _sensorType; + dataStream >> _station; + dataStream >> _quantity; + dataStream >> _padding; +} + +bool Sensor::operator==(const Sensor& rhs) const { + bool ivarsEqual = true; + + if (!(_sensorTypeSource == rhs._sensorTypeSource)) ivarsEqual = false; + if (!(_sensorOnOffStatus == rhs._sensorOnOffStatus)) ivarsEqual = false; + if (!(_sensorType == rhs._sensorType)) ivarsEqual = false; + if (!(_station == rhs._station)) ivarsEqual = false; + if (!(_quantity == rhs._quantity)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int Sensor::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _sensorTypeSource + marshalSize = marshalSize + 1; // _sensorOnOffStatus + marshalSize = marshalSize + 2; // _sensorType + marshalSize = marshalSize + 4; // _station + marshalSize = marshalSize + 2; // _quantity + marshalSize = marshalSize + 2; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Sensor.h b/src/dis7/common/Sensor.h new file mode 100644 index 00000000..bb4afd96 --- /dev/null +++ b/src/dis7/common/Sensor.h @@ -0,0 +1,98 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// An entity's sensor information. Section 6.2.77. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Sensor { + protected: + /** the source of the Sensor Type field */ + uint8_t _sensorTypeSource; + + /** the on/off status of the sensor */ + uint8_t _sensorOnOffStatus; + + /** the sensor type and shall be represented by a 16-bit enumeration. */ + uint16_t _sensorType; + + /** the station to which the sensor is assigned. A zero value shall indi- + * cate that this Sensor record is not associated with any particular station + * and represents the total quan- tity of this sensor for this entity. If this + * field is non-zero, it shall either reference an attached part or an + * articulated part */ + uint32_t _station; + + /** quantity of the sensor */ + uint16_t _quantity; + + /** padding */ + uint16_t _padding; + + public: + Sensor(); + virtual ~Sensor(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getSensorTypeSource() const; + void setSensorTypeSource(uint8_t pX); + + uint8_t getSensorOnOffStatus() const; + void setSensorOnOffStatus(uint8_t pX); + + uint16_t getSensorType() const; + void setSensorType(uint16_t pX); + + uint32_t getStation() const; + void setStation(uint32_t pX); + + uint16_t getQuantity() const; + void setQuantity(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Sensor& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/SeparationVP.cpp b/src/dis7/common/SeparationVP.cpp new file mode 100644 index 00000000..c5838a3e --- /dev/null +++ b/src/dis7/common/SeparationVP.cpp @@ -0,0 +1,139 @@ +#include "dis7/SeparationVP.h" + +using namespace DIS; + +SeparationVP::SeparationVP() + : _recordType(4), + _reasonForSeparation(0), + _preEntityIndicator(0), + _padding1(0), + _parentEntityID(), + _padding2(0), + _stationLocation(0) {} + +SeparationVP::~SeparationVP() {} + +uint8_t SeparationVP::getRecordType() const { return _recordType; } + +void SeparationVP::setRecordType(uint8_t pX) { _recordType = pX; } + +uint8_t SeparationVP::getReasonForSeparation() const { + return _reasonForSeparation; +} + +void SeparationVP::setReasonForSeparation(uint8_t pX) { + _reasonForSeparation = pX; +} + +uint8_t SeparationVP::getPreEntityIndicator() const { + return _preEntityIndicator; +} + +void SeparationVP::setPreEntityIndicator(uint8_t pX) { + _preEntityIndicator = pX; +} + +uint8_t SeparationVP::getPadding1() const { return _padding1; } + +void SeparationVP::setPadding1(uint8_t pX) { _padding1 = pX; } + +EntityID& SeparationVP::getParentEntityID() { return _parentEntityID; } + +const EntityID& SeparationVP::getParentEntityID() const { + return _parentEntityID; +} + +void SeparationVP::setParentEntityID(const EntityID& pX) { + _parentEntityID = pX; +} + +uint16_t SeparationVP::getPadding2() const { return _padding2; } + +void SeparationVP::setPadding2(uint16_t pX) { _padding2 = pX; } + +uint32_t SeparationVP::getStationLocation() const { + return _stationLocation; +} + +void SeparationVP::setStationLocation(uint32_t pX) { + _stationLocation = pX; +} + +void SeparationVP::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _reasonForSeparation; + dataStream << _preEntityIndicator; + dataStream << _padding1; + _parentEntityID.marshal(dataStream); + dataStream << _padding2; + dataStream << _stationLocation; +} + +void SeparationVP::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _reasonForSeparation; + dataStream >> _preEntityIndicator; + dataStream >> _padding1; + _parentEntityID.unmarshal(dataStream); + dataStream >> _padding2; + dataStream >> _stationLocation; +} + +bool SeparationVP::operator==(const SeparationVP& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_reasonForSeparation == rhs._reasonForSeparation)) ivarsEqual = false; + if (!(_preEntityIndicator == rhs._preEntityIndicator)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_parentEntityID == rhs._parentEntityID)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_stationLocation == rhs._stationLocation)) ivarsEqual = false; + + return ivarsEqual; +} + +int SeparationVP::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _recordType + marshalSize = marshalSize + 1; // _reasonForSeparation + marshalSize = marshalSize + 1; // _preEntityIndicator + marshalSize = marshalSize + 1; // _padding1 + marshalSize = + marshalSize + _parentEntityID.getMarshalledSize(); // _parentEntityID + marshalSize = marshalSize + 2; // _padding2 + marshalSize = marshalSize + 4; // _stationLocation + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/SeparationVP.h b/src/dis7/common/SeparationVP.h new file mode 100644 index 00000000..c9933b67 --- /dev/null +++ b/src/dis7/common/SeparationVP.h @@ -0,0 +1,103 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Physical separation of an entity from another entity. Section 6.2.93.6 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SeparationVP { + protected: + /** the identification of the Variable Parameter record. Enumeration from EBV + */ + uint8_t _recordType; + + /** Reason for separation. EBV */ + uint8_t _reasonForSeparation; + + /** Whether the entity existed prior to separation EBV */ + uint8_t _preEntityIndicator; + + /** padding */ + uint8_t _padding1; + + /** ID of parent */ + EntityID _parentEntityID; + + /** padding */ + uint16_t _padding2; + + /** Station separated from */ + uint32_t _stationLocation; + + public: + SeparationVP(); + virtual ~SeparationVP(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRecordType() const; + void setRecordType(uint8_t pX); + + uint8_t getReasonForSeparation() const; + void setReasonForSeparation(uint8_t pX); + + uint8_t getPreEntityIndicator() const; + void setPreEntityIndicator(uint8_t pX); + + uint8_t getPadding1() const; + void setPadding1(uint8_t pX); + + EntityID& getParentEntityID(); + const EntityID& getParentEntityID() const; + void setParentEntityID(const EntityID& pX); + + uint16_t getPadding2() const; + void setPadding2(uint16_t pX); + + uint32_t getStationLocation() const; + void setStationLocation(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SeparationVP& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/SimulationAddress.cpp b/src/dis7/common/SimulationAddress.cpp new file mode 100644 index 00000000..754f219c --- /dev/null +++ b/src/dis7/common/SimulationAddress.cpp @@ -0,0 +1,75 @@ +#include "dis7/SimulationAddress.h" + +using namespace DIS; + +SimulationAddress::SimulationAddress() : _site(0), _application(0) {} + +SimulationAddress::~SimulationAddress() {} + +uint16_t SimulationAddress::getSite() const { return _site; } + +void SimulationAddress::setSite(uint16_t pX) { _site = pX; } + +uint16_t SimulationAddress::getApplication() const { + return _application; +} + +void SimulationAddress::setApplication(uint16_t pX) { _application = pX; } + +void SimulationAddress::marshal(DataStream& dataStream) const { + dataStream << _site; + dataStream << _application; +} + +void SimulationAddress::unmarshal(DataStream& dataStream) { + dataStream >> _site; + dataStream >> _application; +} + +bool SimulationAddress::operator==(const SimulationAddress& rhs) const { + bool ivarsEqual = true; + + if (!(_site == rhs._site)) ivarsEqual = false; + if (!(_application == rhs._application)) ivarsEqual = false; + + return ivarsEqual; +} + +int SimulationAddress::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _site + marshalSize = marshalSize + 2; // _application + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/SimulationAddress.h b/src/dis7/common/SimulationAddress.h new file mode 100644 index 00000000..23e2ad26 --- /dev/null +++ b/src/dis7/common/SimulationAddress.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// A Simulation Address record shall consist of the Site Identification number +// and the Application Identification number. Section 6.2.79 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SimulationAddress { + protected: + /** A site is defined as a facility, installation, organizational unit or a + * geographic location that has one or more simulation applications capable of + * participating in a distributed event. */ + uint16_t _site; + + /** An application is defined as a software program that is used to generate + * and process distributed simulation data including live, virtual and + * constructive data. */ + uint16_t _application; + + public: + SimulationAddress(); + virtual ~SimulationAddress(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSite() const; + void setSite(uint16_t pX); + + uint16_t getApplication() const; + void setApplication(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SimulationAddress& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/SimulationIdentifier.cpp b/src/dis7/common/SimulationIdentifier.cpp new file mode 100644 index 00000000..11313c45 --- /dev/null +++ b/src/dis7/common/SimulationIdentifier.cpp @@ -0,0 +1,87 @@ +#include "dis7/SimulationIdentifier.h" + +using namespace DIS; + +SimulationIdentifier::SimulationIdentifier() + : _simulationAddress(), _referenceNumber(0) {} + +SimulationIdentifier::~SimulationIdentifier() {} + +SimulationAddress& SimulationIdentifier::getSimulationAddress() { + return _simulationAddress; +} + +const SimulationAddress& SimulationIdentifier::getSimulationAddress() const { + return _simulationAddress; +} + +void SimulationIdentifier::setSimulationAddress(const SimulationAddress& pX) { + _simulationAddress = pX; +} + +uint16_t SimulationIdentifier::getReferenceNumber() const { + return _referenceNumber; +} + +void SimulationIdentifier::setReferenceNumber(uint16_t pX) { + _referenceNumber = pX; +} + +void SimulationIdentifier::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _referenceNumber; +} + +void SimulationIdentifier::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _referenceNumber; +} + +bool SimulationIdentifier::operator==(const SimulationIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_referenceNumber == rhs._referenceNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int SimulationIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _referenceNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/SimulationIdentifier.h b/src/dis7/common/SimulationIdentifier.h new file mode 100644 index 00000000..944b1664 --- /dev/null +++ b/src/dis7/common/SimulationIdentifier.h @@ -0,0 +1,78 @@ +#pragma once + +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of a simulation when using the 48-bit identifier +// format shall be specified by the Sim- ulation Identifier record. The reason +// that the 48-bit format is required in addition to the 32-bit simulation +// address format that actually identifies a specific simulation is because some +// 48-bit identifier fields in PDUs may contain either an Object Identifier, +// such as an Entity ID, or a Simulation Identifier. Section 6.2.80 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SimulationIdentifier { + protected: + /** Simulation address */ + SimulationAddress _simulationAddress; + + /** This field shall be set to zero as there is no reference number associated + * with a Simulation Identifier. */ + uint16_t _referenceNumber; + + public: + SimulationIdentifier(); + virtual ~SimulationIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getSimulationAddress(); + const SimulationAddress& getSimulationAddress() const; + void setSimulationAddress(const SimulationAddress& pX); + + uint16_t getReferenceNumber() const; + void setReferenceNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SimulationIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/SimulationManagementPduHeader.cpp b/src/dis7/common/SimulationManagementPduHeader.cpp new file mode 100644 index 00000000..2f0df0e7 --- /dev/null +++ b/src/dis7/common/SimulationManagementPduHeader.cpp @@ -0,0 +1,104 @@ +#include "dis7/SimulationManagementPduHeader.h" + +using namespace DIS; + +SimulationManagementPduHeader::SimulationManagementPduHeader() + : _pduHeader(), _originatingID(), _recevingID() {} + +SimulationManagementPduHeader::~SimulationManagementPduHeader() {} + +PduHeader& SimulationManagementPduHeader::getPduHeader() { return _pduHeader; } + +const PduHeader& SimulationManagementPduHeader::getPduHeader() const { + return _pduHeader; +} + +void SimulationManagementPduHeader::setPduHeader(const PduHeader& pX) { + _pduHeader = pX; +} + +EntityID& SimulationManagementPduHeader::getOriginatingID() { + return _originatingID; +} + +const EntityID& SimulationManagementPduHeader::getOriginatingID() const { + return _originatingID; +} + +void SimulationManagementPduHeader::setOriginatingID(const EntityID& pX) { + _originatingID = pX; +} + +EntityID& SimulationManagementPduHeader::getRecevingID() { return _recevingID; } + +const EntityID& SimulationManagementPduHeader::getRecevingID() const { + return _recevingID; +} + +void SimulationManagementPduHeader::setRecevingID(const EntityID& pX) { + _recevingID = pX; +} + +void SimulationManagementPduHeader::marshal(DataStream& dataStream) const { + _pduHeader.marshal(dataStream); + _originatingID.marshal(dataStream); + _recevingID.marshal(dataStream); +} + +void SimulationManagementPduHeader::unmarshal(DataStream& dataStream) { + _pduHeader.unmarshal(dataStream); + _originatingID.unmarshal(dataStream); + _recevingID.unmarshal(dataStream); +} + +bool SimulationManagementPduHeader::operator==( + const SimulationManagementPduHeader& rhs) const { + bool ivarsEqual = true; + + if (!(_pduHeader == rhs._pduHeader)) ivarsEqual = false; + if (!(_originatingID == rhs._originatingID)) ivarsEqual = false; + if (!(_recevingID == rhs._recevingID)) ivarsEqual = false; + + return ivarsEqual; +} + +int SimulationManagementPduHeader::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _pduHeader.getMarshalledSize(); // _pduHeader + marshalSize = + marshalSize + _originatingID.getMarshalledSize(); // _originatingID + marshalSize = marshalSize + _recevingID.getMarshalledSize(); // _recevingID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/SimulationManagementPduHeader.h b/src/dis7/common/SimulationManagementPduHeader.h new file mode 100644 index 00000000..c0cc6a7b --- /dev/null +++ b/src/dis7/common/SimulationManagementPduHeader.h @@ -0,0 +1,84 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/PduHeader.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// First part of a simulation management (SIMAN) PDU and SIMAN-Reliability +// (SIMAN-R) PDU. Sectionn 6.2.81 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SimulationManagementPduHeader { + protected: + /** Conventional PDU header */ + PduHeader _pduHeader; + + /** IDs the simulation or entity, etiehr a simulation or an entity. + * Either 6.2.80 or 6.2.28 */ + EntityID _originatingID; + + /** simulation, all simulations, a special ID, or an entity. See 5.6.5 + * and 5.12.4 */ + EntityID _recevingID; + + public: + SimulationManagementPduHeader(); + virtual ~SimulationManagementPduHeader(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + PduHeader& getPduHeader(); + const PduHeader& getPduHeader() const; + void setPduHeader(const PduHeader& pX); + + EntityID& getOriginatingID(); + const EntityID& getOriginatingID() const; + void setOriginatingID(const EntityID& pX); + + EntityID& getRecevingID(); + const EntityID& getRecevingID() const; + void setRecevingID(const EntityID& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SimulationManagementPduHeader& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/StorageFuel.cpp b/src/dis7/common/StorageFuel.cpp new file mode 100644 index 00000000..6e9b42d7 --- /dev/null +++ b/src/dis7/common/StorageFuel.cpp @@ -0,0 +1,106 @@ +#include "dis7/StorageFuel.h" + +using namespace DIS; + +StorageFuel::StorageFuel() + : _fuelQuantity(0), + _fuelMeasurementUnits(0), + _fuelType(0), + _fuelLocation(0), + _padding(0) {} + +StorageFuel::~StorageFuel() {} + +uint32_t StorageFuel::getFuelQuantity() const { return _fuelQuantity; } + +void StorageFuel::setFuelQuantity(uint32_t pX) { _fuelQuantity = pX; } + +uint8_t StorageFuel::getFuelMeasurementUnits() const { + return _fuelMeasurementUnits; +} + +void StorageFuel::setFuelMeasurementUnits(uint8_t pX) { + _fuelMeasurementUnits = pX; +} + +uint8_t StorageFuel::getFuelType() const { return _fuelType; } + +void StorageFuel::setFuelType(uint8_t pX) { _fuelType = pX; } + +uint8_t StorageFuel::getFuelLocation() const { return _fuelLocation; } + +void StorageFuel::setFuelLocation(uint8_t pX) { _fuelLocation = pX; } + +uint8_t StorageFuel::getPadding() const { return _padding; } + +void StorageFuel::setPadding(uint8_t pX) { _padding = pX; } + +void StorageFuel::marshal(DataStream& dataStream) const { + dataStream << _fuelQuantity; + dataStream << _fuelMeasurementUnits; + dataStream << _fuelType; + dataStream << _fuelLocation; + dataStream << _padding; +} + +void StorageFuel::unmarshal(DataStream& dataStream) { + dataStream >> _fuelQuantity; + dataStream >> _fuelMeasurementUnits; + dataStream >> _fuelType; + dataStream >> _fuelLocation; + dataStream >> _padding; +} + +bool StorageFuel::operator==(const StorageFuel& rhs) const { + bool ivarsEqual = true; + + if (!(_fuelQuantity == rhs._fuelQuantity)) ivarsEqual = false; + if (!(_fuelMeasurementUnits == rhs._fuelMeasurementUnits)) ivarsEqual = false; + if (!(_fuelType == rhs._fuelType)) ivarsEqual = false; + if (!(_fuelLocation == rhs._fuelLocation)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int StorageFuel::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _fuelQuantity + marshalSize = marshalSize + 1; // _fuelMeasurementUnits + marshalSize = marshalSize + 1; // _fuelType + marshalSize = marshalSize + 1; // _fuelLocation + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/StorageFuel.h b/src/dis7/common/StorageFuel.h new file mode 100644 index 00000000..0359e97a --- /dev/null +++ b/src/dis7/common/StorageFuel.h @@ -0,0 +1,88 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about an entity's engine fuel. Section 6.2.83. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT StorageFuel { + protected: + /** Fuel quantity, units specified by next field */ + uint32_t _fuelQuantity; + + /** Units in which the fuel is measured */ + uint8_t _fuelMeasurementUnits; + + /** Type of fuel */ + uint8_t _fuelType; + + /** Location of fuel as related to entity. See section 14 of EBV document */ + uint8_t _fuelLocation; + + /** padding */ + uint8_t _padding; + + public: + StorageFuel(); + virtual ~StorageFuel(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getFuelQuantity() const; + void setFuelQuantity(uint32_t pX); + + uint8_t getFuelMeasurementUnits() const; + void setFuelMeasurementUnits(uint8_t pX); + + uint8_t getFuelType() const; + void setFuelType(uint8_t pX); + + uint8_t getFuelLocation() const; + void setFuelLocation(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StorageFuel& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/StorageFuelReload.cpp b/src/dis7/common/StorageFuelReload.cpp new file mode 100644 index 00000000..a2c51947 --- /dev/null +++ b/src/dis7/common/StorageFuelReload.cpp @@ -0,0 +1,155 @@ +#include "dis7/StorageFuelReload.h" + +using namespace DIS; + +StorageFuelReload::StorageFuelReload() + : _standardQuantity(0), + _maximumQuantity(0), + _standardQuantityReloadTime(0), + _maximumQuantityReloadTime(0), + _fuelMeasurementUnits(0), + _fuelType(0), + _fuelLocation(0), + _padding(0) {} + +StorageFuelReload::~StorageFuelReload() {} + +uint32_t StorageFuelReload::getStandardQuantity() const { + return _standardQuantity; +} + +void StorageFuelReload::setStandardQuantity(uint32_t pX) { + _standardQuantity = pX; +} + +uint32_t StorageFuelReload::getMaximumQuantity() const { + return _maximumQuantity; +} + +void StorageFuelReload::setMaximumQuantity(uint32_t pX) { + _maximumQuantity = pX; +} + +uint8_t StorageFuelReload::getStandardQuantityReloadTime() const { + return _standardQuantityReloadTime; +} + +void StorageFuelReload::setStandardQuantityReloadTime(uint8_t pX) { + _standardQuantityReloadTime = pX; +} + +uint8_t StorageFuelReload::getMaximumQuantityReloadTime() const { + return _maximumQuantityReloadTime; +} + +void StorageFuelReload::setMaximumQuantityReloadTime(uint8_t pX) { + _maximumQuantityReloadTime = pX; +} + +uint8_t StorageFuelReload::getFuelMeasurementUnits() const { + return _fuelMeasurementUnits; +} + +void StorageFuelReload::setFuelMeasurementUnits(uint8_t pX) { + _fuelMeasurementUnits = pX; +} + +uint8_t StorageFuelReload::getFuelType() const { return _fuelType; } + +void StorageFuelReload::setFuelType(uint8_t pX) { _fuelType = pX; } + +uint8_t StorageFuelReload::getFuelLocation() const { + return _fuelLocation; +} + +void StorageFuelReload::setFuelLocation(uint8_t pX) { + _fuelLocation = pX; +} + +uint8_t StorageFuelReload::getPadding() const { return _padding; } + +void StorageFuelReload::setPadding(uint8_t pX) { _padding = pX; } + +void StorageFuelReload::marshal(DataStream& dataStream) const { + dataStream << _standardQuantity; + dataStream << _maximumQuantity; + dataStream << _standardQuantityReloadTime; + dataStream << _maximumQuantityReloadTime; + dataStream << _fuelMeasurementUnits; + dataStream << _fuelType; + dataStream << _fuelLocation; + dataStream << _padding; +} + +void StorageFuelReload::unmarshal(DataStream& dataStream) { + dataStream >> _standardQuantity; + dataStream >> _maximumQuantity; + dataStream >> _standardQuantityReloadTime; + dataStream >> _maximumQuantityReloadTime; + dataStream >> _fuelMeasurementUnits; + dataStream >> _fuelType; + dataStream >> _fuelLocation; + dataStream >> _padding; +} + +bool StorageFuelReload::operator==(const StorageFuelReload& rhs) const { + bool ivarsEqual = true; + + if (!(_standardQuantity == rhs._standardQuantity)) ivarsEqual = false; + if (!(_maximumQuantity == rhs._maximumQuantity)) ivarsEqual = false; + if (!(_standardQuantityReloadTime == rhs._standardQuantityReloadTime)) + ivarsEqual = false; + if (!(_maximumQuantityReloadTime == rhs._maximumQuantityReloadTime)) + ivarsEqual = false; + if (!(_fuelMeasurementUnits == rhs._fuelMeasurementUnits)) ivarsEqual = false; + if (!(_fuelType == rhs._fuelType)) ivarsEqual = false; + if (!(_fuelLocation == rhs._fuelLocation)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int StorageFuelReload::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _standardQuantity + marshalSize = marshalSize + 4; // _maximumQuantity + marshalSize = marshalSize + 1; // _standardQuantityReloadTime + marshalSize = marshalSize + 1; // _maximumQuantityReloadTime + marshalSize = marshalSize + 1; // _fuelMeasurementUnits + marshalSize = marshalSize + 1; // _fuelType + marshalSize = marshalSize + 1; // _fuelLocation + marshalSize = marshalSize + 1; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/StorageFuelReload.h b/src/dis7/common/StorageFuelReload.h new file mode 100644 index 00000000..5b0cb66b --- /dev/null +++ b/src/dis7/common/StorageFuelReload.h @@ -0,0 +1,126 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// For each type or location of Storage Fuel, this record shall specify the +// type, location, fuel measure- ment units, reload quantity and maximum +// quantity for storage fuel either for the whole entity or a specific storage +// fuel location (tank). Section 6.2.84. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT StorageFuelReload { + protected: + /** the standard quantity of this fuel type normally loaded at this + * station/launcher if a station/launcher is specified. If the + * Station/Launcher field is set to zero, then this is the total quantity of + * this fuel type that would be present in a standard reload of all appli- + * cable stations/launchers associated with this entity. */ + uint32_t _standardQuantity; + + /** the maximum quantity of this fuel type that this sta- tion/launcher is + * capable of holding when a station/launcher is specified. This would be the + * value used when a maximum reload was desired to be set for this + * station/launcher. If the Station/launcher field is set to zero, then this + * is the maximum quantity of this fuel type that would be present on this + * entity at all stations/launchers that can accept this fuel type. */ + uint32_t _maximumQuantity; + + /** the seconds normally required to reload the standard quantity of this fuel + * type at this specific station/launcher. When the Station/Launcher field is + * set to zero, this shall be the time it takes to perform a standard quantity + * reload of this fuel type at all applicable stations/launchers for this + * entity. */ + uint8_t _standardQuantityReloadTime; + + /** the seconds normally required to reload the maximum possible quantity of + * this fuel type at this station/launcher. When the Station/Launcher field is + * set to zero, this shall be the time it takes to perform a maximum quantity + * load/reload of this fuel type at all applicable stations/launchers for this + * entity. */ + uint8_t _maximumQuantityReloadTime; + + /** the fuel measurement units. Enumeration */ + uint8_t _fuelMeasurementUnits; + + /** Fuel type. Enumeration */ + uint8_t _fuelType; + + /** Location of fuel as related to entity. See section 14 of EBV document */ + uint8_t _fuelLocation; + + /** padding */ + uint8_t _padding; + + public: + StorageFuelReload(); + virtual ~StorageFuelReload(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getStandardQuantity() const; + void setStandardQuantity(uint32_t pX); + + uint32_t getMaximumQuantity() const; + void setMaximumQuantity(uint32_t pX); + + uint8_t getStandardQuantityReloadTime() const; + void setStandardQuantityReloadTime(uint8_t pX); + + uint8_t getMaximumQuantityReloadTime() const; + void setMaximumQuantityReloadTime(uint8_t pX); + + uint8_t getFuelMeasurementUnits() const; + void setFuelMeasurementUnits(uint8_t pX); + + uint8_t getFuelType() const; + void setFuelType(uint8_t pX); + + uint8_t getFuelLocation() const; + void setFuelLocation(uint8_t pX); + + uint8_t getPadding() const; + void setPadding(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StorageFuelReload& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/TotalRecordSets.cpp b/src/dis7/common/TotalRecordSets.cpp new file mode 100644 index 00000000..9dba9953 --- /dev/null +++ b/src/dis7/common/TotalRecordSets.cpp @@ -0,0 +1,77 @@ +#include "dis7/TotalRecordSets.h" + +using namespace DIS; + +TotalRecordSets::TotalRecordSets() : _totalRecordSets(0), _padding(0) {} + +TotalRecordSets::~TotalRecordSets() {} + +uint16_t TotalRecordSets::getTotalRecordSets() const { + return _totalRecordSets; +} + +void TotalRecordSets::setTotalRecordSets(uint16_t pX) { + _totalRecordSets = pX; +} + +uint16_t TotalRecordSets::getPadding() const { return _padding; } + +void TotalRecordSets::setPadding(uint16_t pX) { _padding = pX; } + +void TotalRecordSets::marshal(DataStream& dataStream) const { + dataStream << _totalRecordSets; + dataStream << _padding; +} + +void TotalRecordSets::unmarshal(DataStream& dataStream) { + dataStream >> _totalRecordSets; + dataStream >> _padding; +} + +bool TotalRecordSets::operator==(const TotalRecordSets& rhs) const { + bool ivarsEqual = true; + + if (!(_totalRecordSets == rhs._totalRecordSets)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int TotalRecordSets::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _totalRecordSets + marshalSize = marshalSize + 2; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/TotalRecordSets.h b/src/dis7/common/TotalRecordSets.h new file mode 100644 index 00000000..5fc5cda1 --- /dev/null +++ b/src/dis7/common/TotalRecordSets.h @@ -0,0 +1,71 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Total number of record sets contained in a logical set of one or more PDUs. +// Used to transfer ownership, etc Section 6.2.88 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT TotalRecordSets { + protected: + /** Total number of record sets */ + uint16_t _totalRecordSets; + + /** padding */ + uint16_t _padding; + + public: + TotalRecordSets(); + virtual ~TotalRecordSets(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getTotalRecordSets() const; + void setTotalRecordSets(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const TotalRecordSets& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/TwoByteChunk.cpp b/src/dis7/common/TwoByteChunk.cpp new file mode 100644 index 00000000..d1a01353 --- /dev/null +++ b/src/dis7/common/TwoByteChunk.cpp @@ -0,0 +1,86 @@ +#include "dis7/TwoByteChunk.h" + +using namespace DIS; + +TwoByteChunk::TwoByteChunk() { + // Initialize fixed length array + for (int lengthotherParameters = 0; lengthotherParameters < 2; + lengthotherParameters++) { + _otherParameters[lengthotherParameters] = 0; + } +} + +TwoByteChunk::~TwoByteChunk() {} + +char* TwoByteChunk::getOtherParameters() { return _otherParameters; } + +const char* TwoByteChunk::getOtherParameters() const { + return _otherParameters; +} + +void TwoByteChunk::setOtherParameters(const char* x) { + for (int i = 0; i < 2; i++) { + _otherParameters[i] = x[i]; + } +} + +void TwoByteChunk::marshal(DataStream& dataStream) const { + for (size_t idx = 0; idx < 2; idx++) { + dataStream << _otherParameters[idx]; + } +} + +void TwoByteChunk::unmarshal(DataStream& dataStream) { + for (size_t idx = 0; idx < 2; idx++) { + dataStream >> _otherParameters[idx]; + } +} + +bool TwoByteChunk::operator==(const TwoByteChunk& rhs) const { + bool ivarsEqual = true; + + for (uint8_t idx = 0; idx < 2; idx++) { + if (!(_otherParameters[idx] == rhs._otherParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int TwoByteChunk::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2 * 1; // _otherParameters + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/TwoByteChunk.h b/src/dis7/common/TwoByteChunk.h new file mode 100644 index 00000000..2f0e76a3 --- /dev/null +++ b/src/dis7/common/TwoByteChunk.h @@ -0,0 +1,65 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// 16 bit piece of data + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT TwoByteChunk { + protected: + /** two bytes of arbitrary data */ + char _otherParameters[2]; + + public: + TwoByteChunk(); + virtual ~TwoByteChunk(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + char* getOtherParameters(); + const char* getOtherParameters() const; + void setOtherParameters(const char* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const TwoByteChunk& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/UAFundamentalParameter.cpp b/src/dis7/common/UAFundamentalParameter.cpp new file mode 100644 index 00000000..778f9694 --- /dev/null +++ b/src/dis7/common/UAFundamentalParameter.cpp @@ -0,0 +1,142 @@ +#include "dis7/UAFundamentalParameter.h" + +using namespace DIS; + +UAFundamentalParameter::UAFundamentalParameter() + : _activeEmissionParameterIndex(0), + _scanPattern(0), + _beamCenterAzimuthHorizontal(0.0), + _azimuthalBeamwidthHorizontal(0.0), + _beamCenterDepressionElevation(0.0), + _beamwidthDownElevation(0.0) {} + +UAFundamentalParameter::~UAFundamentalParameter() {} + +uint16_t UAFundamentalParameter::getActiveEmissionParameterIndex() const { + return _activeEmissionParameterIndex; +} + +void UAFundamentalParameter::setActiveEmissionParameterIndex( + uint16_t pX) { + _activeEmissionParameterIndex = pX; +} + +uint16_t UAFundamentalParameter::getScanPattern() const { + return _scanPattern; +} + +void UAFundamentalParameter::setScanPattern(uint16_t pX) { + _scanPattern = pX; +} + +float UAFundamentalParameter::getBeamCenterAzimuthHorizontal() const { + return _beamCenterAzimuthHorizontal; +} + +void UAFundamentalParameter::setBeamCenterAzimuthHorizontal(float pX) { + _beamCenterAzimuthHorizontal = pX; +} + +float UAFundamentalParameter::getAzimuthalBeamwidthHorizontal() const { + return _azimuthalBeamwidthHorizontal; +} + +void UAFundamentalParameter::setAzimuthalBeamwidthHorizontal(float pX) { + _azimuthalBeamwidthHorizontal = pX; +} + +float UAFundamentalParameter::getBeamCenterDepressionElevation() const { + return _beamCenterDepressionElevation; +} + +void UAFundamentalParameter::setBeamCenterDepressionElevation(float pX) { + _beamCenterDepressionElevation = pX; +} + +float UAFundamentalParameter::getBeamwidthDownElevation() const { + return _beamwidthDownElevation; +} + +void UAFundamentalParameter::setBeamwidthDownElevation(float pX) { + _beamwidthDownElevation = pX; +} + +void UAFundamentalParameter::marshal(DataStream& dataStream) const { + dataStream << _activeEmissionParameterIndex; + dataStream << _scanPattern; + dataStream << _beamCenterAzimuthHorizontal; + dataStream << _azimuthalBeamwidthHorizontal; + dataStream << _beamCenterDepressionElevation; + dataStream << _beamwidthDownElevation; +} + +void UAFundamentalParameter::unmarshal(DataStream& dataStream) { + dataStream >> _activeEmissionParameterIndex; + dataStream >> _scanPattern; + dataStream >> _beamCenterAzimuthHorizontal; + dataStream >> _azimuthalBeamwidthHorizontal; + dataStream >> _beamCenterDepressionElevation; + dataStream >> _beamwidthDownElevation; +} + +bool UAFundamentalParameter::operator==( + const UAFundamentalParameter& rhs) const { + bool ivarsEqual = true; + + if (!(_activeEmissionParameterIndex == rhs._activeEmissionParameterIndex)) + ivarsEqual = false; + if (!(_scanPattern == rhs._scanPattern)) ivarsEqual = false; + if (!(_beamCenterAzimuthHorizontal == rhs._beamCenterAzimuthHorizontal)) + ivarsEqual = false; + if (!(_azimuthalBeamwidthHorizontal == rhs._azimuthalBeamwidthHorizontal)) + ivarsEqual = false; + if (!(_beamCenterDepressionElevation == rhs._beamCenterDepressionElevation)) + ivarsEqual = false; + if (!(_beamwidthDownElevation == rhs._beamwidthDownElevation)) + ivarsEqual = false; + + return ivarsEqual; +} + +int UAFundamentalParameter::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _activeEmissionParameterIndex + marshalSize = marshalSize + 2; // _scanPattern + marshalSize = marshalSize + 4; // _beamCenterAzimuthHorizontal + marshalSize = marshalSize + 4; // _azimuthalBeamwidthHorizontal + marshalSize = marshalSize + 4; // _beamCenterDepressionElevation + marshalSize = marshalSize + 4; // _beamwidthDownElevation + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/UAFundamentalParameter.h b/src/dis7/common/UAFundamentalParameter.h new file mode 100644 index 00000000..8f690be6 --- /dev/null +++ b/src/dis7/common/UAFundamentalParameter.h @@ -0,0 +1,99 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Regeneration parameters for active emission systems that are variable +// throughout a scenario. Section 6.2.90 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT UAFundamentalParameter { + protected: + /** Which database record shall be used. An enumeration from EBV document */ + uint16_t _activeEmissionParameterIndex; + + /** The type of scan pattern, If not used, zero. An enumeration from EBV + * document */ + uint16_t _scanPattern; + + /** center azimuth bearing of th emain beam. In radians. */ + float _beamCenterAzimuthHorizontal; + + /** Horizontal beamwidth of th emain beam Meastued at the 3dB down point of + * peak radiated power. In radians. */ + float _azimuthalBeamwidthHorizontal; + + /** center of the d/e angle of th emain beam relative to the stablised de + * angle of the target. In radians. */ + float _beamCenterDepressionElevation; + + /** vertical beamwidth of the main beam. Meastured at the 3dB down point of + * peak radiated power. In radians. */ + float _beamwidthDownElevation; + + public: + UAFundamentalParameter(); + virtual ~UAFundamentalParameter(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getActiveEmissionParameterIndex() const; + void setActiveEmissionParameterIndex(uint16_t pX); + + uint16_t getScanPattern() const; + void setScanPattern(uint16_t pX); + + float getBeamCenterAzimuthHorizontal() const; + void setBeamCenterAzimuthHorizontal(float pX); + + float getAzimuthalBeamwidthHorizontal() const; + void setAzimuthalBeamwidthHorizontal(float pX); + + float getBeamCenterDepressionElevation() const; + void setBeamCenterDepressionElevation(float pX); + + float getBeamwidthDownElevation() const; + void setBeamwidthDownElevation(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const UAFundamentalParameter& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/UnattachedIdentifier.cpp b/src/dis7/common/UnattachedIdentifier.cpp new file mode 100644 index 00000000..5a28d55f --- /dev/null +++ b/src/dis7/common/UnattachedIdentifier.cpp @@ -0,0 +1,87 @@ +#include "dis7/UnattachedIdentifier.h" + +using namespace DIS; + +UnattachedIdentifier::UnattachedIdentifier() + : _simulationAddress(), _referenceNumber(0) {} + +UnattachedIdentifier::~UnattachedIdentifier() {} + +SimulationAddress& UnattachedIdentifier::getSimulationAddress() { + return _simulationAddress; +} + +const SimulationAddress& UnattachedIdentifier::getSimulationAddress() const { + return _simulationAddress; +} + +void UnattachedIdentifier::setSimulationAddress(const SimulationAddress& pX) { + _simulationAddress = pX; +} + +uint16_t UnattachedIdentifier::getReferenceNumber() const { + return _referenceNumber; +} + +void UnattachedIdentifier::setReferenceNumber(uint16_t pX) { + _referenceNumber = pX; +} + +void UnattachedIdentifier::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _referenceNumber; +} + +void UnattachedIdentifier::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _referenceNumber; +} + +bool UnattachedIdentifier::operator==(const UnattachedIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_referenceNumber == rhs._referenceNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int UnattachedIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _referenceNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/UnattachedIdentifier.h b/src/dis7/common/UnattachedIdentifier.h new file mode 100644 index 00000000..371bc171 --- /dev/null +++ b/src/dis7/common/UnattachedIdentifier.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of one or more unattached radios in an event or +// exercise Section 6.2.91 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT UnattachedIdentifier { + protected: + /** See 6.2.79 */ + SimulationAddress _simulationAddress; + + /** Reference number */ + uint16_t _referenceNumber; + + public: + UnattachedIdentifier(); + virtual ~UnattachedIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getSimulationAddress(); + const SimulationAddress& getSimulationAddress() const; + void setSimulationAddress(const SimulationAddress& pX); + + uint16_t getReferenceNumber() const; + void setReferenceNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const UnattachedIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/UnsignedDISInteger.cpp b/src/dis7/common/UnsignedDISInteger.cpp new file mode 100644 index 00000000..6bb9b8ea --- /dev/null +++ b/src/dis7/common/UnsignedDISInteger.cpp @@ -0,0 +1,65 @@ +#include "dis7/UnsignedDISInteger.h" + +using namespace DIS; + +UnsignedDISInteger::UnsignedDISInteger() : _val(0) {} + +UnsignedDISInteger::~UnsignedDISInteger() {} + +uint32_t UnsignedDISInteger::getVal() const { return _val; } + +void UnsignedDISInteger::setVal(uint32_t pX) { _val = pX; } + +void UnsignedDISInteger::marshal(DataStream& dataStream) const { + dataStream << _val; +} + +void UnsignedDISInteger::unmarshal(DataStream& dataStream) { + dataStream >> _val; +} + +bool UnsignedDISInteger::operator==(const UnsignedDISInteger& rhs) const { + bool ivarsEqual = true; + + if (!(_val == rhs._val)) ivarsEqual = false; + + return ivarsEqual; +} + +int UnsignedDISInteger::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _val + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/UnsignedDISInteger.h b/src/dis7/common/UnsignedDISInteger.h similarity index 76% rename from src/dis7/UnsignedDISInteger.h rename to src/dis7/common/UnsignedDISInteger.h index 7015d2fe..6fc1dd8d 100644 --- a/src/dis7/UnsignedDISInteger.h +++ b/src/dis7/common/UnsignedDISInteger.h @@ -1,46 +1,42 @@ #pragma once -#include -#include +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" - -namespace DIS -{ +namespace DIS { // container class not in specification -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. // // @author DMcG, jkg -class OPENDIS7_EXPORT UnsignedDISInteger -{ -protected: - /** unsigned integer */ - unsigned int _val; - +class OPENDIS7_EXPORT UnsignedDISInteger { + protected: + /** uint32_teger */ + uint32_t _val; public: - UnsignedDISInteger(); - virtual ~UnsignedDISInteger(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); + UnsignedDISInteger(); + virtual ~UnsignedDISInteger(); - unsigned int getVal() const; - void setVal(unsigned int pX); + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + uint32_t getVal() const; + void setVal(uint32_t pX); -virtual int getMarshalledSize() const; + virtual int getMarshalledSize() const; - bool operator ==(const UnsignedDISInteger& rhs) const; + bool operator==(const UnsignedDISInteger& rhs) const; }; -} +} // namespace DIS // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright @@ -53,7 +49,7 @@ virtual int getMarshalledSize() const; // nor the names of its contributors may be used to endorse or // promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/src/dis7/common/VariableDatum.cpp b/src/dis7/common/VariableDatum.cpp new file mode 100644 index 00000000..9c89542e --- /dev/null +++ b/src/dis7/common/VariableDatum.cpp @@ -0,0 +1,115 @@ +#include "dis7/VariableDatum.h" + +using namespace DIS; + +VariableDatum::VariableDatum() + : _variableDatumID(0), + _variableDatumLength(0), + _variableDatumBits(0), + _padding(0) {} + +VariableDatum::~VariableDatum() {} + +uint32_t VariableDatum::getVariableDatumID() const { + return _variableDatumID; +} + +void VariableDatum::setVariableDatumID(uint32_t pX) { + _variableDatumID = pX; +} + +uint32_t VariableDatum::getVariableDatumLength() const { + return _variableDatumLength; +} + +void VariableDatum::setVariableDatumLength(uint32_t pX) { + _variableDatumLength = pX; +} + +uint32_t VariableDatum::getVariableDatumBits() const { + return _variableDatumBits; +} + +void VariableDatum::setVariableDatumBits(uint32_t pX) { + _variableDatumBits = pX; +} + +uint32_t VariableDatum::getPadding() const { return _padding; } + +void VariableDatum::setPadding(uint32_t pX) { _padding = pX; } + +void VariableDatum::marshal(DataStream& dataStream) const { + dataStream << _variableDatumID; + dataStream << (uint32_t)_variableDatums.size() * 64; + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + EightByteChunk x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void VariableDatum::unmarshal(DataStream& dataStream) { + dataStream >> _variableDatumID; + dataStream >> _variableDatumLength; + _variableDatumLength = + (_variableDatumLength / 64) + ((_variableDatumLength % 64) > 0); + + _variableDatums.clear(); + for (size_t idx = 0; idx < _variableDatumLength; idx++) { + EightByteChunk x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool VariableDatum::operator==(const VariableDatum& rhs) const { + bool ivarsEqual = true; + + if (!(_variableDatumID == rhs._variableDatumID)) ivarsEqual = false; + if (!(_variableDatumLength == rhs._variableDatumLength)) ivarsEqual = false; + if (!(_variableDatumBits == rhs._variableDatumBits)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + + return ivarsEqual; +} + +int VariableDatum::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _variableDatumID + marshalSize = marshalSize + 4; // _variableDatumLength + marshalSize = marshalSize + 4; // _variableDatumBits + marshalSize = marshalSize + 4; // _padding + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/VariableDatum.h b/src/dis7/common/VariableDatum.h new file mode 100644 index 00000000..c1a9d31b --- /dev/null +++ b/src/dis7/common/VariableDatum.h @@ -0,0 +1,91 @@ +#pragma once + +#include + +#include "dis7/EightByteChunk.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// the variable datum type, the datum length, and the value for that variable +// datum type. NOT COMPLETE. Section 6.2.92 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT VariableDatum { + protected: + /** Type of variable datum to be transmitted. 32 bit enumeration defined in + * EBV */ + uint32_t _variableDatumID; + + /** Length, in bits, of the variable datum. */ + uint32_t _variableDatumLength; + + /** Variable datum. This can be any number of bits long, depending on the + * datum. */ + uint32_t _variableDatumBits; + + /** padding to put the record on a 64 bit boundary */ + uint32_t _padding; + + // Variable Data + std::vector _variableDatums; + + public: + VariableDatum(); + virtual ~VariableDatum(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getVariableDatumID() const; + void setVariableDatumID(uint32_t pX); + + uint32_t getVariableDatumLength() const; + void setVariableDatumLength(uint32_t pX); + + uint32_t getVariableDatumBits() const; + void setVariableDatumBits(uint32_t pX); + + uint32_t getPadding() const; + void setPadding(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const VariableDatum& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/VariableParameter.cpp b/src/dis7/common/VariableParameter.cpp new file mode 100644 index 00000000..f7e3e998 --- /dev/null +++ b/src/dis7/common/VariableParameter.cpp @@ -0,0 +1,122 @@ +#include "dis7/VariableParameter.h" + +using namespace DIS; + +VariableParameter::VariableParameter() + : _recordType(0), + _variableParameterFields1(0.0), + _variableParameterFields2(0), + _variableParameterFields3(0), + _variableParameterFields4(0) {} + +VariableParameter::~VariableParameter() {} + +uint8_t VariableParameter::getRecordType() const { return _recordType; } + +void VariableParameter::setRecordType(uint8_t pX) { _recordType = pX; } + +double VariableParameter::getVariableParameterFields1() const { + return _variableParameterFields1; +} + +void VariableParameter::setVariableParameterFields1(double pX) { + _variableParameterFields1 = pX; +} + +uint32_t VariableParameter::getVariableParameterFields2() const { + return _variableParameterFields2; +} + +void VariableParameter::setVariableParameterFields2(uint32_t pX) { + _variableParameterFields2 = pX; +} + +uint16_t VariableParameter::getVariableParameterFields3() const { + return _variableParameterFields3; +} + +void VariableParameter::setVariableParameterFields3(uint16_t pX) { + _variableParameterFields3 = pX; +} + +uint8_t VariableParameter::getVariableParameterFields4() const { + return _variableParameterFields4; +} + +void VariableParameter::setVariableParameterFields4(uint8_t pX) { + _variableParameterFields4 = pX; +} + +void VariableParameter::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _variableParameterFields1; + dataStream << _variableParameterFields2; + dataStream << _variableParameterFields3; + dataStream << _variableParameterFields4; +} + +void VariableParameter::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _variableParameterFields1; + dataStream >> _variableParameterFields2; + dataStream >> _variableParameterFields3; + dataStream >> _variableParameterFields4; +} + +bool VariableParameter::operator==(const VariableParameter& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_variableParameterFields1 == rhs._variableParameterFields1)) + ivarsEqual = false; + if (!(_variableParameterFields2 == rhs._variableParameterFields2)) + ivarsEqual = false; + if (!(_variableParameterFields3 == rhs._variableParameterFields3)) + ivarsEqual = false; + if (!(_variableParameterFields4 == rhs._variableParameterFields4)) + ivarsEqual = false; + + return ivarsEqual; +} + +int VariableParameter::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _recordType + marshalSize = marshalSize + 8; // _variableParameterFields1 + marshalSize = marshalSize + 4; // _variableParameterFields2 + marshalSize = marshalSize + 2; // _variableParameterFields3 + marshalSize = marshalSize + 1; // _variableParameterFields4 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/VariableParameter.h b/src/dis7/common/VariableParameter.h new file mode 100644 index 00000000..5a2c2638 --- /dev/null +++ b/src/dis7/common/VariableParameter.h @@ -0,0 +1,90 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// specification of additional information associated with an entity or +// detonation, not otherwise accounted for in a PDU 6.2.93.1 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT VariableParameter { + protected: + /** the identification of the Variable Parameter record. Enumeration from EBV + */ + uint8_t _recordType; + + /** Variable parameter data fields. Two doubles minus one byte */ + double _variableParameterFields1; + + /** Variable parameter data fields. */ + uint32_t _variableParameterFields2; + + /** Variable parameter data fields. */ + uint16_t _variableParameterFields3; + + /** Variable parameter data fields. */ + uint8_t _variableParameterFields4; + + public: + VariableParameter(); + virtual ~VariableParameter(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRecordType() const; + void setRecordType(uint8_t pX); + + double getVariableParameterFields1() const; + void setVariableParameterFields1(double pX); + + uint32_t getVariableParameterFields2() const; + void setVariableParameterFields2(uint32_t pX); + + uint16_t getVariableParameterFields3() const; + void setVariableParameterFields3(uint16_t pX); + + uint8_t getVariableParameterFields4() const; + void setVariableParameterFields4(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const VariableParameter& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/VariableTransmitterParameters.cpp b/src/dis7/common/VariableTransmitterParameters.cpp new file mode 100644 index 00000000..5ab34cc1 --- /dev/null +++ b/src/dis7/common/VariableTransmitterParameters.cpp @@ -0,0 +1,83 @@ +#include "dis7/VariableTransmitterParameters.h" + +using namespace DIS; + +VariableTransmitterParameters::VariableTransmitterParameters() + : _recordType(4), _recordLength(4) {} + +VariableTransmitterParameters::~VariableTransmitterParameters() {} + +uint32_t VariableTransmitterParameters::getRecordType() const { + return _recordType; +} + +void VariableTransmitterParameters::setRecordType(uint32_t pX) { + _recordType = pX; +} + +uint32_t VariableTransmitterParameters::getRecordLength() const { + return _recordLength; +} + +void VariableTransmitterParameters::setRecordLength(uint32_t pX) { + _recordLength = pX; +} + +void VariableTransmitterParameters::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; +} + +void VariableTransmitterParameters::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; +} + +bool VariableTransmitterParameters::operator==( + const VariableTransmitterParameters& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + + return ivarsEqual; +} + +int VariableTransmitterParameters::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 4; // _recordLength + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/VariableTransmitterParameters.h b/src/dis7/common/VariableTransmitterParameters.h new file mode 100644 index 00000000..87354fe5 --- /dev/null +++ b/src/dis7/common/VariableTransmitterParameters.h @@ -0,0 +1,70 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Relates to radios. NOT COMPLETE. Section 6.2.94 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT VariableTransmitterParameters { + protected: + /** Type of VTP. Enumeration from EBV */ + uint32_t _recordType; + + /** Length, in bytes */ + uint32_t _recordLength; + + public: + VariableTransmitterParameters(); + virtual ~VariableTransmitterParameters(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint32_t getRecordLength() const; + void setRecordLength(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const VariableTransmitterParameters& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Vector3Double.cpp b/src/dis7/common/Vector3Double.cpp new file mode 100644 index 00000000..52338305 --- /dev/null +++ b/src/dis7/common/Vector3Double.cpp @@ -0,0 +1,81 @@ +#include "dis7/Vector3Double.h" + +using namespace DIS; + +Vector3Double::Vector3Double() : _x(0.0), _y(0.0), _z(0.0) {} + +Vector3Double::~Vector3Double() {} + +double Vector3Double::getX() const { return _x; } + +void Vector3Double::setX(double pX) { _x = pX; } + +double Vector3Double::getY() const { return _y; } + +void Vector3Double::setY(double pX) { _y = pX; } + +double Vector3Double::getZ() const { return _z; } + +void Vector3Double::setZ(double pX) { _z = pX; } + +void Vector3Double::marshal(DataStream& dataStream) const { + dataStream << _x; + dataStream << _y; + dataStream << _z; +} + +void Vector3Double::unmarshal(DataStream& dataStream) { + dataStream >> _x; + dataStream >> _y; + dataStream >> _z; +} + +bool Vector3Double::operator==(const Vector3Double& rhs) const { + bool ivarsEqual = true; + + if (!(_x == rhs._x)) ivarsEqual = false; + if (!(_y == rhs._y)) ivarsEqual = false; + if (!(_z == rhs._z)) ivarsEqual = false; + + return ivarsEqual; +} + +int Vector3Double::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 8; // _x + marshalSize = marshalSize + 8; // _y + marshalSize = marshalSize + 8; // _z + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Vector3Double.h b/src/dis7/common/Vector3Double.h new file mode 100644 index 00000000..2d494f37 --- /dev/null +++ b/src/dis7/common/Vector3Double.h @@ -0,0 +1,77 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Three double precision floating point values, x, y, and z. Used for world +// coordinates Section 6.2.97. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Vector3Double { + protected: + /** X value */ + double _x; + + /** y Value */ + double _y; + + /** Z value */ + double _z; + + public: + Vector3Double(); + virtual ~Vector3Double(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + double getX() const; + void setX(double pX); + + double getY() const; + void setY(double pX); + + double getZ() const; + void setZ(double pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Vector3Double& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Vector3Float.cpp b/src/dis7/common/Vector3Float.cpp new file mode 100644 index 00000000..921a219d --- /dev/null +++ b/src/dis7/common/Vector3Float.cpp @@ -0,0 +1,81 @@ +#include "dis7/Vector3Float.h" + +using namespace DIS; + +Vector3Float::Vector3Float() : _x(0.0), _y(0.0), _z(0.0) {} + +Vector3Float::~Vector3Float() {} + +float Vector3Float::getX() const { return _x; } + +void Vector3Float::setX(float pX) { _x = pX; } + +float Vector3Float::getY() const { return _y; } + +void Vector3Float::setY(float pX) { _y = pX; } + +float Vector3Float::getZ() const { return _z; } + +void Vector3Float::setZ(float pX) { _z = pX; } + +void Vector3Float::marshal(DataStream& dataStream) const { + dataStream << _x; + dataStream << _y; + dataStream << _z; +} + +void Vector3Float::unmarshal(DataStream& dataStream) { + dataStream >> _x; + dataStream >> _y; + dataStream >> _z; +} + +bool Vector3Float::operator==(const Vector3Float& rhs) const { + bool ivarsEqual = true; + + if (!(_x == rhs._x)) ivarsEqual = false; + if (!(_y == rhs._y)) ivarsEqual = false; + if (!(_z == rhs._z)) ivarsEqual = false; + + return ivarsEqual; +} + +int Vector3Float::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _x + marshalSize = marshalSize + 4; // _y + marshalSize = marshalSize + 4; // _z + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/common/Vector3Float.h b/src/dis7/common/Vector3Float.h new file mode 100644 index 00000000..375bf676 --- /dev/null +++ b/src/dis7/common/Vector3Float.h @@ -0,0 +1,76 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Three floating point values, x, y, and z. Section 6.2.95 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Vector3Float { + protected: + /** X value */ + float _x; + + /** y Value */ + float _y; + + /** Z value */ + float _z; + + public: + Vector3Float(); + virtual ~Vector3Float(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getX() const; + void setX(float pX); + + float getY() const; + void setY(float pX); + + float getZ() const; + void setZ(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Vector3Float& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/BeamData.cpp b/src/dis7/distributed_emissions/BeamData.cpp new file mode 100644 index 00000000..4f002bd2 --- /dev/null +++ b/src/dis7/distributed_emissions/BeamData.cpp @@ -0,0 +1,102 @@ +#include "dis7/BeamData.h" + +using namespace DIS; + +BeamData::BeamData() + : _beamAzimuthCenter(0.0), + _beamAzimuthSweep(0.0), + _beamElevationCenter(0.0), + _beamElevationSweep(0.0), + _beamSweepSync(0.0) {} + +BeamData::~BeamData() {} + +float BeamData::getBeamAzimuthCenter() const { return _beamAzimuthCenter; } + +void BeamData::setBeamAzimuthCenter(float pX) { _beamAzimuthCenter = pX; } + +float BeamData::getBeamAzimuthSweep() const { return _beamAzimuthSweep; } + +void BeamData::setBeamAzimuthSweep(float pX) { _beamAzimuthSweep = pX; } + +float BeamData::getBeamElevationCenter() const { return _beamElevationCenter; } + +void BeamData::setBeamElevationCenter(float pX) { _beamElevationCenter = pX; } + +float BeamData::getBeamElevationSweep() const { return _beamElevationSweep; } + +void BeamData::setBeamElevationSweep(float pX) { _beamElevationSweep = pX; } + +float BeamData::getBeamSweepSync() const { return _beamSweepSync; } + +void BeamData::setBeamSweepSync(float pX) { _beamSweepSync = pX; } + +void BeamData::marshal(DataStream& dataStream) const { + dataStream << _beamAzimuthCenter; + dataStream << _beamAzimuthSweep; + dataStream << _beamElevationCenter; + dataStream << _beamElevationSweep; + dataStream << _beamSweepSync; +} + +void BeamData::unmarshal(DataStream& dataStream) { + dataStream >> _beamAzimuthCenter; + dataStream >> _beamAzimuthSweep; + dataStream >> _beamElevationCenter; + dataStream >> _beamElevationSweep; + dataStream >> _beamSweepSync; +} + +bool BeamData::operator==(const BeamData& rhs) const { + bool ivarsEqual = true; + + if (!(_beamAzimuthCenter == rhs._beamAzimuthCenter)) ivarsEqual = false; + if (!(_beamAzimuthSweep == rhs._beamAzimuthSweep)) ivarsEqual = false; + if (!(_beamElevationCenter == rhs._beamElevationCenter)) ivarsEqual = false; + if (!(_beamElevationSweep == rhs._beamElevationSweep)) ivarsEqual = false; + if (!(_beamSweepSync == rhs._beamSweepSync)) ivarsEqual = false; + + return ivarsEqual; +} + +int BeamData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _beamAzimuthCenter + marshalSize = marshalSize + 4; // _beamAzimuthSweep + marshalSize = marshalSize + 4; // _beamElevationCenter + marshalSize = marshalSize + 4; // _beamElevationSweep + marshalSize = marshalSize + 4; // _beamSweepSync + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/BeamData.h b/src/dis7/distributed_emissions/BeamData.h new file mode 100644 index 00000000..a79aba55 --- /dev/null +++ b/src/dis7/distributed_emissions/BeamData.h @@ -0,0 +1,91 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Describes the scan volue of an emitter beam. Section 6.2.13. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT BeamData { + protected: + /** Specifies the beam azimuth an elevation centers and corresponding + * half-angles to describe the scan volume */ + float _beamAzimuthCenter; + + /** Specifies the beam azimuth sweep to determine scan volume */ + float _beamAzimuthSweep; + + /** Specifies the beam elevation center to determine scan volume */ + float _beamElevationCenter; + + /** Specifies the beam elevation sweep to determine scan volume */ + float _beamElevationSweep; + + /** allows receiver to synchronize its regenerated scan pattern to that of the + * emmitter. Specifies the percentage of time a scan is through its pattern + * from its origion. */ + float _beamSweepSync; + + public: + BeamData(); + virtual ~BeamData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getBeamAzimuthCenter() const; + void setBeamAzimuthCenter(float pX); + + float getBeamAzimuthSweep() const; + void setBeamAzimuthSweep(float pX); + + float getBeamElevationCenter() const; + void setBeamElevationCenter(float pX); + + float getBeamElevationSweep() const; + void setBeamElevationSweep(float pX); + + float getBeamSweepSync() const; + void setBeamSweepSync(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const BeamData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/CMakeLists.txt b/src/dis7/distributed_emissions/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/distributed_emissions/DesignatorPdu.cpp b/src/dis7/distributed_emissions/DesignatorPdu.cpp new file mode 100644 index 00000000..69130a70 --- /dev/null +++ b/src/dis7/distributed_emissions/DesignatorPdu.cpp @@ -0,0 +1,238 @@ +#include "dis7/DesignatorPdu.h" + +using namespace DIS; + +DesignatorPdu::DesignatorPdu() + : DistributedEmissionsFamilyPdu(), + _designatingEntityID(), + _codeName(0), + _designatedEntityID(), + _designatorCode(0), + _designatorPower(0.0), + _designatorWavelength(0.0), + _designatorSpotWrtDesignated(), + _designatorSpotLocation(), + _deadReckoningAlgorithm(0), + _padding1(0), + _padding2(0), + _entityLinearAcceleration() { + setPduType(24); +} + +DesignatorPdu::~DesignatorPdu() {} + +EntityID& DesignatorPdu::getDesignatingEntityID() { + return _designatingEntityID; +} + +const EntityID& DesignatorPdu::getDesignatingEntityID() const { + return _designatingEntityID; +} + +void DesignatorPdu::setDesignatingEntityID(const EntityID& pX) { + _designatingEntityID = pX; +} + +uint16_t DesignatorPdu::getCodeName() const { return _codeName; } + +void DesignatorPdu::setCodeName(uint16_t pX) { _codeName = pX; } + +EntityID& DesignatorPdu::getDesignatedEntityID() { return _designatedEntityID; } + +const EntityID& DesignatorPdu::getDesignatedEntityID() const { + return _designatedEntityID; +} + +void DesignatorPdu::setDesignatedEntityID(const EntityID& pX) { + _designatedEntityID = pX; +} + +uint16_t DesignatorPdu::getDesignatorCode() const { + return _designatorCode; +} + +void DesignatorPdu::setDesignatorCode(uint16_t pX) { + _designatorCode = pX; +} + +float DesignatorPdu::getDesignatorPower() const { return _designatorPower; } + +void DesignatorPdu::setDesignatorPower(float pX) { _designatorPower = pX; } + +float DesignatorPdu::getDesignatorWavelength() const { + return _designatorWavelength; +} + +void DesignatorPdu::setDesignatorWavelength(float pX) { + _designatorWavelength = pX; +} + +Vector3Float& DesignatorPdu::getDesignatorSpotWrtDesignated() { + return _designatorSpotWrtDesignated; +} + +const Vector3Float& DesignatorPdu::getDesignatorSpotWrtDesignated() const { + return _designatorSpotWrtDesignated; +} + +void DesignatorPdu::setDesignatorSpotWrtDesignated(const Vector3Float& pX) { + _designatorSpotWrtDesignated = pX; +} + +Vector3Double& DesignatorPdu::getDesignatorSpotLocation() { + return _designatorSpotLocation; +} + +const Vector3Double& DesignatorPdu::getDesignatorSpotLocation() const { + return _designatorSpotLocation; +} + +void DesignatorPdu::setDesignatorSpotLocation(const Vector3Double& pX) { + _designatorSpotLocation = pX; +} + +char DesignatorPdu::getDeadReckoningAlgorithm() const { + return _deadReckoningAlgorithm; +} + +void DesignatorPdu::setDeadReckoningAlgorithm(char pX) { + _deadReckoningAlgorithm = pX; +} + +uint16_t DesignatorPdu::getPadding1() const { return _padding1; } + +void DesignatorPdu::setPadding1(uint16_t pX) { _padding1 = pX; } + +char DesignatorPdu::getPadding2() const { return _padding2; } + +void DesignatorPdu::setPadding2(char pX) { _padding2 = pX; } + +Vector3Float& DesignatorPdu::getEntityLinearAcceleration() { + return _entityLinearAcceleration; +} + +const Vector3Float& DesignatorPdu::getEntityLinearAcceleration() const { + return _entityLinearAcceleration; +} + +void DesignatorPdu::setEntityLinearAcceleration(const Vector3Float& pX) { + _entityLinearAcceleration = pX; +} + +void DesignatorPdu::marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _designatingEntityID.marshal(dataStream); + dataStream << _codeName; + _designatedEntityID.marshal(dataStream); + dataStream << _designatorCode; + dataStream << _designatorPower; + dataStream << _designatorWavelength; + _designatorSpotWrtDesignated.marshal(dataStream); + _designatorSpotLocation.marshal(dataStream); + dataStream << _deadReckoningAlgorithm; + dataStream << _padding1; + dataStream << _padding2; + _entityLinearAcceleration.marshal(dataStream); +} + +void DesignatorPdu::unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _designatingEntityID.unmarshal(dataStream); + dataStream >> _codeName; + _designatedEntityID.unmarshal(dataStream); + dataStream >> _designatorCode; + dataStream >> _designatorPower; + dataStream >> _designatorWavelength; + _designatorSpotWrtDesignated.unmarshal(dataStream); + _designatorSpotLocation.unmarshal(dataStream); + dataStream >> _deadReckoningAlgorithm; + dataStream >> _padding1; + dataStream >> _padding2; + _entityLinearAcceleration.unmarshal(dataStream); +} + +bool DesignatorPdu::operator==(const DesignatorPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_designatingEntityID == rhs._designatingEntityID)) ivarsEqual = false; + if (!(_codeName == rhs._codeName)) ivarsEqual = false; + if (!(_designatedEntityID == rhs._designatedEntityID)) ivarsEqual = false; + if (!(_designatorCode == rhs._designatorCode)) ivarsEqual = false; + if (!(_designatorPower == rhs._designatorPower)) ivarsEqual = false; + if (!(_designatorWavelength == rhs._designatorWavelength)) ivarsEqual = false; + if (!(_designatorSpotWrtDesignated == rhs._designatorSpotWrtDesignated)) + ivarsEqual = false; + if (!(_designatorSpotLocation == rhs._designatorSpotLocation)) + ivarsEqual = false; + if (!(_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm)) + ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_entityLinearAcceleration == rhs._entityLinearAcceleration)) + ivarsEqual = false; + + return ivarsEqual; +} + +int DesignatorPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + + _designatingEntityID.getMarshalledSize(); // _designatingEntityID + marshalSize = marshalSize + 2; // _codeName + marshalSize = marshalSize + + _designatedEntityID.getMarshalledSize(); // _designatedEntityID + marshalSize = marshalSize + 2; // _designatorCode + marshalSize = marshalSize + 4; // _designatorPower + marshalSize = marshalSize + 4; // _designatorWavelength + marshalSize = + marshalSize + _designatorSpotWrtDesignated + .getMarshalledSize(); // _designatorSpotWrtDesignated + marshalSize = + marshalSize + + _designatorSpotLocation.getMarshalledSize(); // _designatorSpotLocation + marshalSize = marshalSize + 1; // _deadReckoningAlgorithm + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 1; // _padding2 + marshalSize = + marshalSize + _entityLinearAcceleration + .getMarshalledSize(); // _entityLinearAcceleration + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/DesignatorPdu.h b/src/dis7/distributed_emissions/DesignatorPdu.h new file mode 100644 index 00000000..5dd0aa41 --- /dev/null +++ b/src/dis7/distributed_emissions/DesignatorPdu.h @@ -0,0 +1,142 @@ +#pragma once + +#include "dis7/DistributedEmissionsFamilyPdu.h" +#include "dis7/EntityID.h" +#include "dis7/Vector3Double.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.7.2. Handles designating operations. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DesignatorPdu : public DistributedEmissionsFamilyPdu { + protected: + /** ID of the entity designating */ + EntityID _designatingEntityID; + + /** This field shall specify a unique emitter database number assigned to + * differentiate between otherwise similar or identical emitter beams within + * an emitter system. */ + uint16_t _codeName; + + /** ID of the entity being designated */ + EntityID _designatedEntityID; + + /** This field shall identify the designator code being used by the + * designating entity */ + uint16_t _designatorCode; + + /** This field shall identify the designator output power in watts */ + float _designatorPower; + + /** This field shall identify the designator wavelength in units of microns */ + float _designatorWavelength; + + /** designtor spot wrt the designated entity */ + Vector3Float _designatorSpotWrtDesignated; + + /** designtor spot wrt the designated entity */ + Vector3Double _designatorSpotLocation; + + /** Dead reckoning algorithm */ + char _deadReckoningAlgorithm; + + /** padding */ + uint16_t _padding1; + + /** padding */ + char _padding2; + + /** linear accelleration of entity */ + Vector3Float _entityLinearAcceleration; + + public: + DesignatorPdu(); + virtual ~DesignatorPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getDesignatingEntityID(); + const EntityID& getDesignatingEntityID() const; + void setDesignatingEntityID(const EntityID& pX); + + uint16_t getCodeName() const; + void setCodeName(uint16_t pX); + + EntityID& getDesignatedEntityID(); + const EntityID& getDesignatedEntityID() const; + void setDesignatedEntityID(const EntityID& pX); + + uint16_t getDesignatorCode() const; + void setDesignatorCode(uint16_t pX); + + float getDesignatorPower() const; + void setDesignatorPower(float pX); + + float getDesignatorWavelength() const; + void setDesignatorWavelength(float pX); + + Vector3Float& getDesignatorSpotWrtDesignated(); + const Vector3Float& getDesignatorSpotWrtDesignated() const; + void setDesignatorSpotWrtDesignated(const Vector3Float& pX); + + Vector3Double& getDesignatorSpotLocation(); + const Vector3Double& getDesignatorSpotLocation() const; + void setDesignatorSpotLocation(const Vector3Double& pX); + + char getDeadReckoningAlgorithm() const; + void setDeadReckoningAlgorithm(char pX); + + uint16_t getPadding1() const; + void setPadding1(uint16_t pX); + + char getPadding2() const; + void setPadding2(char pX); + + Vector3Float& getEntityLinearAcceleration(); + const Vector3Float& getEntityLinearAcceleration() const; + void setEntityLinearAcceleration(const Vector3Float& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DesignatorPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/DistributedEmissionsFamilyPdu.cpp b/src/dis7/distributed_emissions/DistributedEmissionsFamilyPdu.cpp new file mode 100644 index 00000000..e6a3697e --- /dev/null +++ b/src/dis7/distributed_emissions/DistributedEmissionsFamilyPdu.cpp @@ -0,0 +1,67 @@ +#include "dis7/DistributedEmissionsFamilyPdu.h" + +using namespace DIS; + +DistributedEmissionsFamilyPdu::DistributedEmissionsFamilyPdu() + : Pdu() + +{ + setProtocolFamily(6); +} + +DistributedEmissionsFamilyPdu::~DistributedEmissionsFamilyPdu() {} + +void DistributedEmissionsFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void DistributedEmissionsFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool DistributedEmissionsFamilyPdu::operator==( + const DistributedEmissionsFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int DistributedEmissionsFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/DistributedEmissionsFamilyPdu.h b/src/dis7/distributed_emissions/DistributedEmissionsFamilyPdu.h new file mode 100644 index 00000000..11cba817 --- /dev/null +++ b/src/dis7/distributed_emissions/DistributedEmissionsFamilyPdu.h @@ -0,0 +1,60 @@ +#pragma once + +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.7. Electromagnetic Emissions. Abstract superclass for distirubted +// emissions PDU + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DistributedEmissionsFamilyPdu : public Pdu { + protected: + public: + DistributedEmissionsFamilyPdu(); + virtual ~DistributedEmissionsFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const DistributedEmissionsFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/EEFundamentalParameterData.cpp b/src/dis7/distributed_emissions/EEFundamentalParameterData.cpp new file mode 100644 index 00000000..787235ca --- /dev/null +++ b/src/dis7/distributed_emissions/EEFundamentalParameterData.cpp @@ -0,0 +1,117 @@ +#include "dis7/EEFundamentalParameterData.h" + +using namespace DIS; + +EEFundamentalParameterData::EEFundamentalParameterData() + : _frequency(0.0), + _frequencyRange(0.0), + _effectiveRadiatedPower(0.0), + _pulseRepetitionFrequency(0.0), + _pulseWidth(0.0) {} + +EEFundamentalParameterData::~EEFundamentalParameterData() {} + +float EEFundamentalParameterData::getFrequency() const { return _frequency; } + +void EEFundamentalParameterData::setFrequency(float pX) { _frequency = pX; } + +float EEFundamentalParameterData::getFrequencyRange() const { + return _frequencyRange; +} + +void EEFundamentalParameterData::setFrequencyRange(float pX) { + _frequencyRange = pX; +} + +float EEFundamentalParameterData::getEffectiveRadiatedPower() const { + return _effectiveRadiatedPower; +} + +void EEFundamentalParameterData::setEffectiveRadiatedPower(float pX) { + _effectiveRadiatedPower = pX; +} + +float EEFundamentalParameterData::getPulseRepetitionFrequency() const { + return _pulseRepetitionFrequency; +} + +void EEFundamentalParameterData::setPulseRepetitionFrequency(float pX) { + _pulseRepetitionFrequency = pX; +} + +float EEFundamentalParameterData::getPulseWidth() const { return _pulseWidth; } + +void EEFundamentalParameterData::setPulseWidth(float pX) { _pulseWidth = pX; } + +void EEFundamentalParameterData::marshal(DataStream& dataStream) const { + dataStream << _frequency; + dataStream << _frequencyRange; + dataStream << _effectiveRadiatedPower; + dataStream << _pulseRepetitionFrequency; + dataStream << _pulseWidth; +} + +void EEFundamentalParameterData::unmarshal(DataStream& dataStream) { + dataStream >> _frequency; + dataStream >> _frequencyRange; + dataStream >> _effectiveRadiatedPower; + dataStream >> _pulseRepetitionFrequency; + dataStream >> _pulseWidth; +} + +bool EEFundamentalParameterData::operator==( + const EEFundamentalParameterData& rhs) const { + bool ivarsEqual = true; + + if (!(_frequency == rhs._frequency)) ivarsEqual = false; + if (!(_frequencyRange == rhs._frequencyRange)) ivarsEqual = false; + if (!(_effectiveRadiatedPower == rhs._effectiveRadiatedPower)) + ivarsEqual = false; + if (!(_pulseRepetitionFrequency == rhs._pulseRepetitionFrequency)) + ivarsEqual = false; + if (!(_pulseWidth == rhs._pulseWidth)) ivarsEqual = false; + + return ivarsEqual; +} + +int EEFundamentalParameterData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _frequency + marshalSize = marshalSize + 4; // _frequencyRange + marshalSize = marshalSize + 4; // _effectiveRadiatedPower + marshalSize = marshalSize + 4; // _pulseRepetitionFrequency + marshalSize = marshalSize + 4; // _pulseWidth + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/EEFundamentalParameterData.h b/src/dis7/distributed_emissions/EEFundamentalParameterData.h new file mode 100644 index 00000000..ad7d6ea4 --- /dev/null +++ b/src/dis7/distributed_emissions/EEFundamentalParameterData.h @@ -0,0 +1,90 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Contains electromagnetic emmission regeneration parameters that are variable +// throught a scenario. Section 6.2.22. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EEFundamentalParameterData { + protected: + /** center frequency of the emission in hertz. */ + float _frequency; + + /** Bandwidth of the frequencies corresponding to the fequency field. */ + float _frequencyRange; + + /** Effective radiated power for the emission in DdBm. For a radar noise + * jammer, indicates the peak of the transmitted power. */ + float _effectiveRadiatedPower; + + /** Average repetition frequency of the emission in hertz. */ + float _pulseRepetitionFrequency; + + /** Average pulse width of the emission in microseconds. */ + float _pulseWidth; + + public: + EEFundamentalParameterData(); + virtual ~EEFundamentalParameterData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getFrequency() const; + void setFrequency(float pX); + + float getFrequencyRange() const; + void setFrequencyRange(float pX); + + float getEffectiveRadiatedPower() const; + void setEffectiveRadiatedPower(float pX); + + float getPulseRepetitionFrequency() const; + void setPulseRepetitionFrequency(float pX); + + float getPulseWidth() const; + void setPulseWidth(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EEFundamentalParameterData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/ElectromagneticEmissionBeamData.cpp b/src/dis7/distributed_emissions/ElectromagneticEmissionBeamData.cpp new file mode 100644 index 00000000..783e872e --- /dev/null +++ b/src/dis7/distributed_emissions/ElectromagneticEmissionBeamData.cpp @@ -0,0 +1,245 @@ +#include "dis7/ElectromagneticEmissionBeamData.h" + +using namespace DIS; + +ElectromagneticEmissionBeamData::ElectromagneticEmissionBeamData() + : _beamDataLength(0), + _beamIDNumber(0), + _beamParameterIndex(0), + _fundamentalParameterData(), + _beamData(), + _beamFunction(0), + _numberOfTrackJamTargets(0), + _highDensityTrackJam(0), + _beamStatus(0), + _jammingTechnique() {} + +ElectromagneticEmissionBeamData::~ElectromagneticEmissionBeamData() { + _trackJamTargets.clear(); +} + +uint8_t ElectromagneticEmissionBeamData::getBeamDataLength() const { + return _beamDataLength; +} + +void ElectromagneticEmissionBeamData::setBeamDataLength(uint8_t pX) { + _beamDataLength = pX; +} + +uint8_t ElectromagneticEmissionBeamData::getBeamIDNumber() const { + return _beamIDNumber; +} + +void ElectromagneticEmissionBeamData::setBeamIDNumber(uint8_t pX) { + _beamIDNumber = pX; +} + +uint16_t ElectromagneticEmissionBeamData::getBeamParameterIndex() const { + return _beamParameterIndex; +} + +void ElectromagneticEmissionBeamData::setBeamParameterIndex(uint16_t pX) { + _beamParameterIndex = pX; +} + +EEFundamentalParameterData& +ElectromagneticEmissionBeamData::getFundamentalParameterData() { + return _fundamentalParameterData; +} + +const EEFundamentalParameterData& +ElectromagneticEmissionBeamData::getFundamentalParameterData() const { + return _fundamentalParameterData; +} + +void ElectromagneticEmissionBeamData::setFundamentalParameterData( + const EEFundamentalParameterData& pX) { + _fundamentalParameterData = pX; +} + +BeamData& DIS::ElectromagneticEmissionBeamData::getBeamData() { + return _beamData; +} + +const BeamData& DIS::ElectromagneticEmissionBeamData::getBeamData() const { + return _beamData; +} + +void DIS::ElectromagneticEmissionBeamData::setBeamData(const BeamData& pX) { + _beamData = pX; +} + +uint8_t ElectromagneticEmissionBeamData::getBeamFunction() const { + return _beamFunction; +} + +void ElectromagneticEmissionBeamData::setBeamFunction(uint8_t pX) { + _beamFunction = pX; +} + +uint8_t ElectromagneticEmissionBeamData::getNumberOfTrackJamTargets() + const { + return _trackJamTargets.size(); +} + +uint8_t ElectromagneticEmissionBeamData::getHighDensityTrackJam() const { + return _highDensityTrackJam; +} + +void ElectromagneticEmissionBeamData::setHighDensityTrackJam(uint8_t pX) { + _highDensityTrackJam = pX; +} + +uint8_t ElectromagneticEmissionBeamData::getBeamStatus() const { + return _beamStatus; +} + +void ElectromagneticEmissionBeamData::setBeamStatus(uint8_t pX) { + _beamStatus = pX; +} + +JammingTechnique& ElectromagneticEmissionBeamData::getJammingTechnique() { + return _jammingTechnique; +} + +const JammingTechnique& ElectromagneticEmissionBeamData::getJammingTechnique() + const { + return _jammingTechnique; +} + +void ElectromagneticEmissionBeamData::setJammingTechnique( + const JammingTechnique& pX) { + _jammingTechnique = pX; +} + +std::vector& +ElectromagneticEmissionBeamData::getTrackJamTargets() { + return _trackJamTargets; +} + +const std::vector& +ElectromagneticEmissionBeamData::getTrackJamTargets() const { + return _trackJamTargets; +} + +void ElectromagneticEmissionBeamData::setTrackJamTargets( + const std::vector& pX) { + _trackJamTargets = pX; +} + +void ElectromagneticEmissionBeamData::marshal(DataStream& dataStream) const { + dataStream << _beamDataLength; + dataStream << _beamIDNumber; + dataStream << _beamParameterIndex; + _fundamentalParameterData.marshal(dataStream); + _beamData.marshal(dataStream); + dataStream << _beamFunction; + dataStream << (uint8_t)_trackJamTargets.size(); + dataStream << _highDensityTrackJam; + dataStream << _beamStatus; + _jammingTechnique.marshal(dataStream); + + for (size_t idx = 0; idx < _trackJamTargets.size(); idx++) { + TrackJamData x = _trackJamTargets[idx]; + x.marshal(dataStream); + } +} + +void ElectromagneticEmissionBeamData::unmarshal(DataStream& dataStream) { + dataStream >> _beamDataLength; + dataStream >> _beamIDNumber; + dataStream >> _beamParameterIndex; + _fundamentalParameterData.unmarshal(dataStream); + _beamData.unmarshal(dataStream); + dataStream >> _beamFunction; + dataStream >> _numberOfTrackJamTargets; + dataStream >> _highDensityTrackJam; + dataStream >> _beamStatus; + _jammingTechnique.unmarshal(dataStream); + + _trackJamTargets.clear(); + for (size_t idx = 0; idx < _numberOfTrackJamTargets; idx++) { + TrackJamData x; + x.unmarshal(dataStream); + _trackJamTargets.push_back(x); + } +} + +bool ElectromagneticEmissionBeamData::operator==( + const ElectromagneticEmissionBeamData& rhs) const { + bool ivarsEqual = true; + + if (!(_beamDataLength == rhs._beamDataLength)) ivarsEqual = false; + if (!(_beamIDNumber == rhs._beamIDNumber)) ivarsEqual = false; + if (!(_beamParameterIndex == rhs._beamParameterIndex)) ivarsEqual = false; + if (!(_fundamentalParameterData == rhs._fundamentalParameterData)) + ivarsEqual = false; + if (!(_beamData == rhs._beamData)) ivarsEqual = false; + if (!(_beamFunction == rhs._beamFunction)) ivarsEqual = false; + if (!(_highDensityTrackJam == rhs._highDensityTrackJam)) ivarsEqual = false; + if (!(_beamStatus == rhs._beamStatus)) ivarsEqual = false; + if (!(_jammingTechnique == rhs._jammingTechnique)) ivarsEqual = false; + + for (size_t idx = 0; idx < _trackJamTargets.size(); idx++) { + if (!(_trackJamTargets[idx] == rhs._trackJamTargets[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int ElectromagneticEmissionBeamData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _beamDataLength + marshalSize = marshalSize + 1; // _beamIDNumber + marshalSize = marshalSize + 2; // _beamParameterIndex + marshalSize = + marshalSize + _fundamentalParameterData + .getMarshalledSize(); // _fundamentalParameterData + marshalSize = marshalSize + _beamData.getMarshalledSize(); // _beamData + marshalSize = marshalSize + 1; // _beamFunction + marshalSize = marshalSize + 1; // _numberOfTrackJamTargets + marshalSize = marshalSize + 1; // _highDensityTrackJam + marshalSize = marshalSize + 1; // _beamStatus + marshalSize = + marshalSize + _jammingTechnique.getMarshalledSize(); // _jammingTechnique + + for (uint64_t idx = 0; idx < _trackJamTargets.size(); idx++) { + TrackJamData listElement = _trackJamTargets[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/ElectromagneticEmissionBeamData.h b/src/dis7/distributed_emissions/ElectromagneticEmissionBeamData.h new file mode 100644 index 00000000..eb816264 --- /dev/null +++ b/src/dis7/distributed_emissions/ElectromagneticEmissionBeamData.h @@ -0,0 +1,139 @@ +#pragma once + +#include + +#include "dis7/BeamData.h" +#include "dis7/EEFundamentalParameterData.h" +#include "dis7/JammingTechnique.h" +#include "dis7/TrackJamData.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Description of one electronic emission beam + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ElectromagneticEmissionBeamData { + protected: + /** This field shall specify the length of this beams data in 32 bit words */ + uint8_t _beamDataLength; + + /** This field shall specify a unique emitter database number assigned to + * differentiate between otherwise similar or identical emitter beams within + * an emitter system. */ + uint8_t _beamIDNumber; + + /** This field shall specify a Beam Parameter Index number that shall be used + * by receiving entities in conjunction with the Emitter Name field to provide + * a pointer to the stored database parameters required to regenerate the + * beam. */ + uint16_t _beamParameterIndex; + + /** Fundamental parameter data such as frequency range, erp, pulse width, etc. + */ + EEFundamentalParameterData _fundamentalParameterData; + + /** Beam data contains Azimuth, Elevation, Sweep variables */ + BeamData _beamData; + + /** beam function of a particular beam */ + uint8_t _beamFunction; + + /** Number of track/jam targets */ + uint8_t _numberOfTrackJamTargets; + + /** wheher or not the receiving simulation apps can assume all the targets in + * the scan pattern are being tracked/jammed */ + uint8_t _highDensityTrackJam; + + uint8_t _beamStatus; + + /** Contains Jamming Mode Sequence */ + JammingTechnique _jammingTechnique; + + /** variable length list of track/jam targets */ + std::vector _trackJamTargets; + + public: + ElectromagneticEmissionBeamData(); + virtual ~ElectromagneticEmissionBeamData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getBeamDataLength() const; + void setBeamDataLength(uint8_t pX); + + uint8_t getBeamIDNumber() const; + void setBeamIDNumber(uint8_t pX); + + uint16_t getBeamParameterIndex() const; + void setBeamParameterIndex(uint16_t pX); + + EEFundamentalParameterData& getFundamentalParameterData(); + const EEFundamentalParameterData& getFundamentalParameterData() const; + void setFundamentalParameterData(const EEFundamentalParameterData& pX); + + BeamData& getBeamData(); + const BeamData& getBeamData() const; + void setBeamData(const BeamData& pX); + + uint8_t getBeamFunction() const; + void setBeamFunction(uint8_t pX); + + uint8_t getNumberOfTrackJamTargets() const; + + uint8_t getHighDensityTrackJam() const; + void setHighDensityTrackJam(uint8_t pX); + + uint8_t getBeamStatus() const; + void setBeamStatus(uint8_t pX); + + JammingTechnique& getJammingTechnique(); + const JammingTechnique& getJammingTechnique() const; + void setJammingTechnique(const JammingTechnique& pX); + + std::vector& getTrackJamTargets(); + const std::vector& getTrackJamTargets() const; + void setTrackJamTargets(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ElectromagneticEmissionBeamData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/ElectromagneticEmissionSystemData.cpp b/src/dis7/distributed_emissions/ElectromagneticEmissionSystemData.cpp new file mode 100644 index 00000000..07ad8c08 --- /dev/null +++ b/src/dis7/distributed_emissions/ElectromagneticEmissionSystemData.cpp @@ -0,0 +1,160 @@ +#include "dis7/ElectromagneticEmissionSystemData.h" + +using namespace DIS; + +ElectromagneticEmissionSystemData::ElectromagneticEmissionSystemData() + : _systemDataLength(0), + _emissionsPadding2(0), + _numberOfBeams(0), + _emitterSystem(), + _location() {} + +ElectromagneticEmissionSystemData::~ElectromagneticEmissionSystemData() { + _beamDataRecords.clear(); +} + +uint8_t ElectromagneticEmissionSystemData::getSystemDataLength() const { + return _systemDataLength; +} + +void ElectromagneticEmissionSystemData::setSystemDataLength(uint8_t pX) { + _systemDataLength = pX; +} + +uint8_t ElectromagneticEmissionSystemData::getNumberOfBeams() const { + return _beamDataRecords.size(); +} + +EmitterSystem& ElectromagneticEmissionSystemData::getEmitterSystem() { + return _emitterSystem; +} + +const EmitterSystem& ElectromagneticEmissionSystemData::getEmitterSystem() + const { + return _emitterSystem; +} + +void ElectromagneticEmissionSystemData::setEmitterSystem( + const EmitterSystem& pX) { + _emitterSystem = pX; +} + +Vector3Float& ElectromagneticEmissionSystemData::getLocation() { + return _location; +} + +const Vector3Float& ElectromagneticEmissionSystemData::getLocation() const { + return _location; +} + +void ElectromagneticEmissionSystemData::setLocation(const Vector3Float& pX) { + _location = pX; +} + +std::vector& +DIS::ElectromagneticEmissionSystemData::getBeamDataRecords() { + return _beamDataRecords; +} + +const std::vector& +DIS::ElectromagneticEmissionSystemData::getBeamDataRecords() const { + return _beamDataRecords; +} + +void DIS::ElectromagneticEmissionSystemData::setBeamDataRecords( + const std::vector& pX) { + _beamDataRecords = pX; +} + +void ElectromagneticEmissionSystemData::marshal(DataStream& dataStream) const { + dataStream << _systemDataLength; + dataStream << (uint8_t)_beamDataRecords.size(); + dataStream << _emissionsPadding2; + _emitterSystem.marshal(dataStream); + _location.marshal(dataStream); + + for (size_t idx = 0; idx < _beamDataRecords.size(); idx++) { + ElectromagneticEmissionBeamData x = _beamDataRecords[idx]; + x.marshal(dataStream); + } +} + +void ElectromagneticEmissionSystemData::unmarshal(DataStream& dataStream) { + dataStream >> _systemDataLength; + dataStream >> _numberOfBeams; + dataStream >> _emissionsPadding2; + _emitterSystem.unmarshal(dataStream); + _location.unmarshal(dataStream); + + _beamDataRecords.clear(); + for (size_t idx = 0; idx < _numberOfBeams; idx++) { + ElectromagneticEmissionBeamData x; + x.unmarshal(dataStream); + _beamDataRecords.push_back(x); + } +} + +bool ElectromagneticEmissionSystemData::operator==( + const ElectromagneticEmissionSystemData& rhs) const { + bool ivarsEqual = true; + + if (!(_systemDataLength == rhs._systemDataLength)) ivarsEqual = false; + if (!(_numberOfBeams == rhs._numberOfBeams)) ivarsEqual = false; + if (!(_emissionsPadding2 == rhs._emissionsPadding2)) ivarsEqual = false; + if (!(_emitterSystem == rhs._emitterSystem)) ivarsEqual = false; + if (!(_location == rhs._location)) ivarsEqual = false; + + for (size_t idx = 0; idx < _beamDataRecords.size(); idx++) { + if (!(_beamDataRecords[idx] == rhs._beamDataRecords[idx])) + ivarsEqual = false; + } + return ivarsEqual; +} + +int ElectromagneticEmissionSystemData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize += 1; // _systemDataLength + marshalSize += 1; // _numberOfBeams + marshalSize += 2; // _eimssionsPadding2 + marshalSize += _emitterSystem.getMarshalledSize(); //_emitterSystem + marshalSize += _location.getMarshalledSize(); //_location + + for (uint64_t idx = 0; idx < _beamDataRecords.size(); idx++) { + ElectromagneticEmissionBeamData listElement = _beamDataRecords[idx]; + marshalSize += listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/ElectromagneticEmissionSystemData.h b/src/dis7/distributed_emissions/ElectromagneticEmissionSystemData.h new file mode 100644 index 00000000..d8f910ff --- /dev/null +++ b/src/dis7/distributed_emissions/ElectromagneticEmissionSystemData.h @@ -0,0 +1,114 @@ +#pragma once + +#include + +#include "dis7/ElectromagneticEmissionBeamData.h" +#include "dis7/EmitterSystem.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Contains electromagnetic emmission system +// https://www.sisostds.org/DesktopModules/Bring2mind/DMX/API/Entries/Download?Command=Core_Download&EntryId=36292&PortalId=0&TabId=105 +// Page 23 +// +// DIS Data Dictionary representation +// http://faculty.nps.edu/brutzman/vrtp/mil/navy/nps/disEnumerations/JdbeHtmlFiles/pdu/b9.htm +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author semihkurt + +class OPENDIS7_EXPORT ElectromagneticEmissionSystemData { + protected: + /** this field shall specify the length of this emitter system's data in + * 32-bit words. */ + uint8_t _systemDataLength; + + /** the number of beams being described in the current PDU for the emitter + * system being described. */ + uint8_t _numberOfBeams; + + /* padding. */ + uint16_t _emissionsPadding2; + + /** information about a particular emitter system and shall be represented by + * an Emitter System record (see 6.2.23). */ + EmitterSystem _emitterSystem; + + /** the location of the antenna beam source with respect to the emitting + * entity's coordinate system. This location shall be the origin of the + * emitter coordinate system that shall have the same orientation as the + * entity coordinate system. This field shall be represented by an Entity + * Coordinate Vector record see 6.2.95 */ + Vector3Float _location; + + /** Electromagnetic emmissions systems */ + std::vector _beamDataRecords; + + public: + ElectromagneticEmissionSystemData(); + virtual ~ElectromagneticEmissionSystemData(); + + uint8_t getSystemDataLength() const; + void setSystemDataLength(uint8_t pX); + + uint8_t getNumberOfBeams() const; + + uint16_t getEmissionsPadding2() const; + void setEmissionsPadding2(uint16_t pX); + + EmitterSystem& getEmitterSystem(); + const EmitterSystem& getEmitterSystem() const; + void setEmitterSystem(const EmitterSystem& pX); + + Vector3Float& getLocation(); + const Vector3Float& getLocation() const; + void setLocation(const Vector3Float& pX); + + std::vector& getBeamDataRecords(); + const std::vector& getBeamDataRecords() + const; + void setBeamDataRecords( + const std::vector& pX); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const ElectromagneticEmissionSystemData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/ElectromagneticEmissionsPdu.cpp b/src/dis7/distributed_emissions/ElectromagneticEmissionsPdu.cpp new file mode 100644 index 00000000..5975dc0c --- /dev/null +++ b/src/dis7/distributed_emissions/ElectromagneticEmissionsPdu.cpp @@ -0,0 +1,176 @@ +#include "dis7/ElectromagneticEmissionsPdu.h" + +using namespace DIS; + +ElectromagneticEmissionsPdu::ElectromagneticEmissionsPdu() + : DistributedEmissionsFamilyPdu(), + _emittingEntityID(), + _eventID(), + _stateUpdateIndicator(0), + _numberOfSystems(0), + _paddingForEmissionsPdu(0) { + setPduType(23); + setPaddingForEmissionsPdu(0); +} + +ElectromagneticEmissionsPdu::~ElectromagneticEmissionsPdu() { + _systems.clear(); +} + +EntityID& ElectromagneticEmissionsPdu::getEmittingEntityID() { + return _emittingEntityID; +} + +const EntityID& ElectromagneticEmissionsPdu::getEmittingEntityID() const { + return _emittingEntityID; +} + +void ElectromagneticEmissionsPdu::setEmittingEntityID(const EntityID& pX) { + _emittingEntityID = pX; +} + +EventIdentifier& ElectromagneticEmissionsPdu::getEventID() { return _eventID; } + +const EventIdentifier& ElectromagneticEmissionsPdu::getEventID() const { + return _eventID; +} + +void ElectromagneticEmissionsPdu::setEventID(const EventIdentifier& pX) { + _eventID = pX; +} + +uint8_t ElectromagneticEmissionsPdu::getStateUpdateIndicator() const { + return _stateUpdateIndicator; +} + +void ElectromagneticEmissionsPdu::setStateUpdateIndicator(uint8_t pX) { + _stateUpdateIndicator = pX; +} + +uint8_t ElectromagneticEmissionsPdu::getNumberOfSystems() const { + return _systems.size(); +} + +uint16_t ElectromagneticEmissionsPdu::getPaddingForEmissionsPdu() const { + return _paddingForEmissionsPdu; +} + +void ElectromagneticEmissionsPdu::setPaddingForEmissionsPdu(uint16_t pX) { + _paddingForEmissionsPdu = pX; +} + +std::vector& +ElectromagneticEmissionsPdu::getSystems() { + return _systems; +} + +const std::vector& +ElectromagneticEmissionsPdu::getSystems() const { + return _systems; +} + +void ElectromagneticEmissionsPdu::setSystems( + const std::vector& pX) { + _systems = pX; +} + +void ElectromagneticEmissionsPdu::marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _emittingEntityID.marshal(dataStream); + _eventID.marshal(dataStream); + dataStream << _stateUpdateIndicator; + dataStream << (uint8_t)_systems.size(); + dataStream << _paddingForEmissionsPdu; + + for (size_t idx = 0; idx < _systems.size(); idx++) { + ElectromagneticEmissionSystemData x = _systems[idx]; + x.marshal(dataStream); + } +} + +void ElectromagneticEmissionsPdu::unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _emittingEntityID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + dataStream >> _stateUpdateIndicator; + dataStream >> _numberOfSystems; + dataStream >> _paddingForEmissionsPdu; + + _systems.clear(); + for (size_t idx = 0; idx < _numberOfSystems; idx++) { + ElectromagneticEmissionSystemData x; + x.unmarshal(dataStream); + _systems.push_back(x); + } +} + +bool ElectromagneticEmissionsPdu::operator==( + const ElectromagneticEmissionsPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_emittingEntityID == rhs._emittingEntityID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_stateUpdateIndicator == rhs._stateUpdateIndicator)) ivarsEqual = false; + if (!(_paddingForEmissionsPdu == rhs._paddingForEmissionsPdu)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _systems.size(); idx++) { + if (!(_systems[idx] == rhs._systems[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ElectromagneticEmissionsPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + 1; // _stateUpdateIndicator + marshalSize = marshalSize + 1; // _numberOfSystems + marshalSize = marshalSize + 2; // _paddingForEmissionsPdu + + for (uint64_t idx = 0; idx < _systems.size(); idx++) { + ElectromagneticEmissionSystemData listElement = _systems[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/ElectromagneticEmissionsPdu.h b/src/dis7/distributed_emissions/ElectromagneticEmissionsPdu.h new file mode 100644 index 00000000..93036468 --- /dev/null +++ b/src/dis7/distributed_emissions/ElectromagneticEmissionsPdu.h @@ -0,0 +1,109 @@ +#pragma once + +#include + +#include "dis7/DistributedEmissionsFamilyPdu.h" +#include "dis7/ElectromagneticEmissionSystemData.h" +#include "dis7/EntityID.h" +#include "dis7/EventIdentifier.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.7.1. Information about active electronic warfare (EW) emissions +// and active EW countermeasures shall be communicated using an Electromagnetic +// Emission PDU. NOT COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ElectromagneticEmissionsPdu + : public DistributedEmissionsFamilyPdu { + protected: + /** ID of the entity emitting */ + EntityID _emittingEntityID; + + /** ID of event */ + EventIdentifier _eventID; + + /** This field shall be used to indicate if the data in the PDU represents a + * state update or just data that has changed since issuance of the last + * Electromagnetic Emission PDU [relative to the identified entity and + * emission system(s)]. */ + uint8_t _stateUpdateIndicator; + + /** This field shall specify the number of emission systems being described in + * the current PDU. */ + uint8_t _numberOfSystems; + + /** padding */ + uint16_t _paddingForEmissionsPdu; + + std::vector _systems; + + public: + ElectromagneticEmissionsPdu(); + virtual ~ElectromagneticEmissionsPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEmittingEntityID(); + const EntityID& getEmittingEntityID() const; + void setEmittingEntityID(const EntityID& pX); + + EventIdentifier& getEventID(); + const EventIdentifier& getEventID() const; + void setEventID(const EventIdentifier& pX); + + uint8_t getStateUpdateIndicator() const; + void setStateUpdateIndicator(uint8_t pX); + + uint8_t getNumberOfSystems() const; + + uint16_t getPaddingForEmissionsPdu() const; + void setPaddingForEmissionsPdu(uint16_t pX); + + std::vector& getSystems(); + const std::vector& getSystems() const; + void setSystems(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ElectromagneticEmissionsPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/EmitterSystem.cpp b/src/dis7/distributed_emissions/EmitterSystem.cpp new file mode 100644 index 00000000..b925a65f --- /dev/null +++ b/src/dis7/distributed_emissions/EmitterSystem.cpp @@ -0,0 +1,86 @@ +#include "dis7/EmitterSystem.h" + +using namespace DIS; + +EmitterSystem::EmitterSystem() + : _emitterName(0), _function(0), _emitterIdNumber(0) {} + +EmitterSystem::~EmitterSystem() {} + +uint16_t EmitterSystem::getEmitterName() const { return _emitterName; } + +void EmitterSystem::setEmitterName(uint16_t pX) { _emitterName = pX; } + +uint8_t EmitterSystem::getFunction() const { return _function; } + +void EmitterSystem::setFunction(uint8_t pX) { _function = pX; } + +uint8_t EmitterSystem::getEmitterIdNumber() const { + return _emitterIdNumber; +} + +void EmitterSystem::setEmitterIdNumber(uint8_t pX) { + _emitterIdNumber = pX; +} + +void EmitterSystem::marshal(DataStream& dataStream) const { + dataStream << _emitterName; + dataStream << _function; + dataStream << _emitterIdNumber; +} + +void EmitterSystem::unmarshal(DataStream& dataStream) { + dataStream >> _emitterName; + dataStream >> _function; + dataStream >> _emitterIdNumber; +} + +bool EmitterSystem::operator==(const EmitterSystem& rhs) const { + bool ivarsEqual = true; + + if (!(_emitterName == rhs._emitterName)) ivarsEqual = false; + if (!(_function == rhs._function)) ivarsEqual = false; + if (!(_emitterIdNumber == rhs._emitterIdNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int EmitterSystem::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _emitterName + marshalSize = marshalSize + 1; // _function + marshalSize = marshalSize + 1; // _emitterIdNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/EmitterSystem.h b/src/dis7/distributed_emissions/EmitterSystem.h new file mode 100644 index 00000000..d9cae536 --- /dev/null +++ b/src/dis7/distributed_emissions/EmitterSystem.h @@ -0,0 +1,77 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// This field shall specify information about a particular emitter system. +// Section 6.2.23. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EmitterSystem { + protected: + /** Name of the emitter, 16 bit enumeration */ + uint16_t _emitterName; + + /** function of the emitter, 8 bit enumeration */ + uint8_t _function; + + /** emitter ID, 8 bit enumeration */ + uint8_t _emitterIdNumber; + + public: + EmitterSystem(); + virtual ~EmitterSystem(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getEmitterName() const; + void setEmitterName(uint16_t pX); + + uint8_t getFunction() const; + void setFunction(uint8_t pX); + + uint8_t getEmitterIdNumber() const; + void setEmitterIdNumber(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EmitterSystem& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/FundamentalOperationalData.cpp b/src/dis7/distributed_emissions/FundamentalOperationalData.cpp new file mode 100644 index 00000000..266f0e62 --- /dev/null +++ b/src/dis7/distributed_emissions/FundamentalOperationalData.cpp @@ -0,0 +1,188 @@ +#include "dis7/FundamentalOperationalData.h" + +using namespace DIS; + +FundamentalOperationalData::FundamentalOperationalData() + : _systemStatus(0), + _dataField1(0), + _informationLayers(0), + _dataField2(0), + _parameter1(0), + _parameter2(0), + _parameter3(0), + _parameter4(0), + _parameter5(0), + _parameter6(0) {} + +FundamentalOperationalData::~FundamentalOperationalData() {} + +uint8_t FundamentalOperationalData::getSystemStatus() const { + return _systemStatus; +} + +void FundamentalOperationalData::setSystemStatus(uint8_t pX) { + _systemStatus = pX; +} + +uint8_t FundamentalOperationalData::getDataField1() const { + return _dataField1; +} + +void FundamentalOperationalData::setDataField1(uint8_t pX) { + _dataField1 = pX; +} + +uint8_t FundamentalOperationalData::getInformationLayers() const { + return _informationLayers; +} + +void FundamentalOperationalData::setInformationLayers(uint8_t pX) { + _informationLayers = pX; +} + +uint8_t FundamentalOperationalData::getDataField2() const { + return _dataField2; +} + +void FundamentalOperationalData::setDataField2(uint8_t pX) { + _dataField2 = pX; +} + +uint16_t FundamentalOperationalData::getParameter1() const { + return _parameter1; +} + +void FundamentalOperationalData::setParameter1(uint16_t pX) { + _parameter1 = pX; +} + +uint16_t FundamentalOperationalData::getParameter2() const { + return _parameter2; +} + +void FundamentalOperationalData::setParameter2(uint16_t pX) { + _parameter2 = pX; +} + +uint16_t FundamentalOperationalData::getParameter3() const { + return _parameter3; +} + +void FundamentalOperationalData::setParameter3(uint16_t pX) { + _parameter3 = pX; +} + +uint16_t FundamentalOperationalData::getParameter4() const { + return _parameter4; +} + +void FundamentalOperationalData::setParameter4(uint16_t pX) { + _parameter4 = pX; +} + +uint16_t FundamentalOperationalData::getParameter5() const { + return _parameter5; +} + +void FundamentalOperationalData::setParameter5(uint16_t pX) { + _parameter5 = pX; +} + +uint16_t FundamentalOperationalData::getParameter6() const { + return _parameter6; +} + +void FundamentalOperationalData::setParameter6(uint16_t pX) { + _parameter6 = pX; +} + +void FundamentalOperationalData::marshal(DataStream& dataStream) const { + dataStream << _systemStatus; + dataStream << _dataField1; + dataStream << _informationLayers; + dataStream << _dataField2; + dataStream << _parameter1; + dataStream << _parameter2; + dataStream << _parameter3; + dataStream << _parameter4; + dataStream << _parameter5; + dataStream << _parameter6; +} + +void FundamentalOperationalData::unmarshal(DataStream& dataStream) { + dataStream >> _systemStatus; + dataStream >> _dataField1; + dataStream >> _informationLayers; + dataStream >> _dataField2; + dataStream >> _parameter1; + dataStream >> _parameter2; + dataStream >> _parameter3; + dataStream >> _parameter4; + dataStream >> _parameter5; + dataStream >> _parameter6; +} + +bool FundamentalOperationalData::operator==( + const FundamentalOperationalData& rhs) const { + bool ivarsEqual = true; + + if (!(_systemStatus == rhs._systemStatus)) ivarsEqual = false; + if (!(_dataField1 == rhs._dataField1)) ivarsEqual = false; + if (!(_informationLayers == rhs._informationLayers)) ivarsEqual = false; + if (!(_dataField2 == rhs._dataField2)) ivarsEqual = false; + if (!(_parameter1 == rhs._parameter1)) ivarsEqual = false; + if (!(_parameter2 == rhs._parameter2)) ivarsEqual = false; + if (!(_parameter3 == rhs._parameter3)) ivarsEqual = false; + if (!(_parameter4 == rhs._parameter4)) ivarsEqual = false; + if (!(_parameter5 == rhs._parameter5)) ivarsEqual = false; + if (!(_parameter6 == rhs._parameter6)) ivarsEqual = false; + + return ivarsEqual; +} + +int FundamentalOperationalData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _systemStatus + marshalSize = marshalSize + 1; // _dataField1 + marshalSize = marshalSize + 1; // _informationLayers + marshalSize = marshalSize + 1; // _dataField2 + marshalSize = marshalSize + 2; // _parameter1 + marshalSize = marshalSize + 2; // _parameter2 + marshalSize = marshalSize + 2; // _parameter3 + marshalSize = marshalSize + 2; // _parameter4 + marshalSize = marshalSize + 2; // _parameter5 + marshalSize = marshalSize + 2; // _parameter6 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/FundamentalOperationalData.h b/src/dis7/distributed_emissions/FundamentalOperationalData.h new file mode 100644 index 00000000..55433daa --- /dev/null +++ b/src/dis7/distributed_emissions/FundamentalOperationalData.h @@ -0,0 +1,118 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Basic operational data for IFF. Section 6.2.40. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT FundamentalOperationalData { + protected: + /** system status */ + uint8_t _systemStatus; + + /** data field 1 */ + uint8_t _dataField1; + + /** eight boolean fields */ + uint8_t _informationLayers; + + /** enumeration */ + uint8_t _dataField2; + + /** parameter, enumeration */ + uint16_t _parameter1; + + /** parameter, enumeration */ + uint16_t _parameter2; + + /** parameter, enumeration */ + uint16_t _parameter3; + + /** parameter, enumeration */ + uint16_t _parameter4; + + /** parameter, enumeration */ + uint16_t _parameter5; + + /** parameter, enumeration */ + uint16_t _parameter6; + + public: + FundamentalOperationalData(); + virtual ~FundamentalOperationalData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getSystemStatus() const; + void setSystemStatus(uint8_t pX); + + uint8_t getDataField1() const; + void setDataField1(uint8_t pX); + + uint8_t getInformationLayers() const; + void setInformationLayers(uint8_t pX); + + uint8_t getDataField2() const; + void setDataField2(uint8_t pX); + + uint16_t getParameter1() const; + void setParameter1(uint16_t pX); + + uint16_t getParameter2() const; + void setParameter2(uint16_t pX); + + uint16_t getParameter3() const; + void setParameter3(uint16_t pX); + + uint16_t getParameter4() const; + void setParameter4(uint16_t pX); + + uint16_t getParameter5() const; + void setParameter5(uint16_t pX); + + uint16_t getParameter6() const; + void setParameter6(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FundamentalOperationalData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/IFFFundamentalParameterData.cpp b/src/dis7/distributed_emissions/IFFFundamentalParameterData.cpp new file mode 100644 index 00000000..6ca95378 --- /dev/null +++ b/src/dis7/distributed_emissions/IFFFundamentalParameterData.cpp @@ -0,0 +1,156 @@ +#include "dis7/IFFFundamentalParameterData.h" + +using namespace DIS; + +IFFFundamentalParameterData::IFFFundamentalParameterData() + : _erp(0.0), + _frequency(0.0), + _pgrf(0.0), + _pulseWidth(0.0), + _burstLength(0), + _applicableModes(0) { + // Initialize fixed length array + for (int lengthsystemSpecificData = 0; lengthsystemSpecificData < 3; + lengthsystemSpecificData++) { + _systemSpecificData[lengthsystemSpecificData] = 0; + } +} + +IFFFundamentalParameterData::~IFFFundamentalParameterData() {} + +float IFFFundamentalParameterData::getErp() const { return _erp; } + +void IFFFundamentalParameterData::setErp(float pX) { _erp = pX; } + +float IFFFundamentalParameterData::getFrequency() const { return _frequency; } + +void IFFFundamentalParameterData::setFrequency(float pX) { _frequency = pX; } + +float IFFFundamentalParameterData::getPgrf() const { return _pgrf; } + +void IFFFundamentalParameterData::setPgrf(float pX) { _pgrf = pX; } + +float IFFFundamentalParameterData::getPulseWidth() const { return _pulseWidth; } + +void IFFFundamentalParameterData::setPulseWidth(float pX) { _pulseWidth = pX; } + +uint32_t IFFFundamentalParameterData::getBurstLength() const { + return _burstLength; +} + +void IFFFundamentalParameterData::setBurstLength(uint32_t pX) { + _burstLength = pX; +} + +uint8_t IFFFundamentalParameterData::getApplicableModes() const { + return _applicableModes; +} + +void IFFFundamentalParameterData::setApplicableModes(uint8_t pX) { + _applicableModes = pX; +} + +uint8_t* IFFFundamentalParameterData::getSystemSpecificData() { + return _systemSpecificData; +} + +const uint8_t* IFFFundamentalParameterData::getSystemSpecificData() + const { + return _systemSpecificData; +} + +void IFFFundamentalParameterData::setSystemSpecificData( + const uint8_t* x) { + for (int i = 0; i < 3; i++) { + _systemSpecificData[i] = x[i]; + } +} + +void IFFFundamentalParameterData::marshal(DataStream& dataStream) const { + dataStream << _erp; + dataStream << _frequency; + dataStream << _pgrf; + dataStream << _pulseWidth; + dataStream << _burstLength; + dataStream << _applicableModes; + + for (size_t idx = 0; idx < 3; idx++) { + dataStream << _systemSpecificData[idx]; + } +} + +void IFFFundamentalParameterData::unmarshal(DataStream& dataStream) { + dataStream >> _erp; + dataStream >> _frequency; + dataStream >> _pgrf; + dataStream >> _pulseWidth; + dataStream >> _burstLength; + dataStream >> _applicableModes; + + for (size_t idx = 0; idx < 3; idx++) { + dataStream >> _systemSpecificData[idx]; + } +} + +bool IFFFundamentalParameterData::operator==( + const IFFFundamentalParameterData& rhs) const { + bool ivarsEqual = true; + + if (!(_erp == rhs._erp)) ivarsEqual = false; + if (!(_frequency == rhs._frequency)) ivarsEqual = false; + if (!(_pgrf == rhs._pgrf)) ivarsEqual = false; + if (!(_pulseWidth == rhs._pulseWidth)) ivarsEqual = false; + if (!(_burstLength == rhs._burstLength)) ivarsEqual = false; + if (!(_applicableModes == rhs._applicableModes)) ivarsEqual = false; + + for (uint8_t idx = 0; idx < 3; idx++) { + if (!(_systemSpecificData[idx] == rhs._systemSpecificData[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int IFFFundamentalParameterData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _erp + marshalSize = marshalSize + 4; // _frequency + marshalSize = marshalSize + 4; // _pgrf + marshalSize = marshalSize + 4; // _pulseWidth + marshalSize = marshalSize + 4; // _burstLength + marshalSize = marshalSize + 1; // _applicableModes + marshalSize = marshalSize + 3 * 1; // _systemSpecificData + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/IFFFundamentalParameterData.h b/src/dis7/distributed_emissions/IFFFundamentalParameterData.h new file mode 100644 index 00000000..64033e44 --- /dev/null +++ b/src/dis7/distributed_emissions/IFFFundamentalParameterData.h @@ -0,0 +1,101 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Fundamental IFF atc data. Section 6.2.45 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT IFFFundamentalParameterData { + protected: + /** ERP */ + float _erp; + + /** frequency */ + float _frequency; + + /** pgrf */ + float _pgrf; + + /** Pulse width */ + float _pulseWidth; + + /** Burst length */ + uint32_t _burstLength; + + /** Applicable modes enumeration */ + uint8_t _applicableModes; + + /** System-specific data */ + uint8_t _systemSpecificData[3]; + + public: + IFFFundamentalParameterData(); + virtual ~IFFFundamentalParameterData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getErp() const; + void setErp(float pX); + + float getFrequency() const; + void setFrequency(float pX); + + float getPgrf() const; + void setPgrf(float pX); + + float getPulseWidth() const; + void setPulseWidth(float pX); + + uint32_t getBurstLength() const; + void setBurstLength(uint32_t pX); + + uint8_t getApplicableModes() const; + void setApplicableModes(uint8_t pX); + + uint8_t* getSystemSpecificData(); + const uint8_t* getSystemSpecificData() const; + void setSystemSpecificData(const uint8_t* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IFFFundamentalParameterData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/IFFPdu.cpp b/src/dis7/distributed_emissions/IFFPdu.cpp new file mode 100644 index 00000000..2c281d52 --- /dev/null +++ b/src/dis7/distributed_emissions/IFFPdu.cpp @@ -0,0 +1,221 @@ +#include "dis7/IFFPdu.h" + +using namespace DIS; + +IFFPdu::IFFPdu() + : DistributedEmissionsFamilyPdu(), + _emittingEntityID(), + _eventID(), + _relativeAntennaLocation(), + _numberOfIFFParameters(0), + _systemID(), + _systemDesignator(0), + _systemSpecificData(0), + _fundamentalOperationalData(), + _layerHeader(), + _beamData(), + _secondaryOperationalData() { + setPduType(28); +} + +IFFPdu::~IFFPdu() { _iffParameters.clear(); } + +EntityID& IFFPdu::getEmittingEntityID() { return _emittingEntityID; } + +const EntityID& IFFPdu::getEmittingEntityID() const { + return _emittingEntityID; +} + +void IFFPdu::setEmittingEntityID(const EntityID& pX) { _emittingEntityID = pX; } + +EventIdentifier& IFFPdu::getEventID() { return _eventID; } + +const EventIdentifier& IFFPdu::getEventID() const { return _eventID; } + +void IFFPdu::setEventID(const EventIdentifier& pX) { _eventID = pX; } + +Vector3Float& IFFPdu::getRelativeAntennaLocation() { + return _relativeAntennaLocation; +} + +const Vector3Float& IFFPdu::getRelativeAntennaLocation() const { + return _relativeAntennaLocation; +} + +void IFFPdu::setRelativeAntennaLocation(const Vector3Float& pX) { + _relativeAntennaLocation = pX; +} + +uint32_t IFFPdu::getNumberOfIFFParameters() const { + return _numberOfIFFParameters; +} + +SystemIdentifier& IFFPdu::getSystemID() { return _systemID; } + +const SystemIdentifier& IFFPdu::getSystemID() const { return _systemID; } + +void IFFPdu::setSystemID(const SystemIdentifier& pX) { _systemID = pX; } + +uint8_t IFFPdu::getSystemDesignator() const { return _systemDesignator; } + +void IFFPdu::setSystemDesignator(uint8_t pX) { _systemDesignator = pX; } + +uint8_t IFFPdu::getSystemSpecificData() const { + return _systemSpecificData; +} + +void IFFPdu::setSystemSpecificData(uint8_t pX) { + _systemSpecificData = pX; +} + +FundamentalOperationalData& IFFPdu::getFundamentalOperationalData() { + return _fundamentalOperationalData; +} + +const FundamentalOperationalData& IFFPdu::getFundamentalOperationalData() + const { + return _fundamentalOperationalData; +} + +void IFFPdu::setFundamentalOperationalData( + const FundamentalOperationalData& pX) { + _fundamentalOperationalData = pX; +} + +LayerHeader& IFFPdu::getLayerHeader() { return _layerHeader; } + +const LayerHeader& IFFPdu::getLayerHeader() const { return _layerHeader; } + +void IFFPdu::setLayerHeader(const LayerHeader& pX) { _layerHeader = pX; } + +BeamData& IFFPdu::getBeamData() { return _beamData; } + +const BeamData& IFFPdu::getBeamData() const { return _beamData; } + +void IFFPdu::setBeamData(const BeamData& pX) { _beamData = pX; } + +SecondaryOperationalData& IFFPdu::getSecondaryOperationalData() { + return _secondaryOperationalData; +} + +const SecondaryOperationalData& IFFPdu::getSecondaryOperationalData() const { + return _secondaryOperationalData; +} + +void IFFPdu::setSecondaryOperationalData(const SecondaryOperationalData& pX) { + _secondaryOperationalData = pX; +} + +std::vector& IFFPdu::getIFFParameters() { + return _iffParameters; +} + +const std::vector& IFFPdu::getIFFParameters() + const { + return _iffParameters; +} + +void IFFPdu::setIFFParameters( + const std::vector& pX) { + _iffParameters = pX; +} + +void IFFPdu::marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _emittingEntityID.marshal(dataStream); + _eventID.marshal(dataStream); + _relativeAntennaLocation.marshal(dataStream); + _systemID.marshal(dataStream); + dataStream << _systemDesignator; + dataStream << _systemSpecificData; + _fundamentalOperationalData.marshal(dataStream); + _layerHeader.marshal(dataStream); + _beamData.marshal(dataStream); + _secondaryOperationalData.marshal(dataStream); + dataStream << (uint8_t)_iffParameters.size(); + for (size_t idx = 0; idx < _iffParameters.size(); idx++) { + IFFFundamentalParameterData x = _iffParameters[idx]; + x.marshal(dataStream); + } +} + +void IFFPdu::unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _emittingEntityID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + _relativeAntennaLocation.unmarshal(dataStream); + _systemID.unmarshal(dataStream); + dataStream >> _systemDesignator; + dataStream >> _systemSpecificData; + _fundamentalOperationalData.unmarshal(dataStream); + _layerHeader.unmarshal(dataStream); + _beamData.unmarshal(dataStream); + _secondaryOperationalData.unmarshal(dataStream); + _numberOfIFFParameters = + _secondaryOperationalData.getNumberOfIFFFundamentalParameterRecords(); + _iffParameters.clear(); + for (size_t idx = 0; idx < _numberOfIFFParameters; idx++) { + IFFFundamentalParameterData x; + x.unmarshal(dataStream); + _iffParameters.push_back(x); + } +} + +bool IFFPdu::operator==(const IFFPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_emittingEntityID == rhs._emittingEntityID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_relativeAntennaLocation == rhs._relativeAntennaLocation)) + ivarsEqual = false; + if (!(_systemID == rhs._systemID)) ivarsEqual = false; + if (!(_systemDesignator == rhs._systemDesignator)) ivarsEqual = false; + if (!(_systemSpecificData == rhs._systemSpecificData)) ivarsEqual = false; + if (!(_fundamentalOperationalData == rhs._fundamentalOperationalData)) + ivarsEqual = false; + if (!(_layerHeader == rhs._layerHeader)) ivarsEqual = false; + if (!(_beamData == rhs._beamData)) ivarsEqual = false; + if (!(_secondaryOperationalData == rhs._secondaryOperationalData)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _iffParameters.size(); idx++) { + if (!(_iffParameters[idx] == rhs._iffParameters[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int IFFPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = + marshalSize + + _relativeAntennaLocation.getMarshalledSize(); //_relativeAntennaLocation + marshalSize = marshalSize + 1; // _numberOfIFFParameters + marshalSize = marshalSize + _systemID.getMarshalledSize(); //_systemID + marshalSize = marshalSize + 1; //_systemDesignator + marshalSize = marshalSize + 1; //_systemSpecificData + marshalSize = + marshalSize + _fundamentalOperationalData + .getMarshalledSize(); // _fundamentalOperationalData + marshalSize = marshalSize + _layerHeader.getMarshalledSize(); // _layerHeader + marshalSize = marshalSize + _beamData.getMarshalledSize(); // _beamData + marshalSize = + marshalSize + _secondaryOperationalData + .getMarshalledSize(); // _secondaryOperationalData + + for (uint64_t idx = 0; idx < _iffParameters.size(); idx++) { + IFFFundamentalParameterData listElement = _iffParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} diff --git a/src/dis7/distributed_emissions/IFFPdu.h b/src/dis7/distributed_emissions/IFFPdu.h new file mode 100644 index 00000000..3e25ac90 --- /dev/null +++ b/src/dis7/distributed_emissions/IFFPdu.h @@ -0,0 +1,110 @@ +#pragma once + +#include + +#include "dis7/BeamData.h" +#include "dis7/DistributedEmissionsFamilyPdu.h" +#include "dis7/EntityID.h" +#include "dis7/EventIdentifier.h" +#include "dis7/FundamentalOperationalData.h" +#include "dis7/IFFFundamentalParameterData.h" +#include "dis7/LayerHeader.h" +#include "dis7/SecondaryOperationalData.h" +#include "dis7/SystemIdentifier.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// This PDU is written according SISO Standard, the link is on below: +// https://www.sisostds.org/DesktopModules/Bring2mind/DMX/API/Entries/Download?Command=Core_Download&EntryId=36292&PortalId=0&TabId=105 +// Another good document for DIS v6 and v7 is: +// https://www.sisostds.org/DesktopModules/Bring2mind/DMX/API/Entries/Download?Command=Core_Download&EntryId=29289&PortalId=0&TabId=105 + +// @author semihkurt , 09/04/2021 + +class OPENDIS7_EXPORT IFFPdu : public DistributedEmissionsFamilyPdu { + protected: + /** ID of the entity emitting */ + EntityID _emittingEntityID; + + /** ID of event */ + EventIdentifier _eventID; + + Vector3Float _relativeAntennaLocation; + + /** How many iff parameters are in the variable length list */ + uint32_t _numberOfIFFParameters; + + SystemIdentifier _systemID; + + uint8_t _systemDesignator; + + uint8_t _systemSpecificData; + + FundamentalOperationalData _fundamentalOperationalData; + + LayerHeader _layerHeader; + + BeamData _beamData; + + SecondaryOperationalData _secondaryOperationalData; + + std::vector _iffParameters; + + public: + IFFPdu(); + virtual ~IFFPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEmittingEntityID(); + const EntityID& getEmittingEntityID() const; + void setEmittingEntityID(const EntityID& pX); + + EventIdentifier& getEventID(); + const EventIdentifier& getEventID() const; + void setEventID(const EventIdentifier& pX); + + Vector3Float& getRelativeAntennaLocation(); + const Vector3Float& getRelativeAntennaLocation() const; + void setRelativeAntennaLocation(const Vector3Float& pX); + + uint32_t getNumberOfIFFParameters() const; + + SystemIdentifier& getSystemID(); + const SystemIdentifier& getSystemID() const; + void setSystemID(const SystemIdentifier& pX); + + uint8_t getSystemDesignator() const; + void setSystemDesignator(uint8_t pX); + + uint8_t getSystemSpecificData() const; + void setSystemSpecificData(uint8_t pX); + + FundamentalOperationalData& getFundamentalOperationalData(); + const FundamentalOperationalData& getFundamentalOperationalData() const; + void setFundamentalOperationalData(const FundamentalOperationalData& pX); + + LayerHeader& getLayerHeader(); + const LayerHeader& getLayerHeader() const; + void setLayerHeader(const LayerHeader& pX); + + BeamData& getBeamData(); + const BeamData& getBeamData() const; + void setBeamData(const BeamData& pX); + + SecondaryOperationalData& getSecondaryOperationalData(); + const SecondaryOperationalData& getSecondaryOperationalData() const; + void setSecondaryOperationalData(const SecondaryOperationalData& pX); + + std::vector& getIFFParameters(); + const std::vector& getIFFParameters() const; + void setIFFParameters(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IFFPdu& rhs) const; +}; +} // namespace DIS diff --git a/src/dis7/distributed_emissions/JammingTechnique.cpp b/src/dis7/distributed_emissions/JammingTechnique.cpp new file mode 100644 index 00000000..115ae27b --- /dev/null +++ b/src/dis7/distributed_emissions/JammingTechnique.cpp @@ -0,0 +1,90 @@ +#include "dis7/JammingTechnique.h" + +using namespace DIS; + +JammingTechnique::JammingTechnique() + : _kind(0), _category(0), _subcategory(0), _specific(0) {} + +JammingTechnique::~JammingTechnique() {} + +uint8_t JammingTechnique::getKind() const { return _kind; } + +void JammingTechnique::setKind(uint8_t pX) { _kind = pX; } + +uint8_t JammingTechnique::getCategory() const { return _category; } + +void JammingTechnique::setCategory(uint8_t pX) { _category = pX; } + +uint8_t JammingTechnique::getSubcategory() const { return _subcategory; } + +void JammingTechnique::setSubcategory(uint8_t pX) { _subcategory = pX; } + +uint8_t JammingTechnique::getSpecific() const { return _specific; } + +void JammingTechnique::setSpecific(uint8_t pX) { _specific = pX; } + +void JammingTechnique::marshal(DataStream& dataStream) const { + dataStream << _kind; + dataStream << _category; + dataStream << _subcategory; + dataStream << _specific; +} + +void JammingTechnique::unmarshal(DataStream& dataStream) { + dataStream >> _kind; + dataStream >> _category; + dataStream >> _subcategory; + dataStream >> _specific; +} + +bool JammingTechnique::operator==(const JammingTechnique& rhs) const { + bool ivarsEqual = true; + + if (!(_kind == rhs._kind)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_subcategory == rhs._subcategory)) ivarsEqual = false; + if (!(_specific == rhs._specific)) ivarsEqual = false; + + return ivarsEqual; +} + +int JammingTechnique::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _kind + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _subcategory + marshalSize = marshalSize + 1; // _specific + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/JammingTechnique.h b/src/dis7/distributed_emissions/JammingTechnique.h new file mode 100644 index 00000000..d8fa5be7 --- /dev/null +++ b/src/dis7/distributed_emissions/JammingTechnique.h @@ -0,0 +1,78 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Jamming technique. Section 6.2.50 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT JammingTechnique { + protected: + uint8_t _kind; + + uint8_t _category; + + uint8_t _subcategory; + + uint8_t _specific; + + public: + JammingTechnique(); + virtual ~JammingTechnique(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getKind() const; + void setKind(uint8_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + uint8_t getSpecific() const; + void setSpecific(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const JammingTechnique& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/LayerHeader.cpp b/src/dis7/distributed_emissions/LayerHeader.cpp new file mode 100644 index 00000000..bfca331a --- /dev/null +++ b/src/dis7/distributed_emissions/LayerHeader.cpp @@ -0,0 +1,87 @@ +#include "dis7/LayerHeader.h" + +using namespace DIS; + +LayerHeader::LayerHeader() + : _layerNumber(0), _layerSpecificInformation(0), _length(0) {} + +LayerHeader::~LayerHeader() {} + +uint8_t LayerHeader::getLayerNumber() const { return _layerNumber; } + +void LayerHeader::setLayerNumber(uint8_t pX) { _layerNumber = pX; } + +uint8_t LayerHeader::getLayerSpecificInformation() const { + return _layerSpecificInformation; +} + +void LayerHeader::setLayerSpecificInformation(uint8_t pX) { + _layerSpecificInformation = pX; +} + +uint16_t LayerHeader::getLength() const { return _length; } + +void LayerHeader::setLength(uint16_t pX) { _length = pX; } + +void LayerHeader::marshal(DataStream& dataStream) const { + dataStream << _layerNumber; + dataStream << _layerSpecificInformation; + dataStream << _length; +} + +void LayerHeader::unmarshal(DataStream& dataStream) { + dataStream >> _layerNumber; + dataStream >> _layerSpecificInformation; + dataStream >> _length; +} + +bool LayerHeader::operator==(const LayerHeader& rhs) const { + bool ivarsEqual = true; + + if (!(_layerNumber == rhs._layerNumber)) ivarsEqual = false; + if (!(_layerSpecificInformation == rhs._layerSpecificInformation)) + ivarsEqual = false; + if (!(_length == rhs._length)) ivarsEqual = false; + + return ivarsEqual; +} + +int LayerHeader::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _layerNumber + marshalSize = marshalSize + 1; // _layerSpecificInformation + marshalSize = marshalSize + 2; // _length + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/LayerHeader.h b/src/dis7/distributed_emissions/LayerHeader.h new file mode 100644 index 00000000..1766d8f6 --- /dev/null +++ b/src/dis7/distributed_emissions/LayerHeader.h @@ -0,0 +1,78 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The identification of the additional information layer number, layer-specific +// information, and the length of the layer. Section 6.2.52 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT LayerHeader { + protected: + uint8_t _layerNumber; + + /** field shall specify layer-specific information that varies by System Type + * (see 6.2.86) and Layer Number. */ + uint8_t _layerSpecificInformation; + + /** This field shall specify the length in octets of the layer, including the + * Layer Header record */ + uint16_t _length; + + public: + LayerHeader(); + virtual ~LayerHeader(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getLayerNumber() const; + void setLayerNumber(uint8_t pX); + + uint8_t getLayerSpecificInformation() const; + void setLayerSpecificInformation(uint8_t pX); + + uint16_t getLength() const; + void setLength(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LayerHeader& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/PropulsionSystemData.cpp b/src/dis7/distributed_emissions/PropulsionSystemData.cpp new file mode 100644 index 00000000..1be2d64a --- /dev/null +++ b/src/dis7/distributed_emissions/PropulsionSystemData.cpp @@ -0,0 +1,74 @@ +#include "dis7/PropulsionSystemData.h" + +using namespace DIS; + +PropulsionSystemData::PropulsionSystemData() + : _powerSetting(0.0), _engineRpm(0.0) {} + +PropulsionSystemData::~PropulsionSystemData() {} + +float PropulsionSystemData::getPowerSetting() const { return _powerSetting; } + +void PropulsionSystemData::setPowerSetting(float pX) { _powerSetting = pX; } + +float PropulsionSystemData::getEngineRpm() const { return _engineRpm; } + +void PropulsionSystemData::setEngineRpm(float pX) { _engineRpm = pX; } + +void PropulsionSystemData::marshal(DataStream& dataStream) const { + dataStream << _powerSetting; + dataStream << _engineRpm; +} + +void PropulsionSystemData::unmarshal(DataStream& dataStream) { + dataStream >> _powerSetting; + dataStream >> _engineRpm; +} + +bool PropulsionSystemData::operator==(const PropulsionSystemData& rhs) const { + bool ivarsEqual = true; + + if (!(_powerSetting == rhs._powerSetting)) ivarsEqual = false; + if (!(_engineRpm == rhs._engineRpm)) ivarsEqual = false; + + return ivarsEqual; +} + +int PropulsionSystemData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _powerSetting + marshalSize = marshalSize + 4; // _engineRpm + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/PropulsionSystemData.h b/src/dis7/distributed_emissions/PropulsionSystemData.h new file mode 100644 index 00000000..2646c372 --- /dev/null +++ b/src/dis7/distributed_emissions/PropulsionSystemData.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// contains information describing the propulsion systems of the entity. This +// information shall be provided for each active propulsion system defined. +// Section 6.2.68 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT PropulsionSystemData { + protected: + /** powerSetting */ + float _powerSetting; + + /** engine RPMs */ + float _engineRpm; + + public: + PropulsionSystemData(); + virtual ~PropulsionSystemData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getPowerSetting() const; + void setPowerSetting(float pX); + + float getEngineRpm() const; + void setEngineRpm(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const PropulsionSystemData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/SecondaryOperationalData.cpp b/src/dis7/distributed_emissions/SecondaryOperationalData.cpp new file mode 100644 index 00000000..6ad61e1c --- /dev/null +++ b/src/dis7/distributed_emissions/SecondaryOperationalData.cpp @@ -0,0 +1,101 @@ +#include "dis7/SecondaryOperationalData.h" + +using namespace DIS; + +SecondaryOperationalData::SecondaryOperationalData() + : _operationalData1(0), + _operationalData2(0), + _numberOfIFFFundamentalParameterRecords(0) {} + +SecondaryOperationalData::~SecondaryOperationalData() {} + +uint8_t SecondaryOperationalData::getOperationalData1() const { + return _operationalData1; +} + +void SecondaryOperationalData::setOperationalData1(uint8_t pX) { + _operationalData1 = pX; +} + +uint8_t SecondaryOperationalData::getOperationalData2() const { + return _operationalData2; +} + +void SecondaryOperationalData::setOperationalData2(uint8_t pX) { + _operationalData2 = pX; +} + +uint16_t +SecondaryOperationalData::getNumberOfIFFFundamentalParameterRecords() const { + return _numberOfIFFFundamentalParameterRecords; +} + +void SecondaryOperationalData::setNumberOfIFFFundamentalParameterRecords( + uint16_t pX) { + _numberOfIFFFundamentalParameterRecords = pX; +} + +void SecondaryOperationalData::marshal(DataStream& dataStream) const { + dataStream << _operationalData1; + dataStream << _operationalData2; + dataStream << _numberOfIFFFundamentalParameterRecords; +} + +void SecondaryOperationalData::unmarshal(DataStream& dataStream) { + dataStream >> _operationalData1; + dataStream >> _operationalData2; + dataStream >> _numberOfIFFFundamentalParameterRecords; +} + +bool SecondaryOperationalData::operator==( + const SecondaryOperationalData& rhs) const { + bool ivarsEqual = true; + + if (!(_operationalData1 == rhs._operationalData1)) ivarsEqual = false; + if (!(_operationalData2 == rhs._operationalData2)) ivarsEqual = false; + if (!(_numberOfIFFFundamentalParameterRecords == + rhs._numberOfIFFFundamentalParameterRecords)) + ivarsEqual = false; + + return ivarsEqual; +} + +int SecondaryOperationalData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _operationalData1 + marshalSize = marshalSize + 1; // _operationalData2 + marshalSize = marshalSize + 2; // _numberOfIFFFundamentalParameterRecords + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/SecondaryOperationalData.h b/src/dis7/distributed_emissions/SecondaryOperationalData.h new file mode 100644 index 00000000..e40ead8e --- /dev/null +++ b/src/dis7/distributed_emissions/SecondaryOperationalData.h @@ -0,0 +1,79 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Additional operational data for an IFF emitting system and the number of IFF +// Fundamental Parameter Data records Section 6.2.76. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SecondaryOperationalData { + protected: + /** additional operational characteristics of the IFF emitting system. Each + * 8-bit field will vary depending on the system type. */ + uint8_t _operationalData1; + + /** additional operational characteristics of the IFF emitting system. Each + * 8-bit field will vary depending on the system type. */ + uint8_t _operationalData2; + + /** the number of IFF Fundamental Parameter Data records that follow */ + uint16_t _numberOfIFFFundamentalParameterRecords; + + public: + SecondaryOperationalData(); + virtual ~SecondaryOperationalData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getOperationalData1() const; + void setOperationalData1(uint8_t pX); + + uint8_t getOperationalData2() const; + void setOperationalData2(uint8_t pX); + + uint16_t getNumberOfIFFFundamentalParameterRecords() const; + void setNumberOfIFFFundamentalParameterRecords(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SecondaryOperationalData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/SeesPdu.cpp b/src/dis7/distributed_emissions/SeesPdu.cpp new file mode 100644 index 00000000..22e7f902 --- /dev/null +++ b/src/dis7/distributed_emissions/SeesPdu.cpp @@ -0,0 +1,223 @@ +#include "dis7/SeesPdu.h" + +using namespace DIS; + +SeesPdu::SeesPdu() + : DistributedEmissionsFamilyPdu(), + _orginatingEntityID(), + _infraredSignatureRepresentationIndex(0), + _acousticSignatureRepresentationIndex(0), + _radarCrossSectionSignatureRepresentationIndex(0), + _numberOfPropulsionSystems(0), + _numberOfVectoringNozzleSystems(0) { + setPduType(30); +} + +SeesPdu::~SeesPdu() { + _propulsionSystemData.clear(); + _vectoringSystemData.clear(); +} + +EntityID& SeesPdu::getOrginatingEntityID() { return _orginatingEntityID; } + +const EntityID& SeesPdu::getOrginatingEntityID() const { + return _orginatingEntityID; +} + +void SeesPdu::setOrginatingEntityID(const EntityID& pX) { + _orginatingEntityID = pX; +} + +uint16_t SeesPdu::getInfraredSignatureRepresentationIndex() const { + return _infraredSignatureRepresentationIndex; +} + +void SeesPdu::setInfraredSignatureRepresentationIndex(uint16_t pX) { + _infraredSignatureRepresentationIndex = pX; +} + +uint16_t SeesPdu::getAcousticSignatureRepresentationIndex() const { + return _acousticSignatureRepresentationIndex; +} + +void SeesPdu::setAcousticSignatureRepresentationIndex(uint16_t pX) { + _acousticSignatureRepresentationIndex = pX; +} + +uint16_t SeesPdu::getRadarCrossSectionSignatureRepresentationIndex() + const { + return _radarCrossSectionSignatureRepresentationIndex; +} + +void SeesPdu::setRadarCrossSectionSignatureRepresentationIndex( + uint16_t pX) { + _radarCrossSectionSignatureRepresentationIndex = pX; +} + +uint16_t SeesPdu::getNumberOfPropulsionSystems() const { + return _propulsionSystemData.size(); +} + +uint16_t SeesPdu::getNumberOfVectoringNozzleSystems() const { + return _vectoringSystemData.size(); +} + +std::vector& SeesPdu::getPropulsionSystemData() { + return _propulsionSystemData; +} + +const std::vector& SeesPdu::getPropulsionSystemData() + const { + return _propulsionSystemData; +} + +void SeesPdu::setPropulsionSystemData( + const std::vector& pX) { + _propulsionSystemData = pX; +} + +std::vector& SeesPdu::getVectoringSystemData() { + return _vectoringSystemData; +} + +const std::vector& SeesPdu::getVectoringSystemData() + const { + return _vectoringSystemData; +} + +void SeesPdu::setVectoringSystemData( + const std::vector& pX) { + _vectoringSystemData = pX; +} + +void SeesPdu::marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _orginatingEntityID.marshal(dataStream); + dataStream << _infraredSignatureRepresentationIndex; + dataStream << _acousticSignatureRepresentationIndex; + dataStream << _radarCrossSectionSignatureRepresentationIndex; + dataStream << (uint16_t)_propulsionSystemData.size(); + dataStream << (uint16_t)_vectoringSystemData.size(); + + for (size_t idx = 0; idx < _propulsionSystemData.size(); idx++) { + PropulsionSystemData x = _propulsionSystemData[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _vectoringSystemData.size(); idx++) { + VectoringNozzleSystem x = _vectoringSystemData[idx]; + x.marshal(dataStream); + } +} + +void SeesPdu::unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _orginatingEntityID.unmarshal(dataStream); + dataStream >> _infraredSignatureRepresentationIndex; + dataStream >> _acousticSignatureRepresentationIndex; + dataStream >> _radarCrossSectionSignatureRepresentationIndex; + dataStream >> _numberOfPropulsionSystems; + dataStream >> _numberOfVectoringNozzleSystems; + + _propulsionSystemData.clear(); + for (size_t idx = 0; idx < _numberOfPropulsionSystems; idx++) { + PropulsionSystemData x; + x.unmarshal(dataStream); + _propulsionSystemData.push_back(x); + } + + _vectoringSystemData.clear(); + for (size_t idx = 0; idx < _numberOfVectoringNozzleSystems; idx++) { + VectoringNozzleSystem x; + x.unmarshal(dataStream); + _vectoringSystemData.push_back(x); + } +} + +bool SeesPdu::operator==(const SeesPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_orginatingEntityID == rhs._orginatingEntityID)) ivarsEqual = false; + if (!(_infraredSignatureRepresentationIndex == + rhs._infraredSignatureRepresentationIndex)) + ivarsEqual = false; + if (!(_acousticSignatureRepresentationIndex == + rhs._acousticSignatureRepresentationIndex)) + ivarsEqual = false; + if (!(_radarCrossSectionSignatureRepresentationIndex == + rhs._radarCrossSectionSignatureRepresentationIndex)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _propulsionSystemData.size(); idx++) { + if (!(_propulsionSystemData[idx] == rhs._propulsionSystemData[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _vectoringSystemData.size(); idx++) { + if (!(_vectoringSystemData[idx] == rhs._vectoringSystemData[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int SeesPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID + marshalSize = marshalSize + 2; // _infraredSignatureRepresentationIndex + marshalSize = marshalSize + 2; // _acousticSignatureRepresentationIndex + marshalSize = + marshalSize + 2; // _radarCrossSectionSignatureRepresentationIndex + marshalSize = marshalSize + 2; // _numberOfPropulsionSystems + marshalSize = marshalSize + 2; // _numberOfVectoringNozzleSystems + + for (uint64_t idx = 0; idx < _propulsionSystemData.size(); idx++) { + PropulsionSystemData listElement = _propulsionSystemData[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _vectoringSystemData.size(); idx++) { + VectoringNozzleSystem listElement = _vectoringSystemData[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/SeesPdu.h b/src/dis7/distributed_emissions/SeesPdu.h new file mode 100644 index 00000000..3c1dc652 --- /dev/null +++ b/src/dis7/distributed_emissions/SeesPdu.h @@ -0,0 +1,114 @@ +#pragma once + +#include + +#include "dis7/DistributedEmissionsFamilyPdu.h" +#include "dis7/EntityID.h" +#include "dis7/PropulsionSystemData.h" +#include "dis7/VectoringNozzleSystem.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// SEES PDU, supplemental emissions entity state information. Section 7.6.6 +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SeesPdu : public DistributedEmissionsFamilyPdu { + protected: + /** Originating entity ID */ + EntityID _orginatingEntityID; + + /** IR Signature representation index */ + uint16_t _infraredSignatureRepresentationIndex; + + /** acoustic Signature representation index */ + uint16_t _acousticSignatureRepresentationIndex; + + /** radar cross section representation index */ + uint16_t _radarCrossSectionSignatureRepresentationIndex; + + /** how many propulsion systems */ + uint16_t _numberOfPropulsionSystems; + + /** how many vectoring nozzle systems */ + uint16_t _numberOfVectoringNozzleSystems; + + /** variable length list of propulsion system data */ + std::vector _propulsionSystemData; + + /** variable length list of vectoring system data */ + std::vector _vectoringSystemData; + + public: + SeesPdu(); + virtual ~SeesPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOrginatingEntityID(); + const EntityID& getOrginatingEntityID() const; + void setOrginatingEntityID(const EntityID& pX); + + uint16_t getInfraredSignatureRepresentationIndex() const; + void setInfraredSignatureRepresentationIndex(uint16_t pX); + + uint16_t getAcousticSignatureRepresentationIndex() const; + void setAcousticSignatureRepresentationIndex(uint16_t pX); + + uint16_t getRadarCrossSectionSignatureRepresentationIndex() const; + void setRadarCrossSectionSignatureRepresentationIndex(uint16_t pX); + + uint16_t getNumberOfPropulsionSystems() const; + + uint16_t getNumberOfVectoringNozzleSystems() const; + + std::vector& getPropulsionSystemData(); + const std::vector& getPropulsionSystemData() const; + void setPropulsionSystemData(const std::vector& pX); + + std::vector& getVectoringSystemData(); + const std::vector& getVectoringSystemData() const; + void setVectoringSystemData(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SeesPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/SystemIdentifier.cpp b/src/dis7/distributed_emissions/SystemIdentifier.cpp new file mode 100644 index 00000000..c33fc35b --- /dev/null +++ b/src/dis7/distributed_emissions/SystemIdentifier.cpp @@ -0,0 +1,94 @@ +#include "dis7/SystemIdentifier.h" + +using namespace DIS; + +SystemIdentifier::SystemIdentifier() + : _systemType(0), _systemName(0), _systemMode(0), _changeOptions(0) {} + +SystemIdentifier::~SystemIdentifier() {} + +uint16_t SystemIdentifier::getSystemType() const { return _systemType; } + +void SystemIdentifier::setSystemType(uint16_t pX) { _systemType = pX; } + +uint16_t SystemIdentifier::getSystemName() const { return _systemName; } + +void SystemIdentifier::setSystemName(uint16_t pX) { _systemName = pX; } + +uint8_t SystemIdentifier::getSystemMode() const { return _systemMode; } + +void SystemIdentifier::setSystemMode(uint8_t pX) { _systemMode = pX; } + +uint8_t SystemIdentifier::getChangeOptions() const { + return _changeOptions; +} + +void SystemIdentifier::setChangeOptions(uint8_t pX) { + _changeOptions = pX; +} + +void SystemIdentifier::marshal(DataStream& dataStream) const { + dataStream << _systemType; + dataStream << _systemName; + dataStream << _systemMode; + dataStream << _changeOptions; +} + +void SystemIdentifier::unmarshal(DataStream& dataStream) { + dataStream >> _systemType; + dataStream >> _systemName; + dataStream >> _systemMode; + dataStream >> _changeOptions; +} + +bool SystemIdentifier::operator==(const SystemIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_systemType == rhs._systemType)) ivarsEqual = false; + if (!(_systemName == rhs._systemName)) ivarsEqual = false; + if (!(_systemMode == rhs._systemMode)) ivarsEqual = false; + if (!(_changeOptions == rhs._changeOptions)) ivarsEqual = false; + + return ivarsEqual; +} + +int SystemIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _systemType + marshalSize = marshalSize + 2; // _systemName + marshalSize = marshalSize + 1; // _systemMode + marshalSize = marshalSize + 1; // _changeOptions + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/SystemIdentifier.h b/src/dis7/distributed_emissions/SystemIdentifier.h new file mode 100644 index 00000000..870f81d9 --- /dev/null +++ b/src/dis7/distributed_emissions/SystemIdentifier.h @@ -0,0 +1,82 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The ID of the IFF emitting system. NOT COMPLETE. Section 6.2.86 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SystemIdentifier { + protected: + /** general type of emitting system, an enumeration */ + uint16_t _systemType; + + /** named type of system, an enumeration */ + uint16_t _systemName; + + /** mode of operation for the system, an enumeration */ + uint8_t _systemMode; + + /** status of this PDU, see section 6.2.15 */ + uint8_t _changeOptions; + + public: + SystemIdentifier(); + virtual ~SystemIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSystemType() const; + void setSystemType(uint16_t pX); + + uint16_t getSystemName() const; + void setSystemName(uint16_t pX); + + uint8_t getSystemMode() const; + void setSystemMode(uint8_t pX); + + uint8_t getChangeOptions() const; + void setChangeOptions(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SystemIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/TrackJamData.cpp b/src/dis7/distributed_emissions/TrackJamData.cpp new file mode 100644 index 00000000..ded941e1 --- /dev/null +++ b/src/dis7/distributed_emissions/TrackJamData.cpp @@ -0,0 +1,83 @@ +#include "dis7/TrackJamData.h" + +using namespace DIS; + +TrackJamData::TrackJamData() : _entityID(), _emitterNumber(0), _beamNumber(0) {} + +TrackJamData::~TrackJamData() {} + +EntityID& TrackJamData::getEntityID() { return _entityID; } + +const EntityID& TrackJamData::getEntityID() const { return _entityID; } + +void TrackJamData::setEntityID(const EntityID& pX) { _entityID = pX; } + +uint8_t TrackJamData::getEmitterNumber() const { return _emitterNumber; } + +void TrackJamData::setEmitterNumber(uint8_t pX) { _emitterNumber = pX; } + +uint8_t TrackJamData::getBeamNumber() const { return _beamNumber; } + +void TrackJamData::setBeamNumber(uint8_t pX) { _beamNumber = pX; } + +void TrackJamData::marshal(DataStream& dataStream) const { + _entityID.marshal(dataStream); + dataStream << _emitterNumber; + dataStream << _beamNumber; +} + +void TrackJamData::unmarshal(DataStream& dataStream) { + _entityID.unmarshal(dataStream); + dataStream >> _emitterNumber; + dataStream >> _beamNumber; +} + +bool TrackJamData::operator==(const TrackJamData& rhs) const { + bool ivarsEqual = true; + + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_emitterNumber == rhs._emitterNumber)) ivarsEqual = false; + if (!(_beamNumber == rhs._beamNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int TrackJamData::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID + marshalSize = marshalSize + 1; // _emitterNumber + marshalSize = marshalSize + 1; // _beamNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/TrackJamData.h b/src/dis7/distributed_emissions/TrackJamData.h new file mode 100644 index 00000000..71ebc688 --- /dev/null +++ b/src/dis7/distributed_emissions/TrackJamData.h @@ -0,0 +1,79 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Track-Jam data Section 6.2.89 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT TrackJamData { + protected: + /** the entity tracked or illumated, or an emitter beam targeted with jamming + */ + EntityID _entityID; + + /** Emitter system associated with the entity */ + uint8_t _emitterNumber; + + /** Beam associated with the entity */ + uint8_t _beamNumber; + + public: + TrackJamData(); + virtual ~TrackJamData(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + uint8_t getEmitterNumber() const; + void setEmitterNumber(uint8_t pX); + + uint8_t getBeamNumber() const; + void setBeamNumber(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const TrackJamData& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/UnderwaterAcousticsPdu.cpp b/src/dis7/distributed_emissions/UnderwaterAcousticsPdu.cpp new file mode 100644 index 00000000..c7ef66d2 --- /dev/null +++ b/src/dis7/distributed_emissions/UnderwaterAcousticsPdu.cpp @@ -0,0 +1,252 @@ +#include "dis7/UaPdu.h" + +using namespace DIS; + +UaPdu::UaPdu() + : DistributedEmissionsFamilyPdu(), + _emittingEntityID(), + _eventID(), + _stateChangeIndicator(0), + _pad(0), + _passiveParameterIndex(0), + _propulsionPlantConfiguration(0), + _numberOfShafts(0), + _numberOfAPAs(0), + _numberOfUAEmitterSystems(0) { + setPduType(29); +} + +UaPdu::~UaPdu() { + _shaftRPMs.clear(); + _apaData.clear(); + _emitterSystems.clear(); +} + +EntityID& UaPdu::getEmittingEntityID() { return _emittingEntityID; } + +const EntityID& UaPdu::getEmittingEntityID() const { return _emittingEntityID; } + +void UaPdu::setEmittingEntityID(const EntityID& pX) { _emittingEntityID = pX; } + +EventIdentifier& UaPdu::getEventID() { return _eventID; } + +const EventIdentifier& UaPdu::getEventID() const { return _eventID; } + +void UaPdu::setEventID(const EventIdentifier& pX) { _eventID = pX; } + +char UaPdu::getStateChangeIndicator() const { return _stateChangeIndicator; } + +void UaPdu::setStateChangeIndicator(char pX) { _stateChangeIndicator = pX; } + +char UaPdu::getPad() const { return _pad; } + +void UaPdu::setPad(char pX) { _pad = pX; } + +uint16_t UaPdu::getPassiveParameterIndex() const { + return _passiveParameterIndex; +} + +void UaPdu::setPassiveParameterIndex(uint16_t pX) { + _passiveParameterIndex = pX; +} + +uint8_t UaPdu::getPropulsionPlantConfiguration() const { + return _propulsionPlantConfiguration; +} + +void UaPdu::setPropulsionPlantConfiguration(uint8_t pX) { + _propulsionPlantConfiguration = pX; +} + +uint8_t UaPdu::getNumberOfShafts() const { return _shaftRPMs.size(); } + +uint8_t UaPdu::getNumberOfAPAs() const { return _apaData.size(); } + +uint8_t UaPdu::getNumberOfUAEmitterSystems() const { + return _emitterSystems.size(); +} + +std::vector& UaPdu::getShaftRPMs() { return _shaftRPMs; } + +const std::vector& UaPdu::getShaftRPMs() const { + return _shaftRPMs; +} + +void UaPdu::setShaftRPMs(const std::vector& pX) { + _shaftRPMs = pX; +} + +std::vector& UaPdu::getApaData() { return _apaData; } + +const std::vector& UaPdu::getApaData() const { return _apaData; } + +void UaPdu::setApaData(const std::vector& pX) { _apaData = pX; } + +std::vector& UaPdu::getEmitterSystems() { + return _emitterSystems; +} + +const std::vector& UaPdu::getEmitterSystems() const { + return _emitterSystems; +} + +void UaPdu::setEmitterSystems(const std::vector& pX) { + _emitterSystems = pX; +} + +void UaPdu::marshal(DataStream& dataStream) const { + DistributedEmissionsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _emittingEntityID.marshal(dataStream); + _eventID.marshal(dataStream); + dataStream << _stateChangeIndicator; + dataStream << _pad; + dataStream << _passiveParameterIndex; + dataStream << _propulsionPlantConfiguration; + dataStream << (uint8_t)_shaftRPMs.size(); + dataStream << (uint8_t)_apaData.size(); + dataStream << (uint8_t)_emitterSystems.size(); + + for (size_t idx = 0; idx < _shaftRPMs.size(); idx++) { + Vector3Float x = _shaftRPMs[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _apaData.size(); idx++) { + Vector3Float x = _apaData[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _emitterSystems.size(); idx++) { + Vector3Float x = _emitterSystems[idx]; + x.marshal(dataStream); + } +} + +void UaPdu::unmarshal(DataStream& dataStream) { + DistributedEmissionsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _emittingEntityID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + dataStream >> _stateChangeIndicator; + dataStream >> _pad; + dataStream >> _passiveParameterIndex; + dataStream >> _propulsionPlantConfiguration; + dataStream >> _numberOfShafts; + dataStream >> _numberOfAPAs; + dataStream >> _numberOfUAEmitterSystems; + + _shaftRPMs.clear(); + for (size_t idx = 0; idx < _numberOfShafts; idx++) { + Vector3Float x; + x.unmarshal(dataStream); + _shaftRPMs.push_back(x); + } + + _apaData.clear(); + for (size_t idx = 0; idx < _numberOfAPAs; idx++) { + Vector3Float x; + x.unmarshal(dataStream); + _apaData.push_back(x); + } + + _emitterSystems.clear(); + for (size_t idx = 0; idx < _numberOfUAEmitterSystems; idx++) { + Vector3Float x; + x.unmarshal(dataStream); + _emitterSystems.push_back(x); + } +} + +bool UaPdu::operator==(const UaPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = DistributedEmissionsFamilyPdu::operator==(rhs); + + if (!(_emittingEntityID == rhs._emittingEntityID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_stateChangeIndicator == rhs._stateChangeIndicator)) ivarsEqual = false; + if (!(_pad == rhs._pad)) ivarsEqual = false; + if (!(_passiveParameterIndex == rhs._passiveParameterIndex)) + ivarsEqual = false; + if (!(_propulsionPlantConfiguration == rhs._propulsionPlantConfiguration)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _shaftRPMs.size(); idx++) { + if (!(_shaftRPMs[idx] == rhs._shaftRPMs[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _apaData.size(); idx++) { + if (!(_apaData[idx] == rhs._apaData[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _emitterSystems.size(); idx++) { + if (!(_emitterSystems[idx] == rhs._emitterSystems[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int UaPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = DistributedEmissionsFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _emittingEntityID.getMarshalledSize(); // _emittingEntityID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + 1; // _stateChangeIndicator + marshalSize = marshalSize + 1; // _pad + marshalSize = marshalSize + 2; // _passiveParameterIndex + marshalSize = marshalSize + 1; // _propulsionPlantConfiguration + marshalSize = marshalSize + 1; // _numberOfShafts + marshalSize = marshalSize + 1; // _numberOfAPAs + marshalSize = marshalSize + 1; // _numberOfUAEmitterSystems + + for (uint64_t idx = 0; idx < _shaftRPMs.size(); idx++) { + Vector3Float listElement = _shaftRPMs[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _apaData.size(); idx++) { + Vector3Float listElement = _apaData[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _emitterSystems.size(); idx++) { + Vector3Float listElement = _emitterSystems[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/UnderwaterAcousticsPdu.h b/src/dis7/distributed_emissions/UnderwaterAcousticsPdu.h new file mode 100644 index 00000000..a483869b --- /dev/null +++ b/src/dis7/distributed_emissions/UnderwaterAcousticsPdu.h @@ -0,0 +1,150 @@ +#pragma once + +#include + +#include "dis7/DistributedEmissionsFamilyPdu.h" +#include "dis7/EntityID.h" +#include "dis7/EventIdentifier.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about underwater acoustic emmissions. This requires manual +// cleanup. The beam data records should ALL be a the finish, rather than +// attached to each emitter system. Section 7.6.4. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT UaPdu : public DistributedEmissionsFamilyPdu { + protected: + /** ID of the entity that is the source of the emission */ + EntityID _emittingEntityID; + + /** ID of event */ + EventIdentifier _eventID; + + /** This field shall be used to indicate whether the data in the UA PDU + * represent a state update or data that have changed since issuance of the + * last UA PDU */ + char _stateChangeIndicator; + + /** padding */ + char _pad; + + /** This field indicates which database record (or file) shall be used in the + * definition of passive signature (unintentional) emissions of the entity. + * The indicated database record (or file) shall define all noise generated + * as a function of propulsion plant configurations and associated + * auxiliaries. */ + uint16_t _passiveParameterIndex; + + /** This field shall specify the entity propulsion plant configuration. This + * field is used to determine the passive signature characteristics of an + * entity. */ + uint8_t _propulsionPlantConfiguration; + + /** This field shall represent the number of shafts on a platform */ + uint8_t _numberOfShafts; + + /** This field shall indicate the number of APAs described in the current UA + * PDU */ + uint8_t _numberOfAPAs; + + /** This field shall specify the number of UA emitter systems being described + * in the current UA PDU */ + uint8_t _numberOfUAEmitterSystems; + + /** shaft RPM values. THIS IS WRONG. It has the wrong class in the list. */ + std::vector _shaftRPMs; + + /** apaData. THIS IS WRONG. It has the worng class in the list. */ + std::vector _apaData; + + /** THIS IS WRONG. It has the wrong class in the list. */ + std::vector _emitterSystems; + + public: + UaPdu(); + virtual ~UaPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEmittingEntityID(); + const EntityID& getEmittingEntityID() const; + void setEmittingEntityID(const EntityID& pX); + + EventIdentifier& getEventID(); + const EventIdentifier& getEventID() const; + void setEventID(const EventIdentifier& pX); + + char getStateChangeIndicator() const; + void setStateChangeIndicator(char pX); + + char getPad() const; + void setPad(char pX); + + uint16_t getPassiveParameterIndex() const; + void setPassiveParameterIndex(uint16_t pX); + + uint8_t getPropulsionPlantConfiguration() const; + void setPropulsionPlantConfiguration(uint8_t pX); + + uint8_t getNumberOfShafts() const; + + uint8_t getNumberOfAPAs() const; + + uint8_t getNumberOfUAEmitterSystems() const; + + std::vector& getShaftRPMs(); + const std::vector& getShaftRPMs() const; + void setShaftRPMs(const std::vector& pX); + + std::vector& getApaData(); + const std::vector& getApaData() const; + void setApaData(const std::vector& pX); + + std::vector& getEmitterSystems(); + const std::vector& getEmitterSystems() const; + void setEmitterSystems(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const UaPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/VectoringNozzleSystem.cpp b/src/dis7/distributed_emissions/VectoringNozzleSystem.cpp new file mode 100644 index 00000000..0f72499d --- /dev/null +++ b/src/dis7/distributed_emissions/VectoringNozzleSystem.cpp @@ -0,0 +1,84 @@ +#include "dis7/VectoringNozzleSystem.h" + +using namespace DIS; + +VectoringNozzleSystem::VectoringNozzleSystem() + : _horizontalDeflectionAngle(0.0), _verticalDeflectionAngle(0.0) {} + +VectoringNozzleSystem::~VectoringNozzleSystem() {} + +float VectoringNozzleSystem::getHorizontalDeflectionAngle() const { + return _horizontalDeflectionAngle; +} + +void VectoringNozzleSystem::setHorizontalDeflectionAngle(float pX) { + _horizontalDeflectionAngle = pX; +} + +float VectoringNozzleSystem::getVerticalDeflectionAngle() const { + return _verticalDeflectionAngle; +} + +void VectoringNozzleSystem::setVerticalDeflectionAngle(float pX) { + _verticalDeflectionAngle = pX; +} + +void VectoringNozzleSystem::marshal(DataStream& dataStream) const { + dataStream << _horizontalDeflectionAngle; + dataStream << _verticalDeflectionAngle; +} + +void VectoringNozzleSystem::unmarshal(DataStream& dataStream) { + dataStream >> _horizontalDeflectionAngle; + dataStream >> _verticalDeflectionAngle; +} + +bool VectoringNozzleSystem::operator==(const VectoringNozzleSystem& rhs) const { + bool ivarsEqual = true; + + if (!(_horizontalDeflectionAngle == rhs._horizontalDeflectionAngle)) + ivarsEqual = false; + if (!(_verticalDeflectionAngle == rhs._verticalDeflectionAngle)) + ivarsEqual = false; + + return ivarsEqual; +} + +int VectoringNozzleSystem::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _horizontalDeflectionAngle + marshalSize = marshalSize + 4; // _verticalDeflectionAngle + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/distributed_emissions/VectoringNozzleSystem.h b/src/dis7/distributed_emissions/VectoringNozzleSystem.h new file mode 100644 index 00000000..b4cdadac --- /dev/null +++ b/src/dis7/distributed_emissions/VectoringNozzleSystem.h @@ -0,0 +1,70 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Operational data for describing the vectoring nozzle systems Section 6.2.96 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT VectoringNozzleSystem { + protected: + /** In degrees */ + float _horizontalDeflectionAngle; + + /** In degrees */ + float _verticalDeflectionAngle; + + public: + VectoringNozzleSystem(); + virtual ~VectoringNozzleSystem(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + float getHorizontalDeflectionAngle() const; + void setHorizontalDeflectionAngle(float pX); + + float getVerticalDeflectionAngle() const; + void setVerticalDeflectionAngle(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const VectoringNozzleSystem& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/AttributePdu.cpp b/src/dis7/entity_information/AttributePdu.cpp new file mode 100644 index 00000000..d210add2 --- /dev/null +++ b/src/dis7/entity_information/AttributePdu.cpp @@ -0,0 +1,178 @@ +#include "dis7/AttributePdu.h" + +using namespace DIS; + +AttributePdu::AttributePdu() + : EntityInformationFamilyPdu(), + _originatingSimulationAddress(), + _padding1(0), + _padding2(0), + _attributeRecordPduType(0), + _attributeRecordProtocolVersion(0), + _masterAttributeRecordType(0), + _actionCode(0), + _padding3(0), + _numberAttributeRecordSet(0) {} + +AttributePdu::~AttributePdu() {} + +SimulationAddress& AttributePdu::getOriginatingSimulationAddress() { + return _originatingSimulationAddress; +} + +const SimulationAddress& AttributePdu::getOriginatingSimulationAddress() const { + return _originatingSimulationAddress; +} + +void AttributePdu::setOriginatingSimulationAddress( + const SimulationAddress& pX) { + _originatingSimulationAddress = pX; +} + +int AttributePdu::getPadding1() const { return _padding1; } + +void AttributePdu::setPadding1(int pX) { _padding1 = pX; } + +int16_t AttributePdu::getPadding2() const { return _padding2; } + +void AttributePdu::setPadding2(int16_t pX) { _padding2 = pX; } + +uint8_t AttributePdu::getAttributeRecordPduType() const { + return _attributeRecordPduType; +} + +void AttributePdu::setAttributeRecordPduType(uint8_t pX) { + _attributeRecordPduType = pX; +} + +uint8_t AttributePdu::getAttributeRecordProtocolVersion() const { + return _attributeRecordProtocolVersion; +} + +void AttributePdu::setAttributeRecordProtocolVersion(uint8_t pX) { + _attributeRecordProtocolVersion = pX; +} + +uint32_t AttributePdu::getMasterAttributeRecordType() const { + return _masterAttributeRecordType; +} + +void AttributePdu::setMasterAttributeRecordType(uint32_t pX) { + _masterAttributeRecordType = pX; +} + +uint8_t AttributePdu::getActionCode() const { return _actionCode; } + +void AttributePdu::setActionCode(uint8_t pX) { _actionCode = pX; } + +char AttributePdu::getPadding3() const { return _padding3; } + +void AttributePdu::setPadding3(char pX) { _padding3 = pX; } + +uint16_t AttributePdu::getNumberAttributeRecordSet() const { + return _numberAttributeRecordSet; +} + +void AttributePdu::setNumberAttributeRecordSet(uint16_t pX) { + _numberAttributeRecordSet = pX; +} + +void AttributePdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _originatingSimulationAddress.marshal(dataStream); + dataStream << _padding1; + dataStream << _padding2; + dataStream << _attributeRecordPduType; + dataStream << _attributeRecordProtocolVersion; + dataStream << _masterAttributeRecordType; + dataStream << _actionCode; + dataStream << _padding3; + dataStream << _numberAttributeRecordSet; +} + +void AttributePdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _originatingSimulationAddress.unmarshal(dataStream); + dataStream >> _padding1; + dataStream >> _padding2; + dataStream >> _attributeRecordPduType; + dataStream >> _attributeRecordProtocolVersion; + dataStream >> _masterAttributeRecordType; + dataStream >> _actionCode; + dataStream >> _padding3; + dataStream >> _numberAttributeRecordSet; +} + +bool AttributePdu::operator==(const AttributePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_originatingSimulationAddress == rhs._originatingSimulationAddress)) + ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_attributeRecordPduType == rhs._attributeRecordPduType)) + ivarsEqual = false; + if (!(_attributeRecordProtocolVersion == rhs._attributeRecordProtocolVersion)) + ivarsEqual = false; + if (!(_masterAttributeRecordType == rhs._masterAttributeRecordType)) + ivarsEqual = false; + if (!(_actionCode == rhs._actionCode)) ivarsEqual = false; + if (!(_padding3 == rhs._padding3)) ivarsEqual = false; + if (!(_numberAttributeRecordSet == rhs._numberAttributeRecordSet)) + ivarsEqual = false; + + return ivarsEqual; +} + +int AttributePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _originatingSimulationAddress + .getMarshalledSize(); // _originatingSimulationAddress + marshalSize = marshalSize + 4; // _padding1 + marshalSize = marshalSize + 2; // _padding2 + marshalSize = marshalSize + 1; // _attributeRecordPduType + marshalSize = marshalSize + 1; // _attributeRecordProtocolVersion + marshalSize = marshalSize + 4; // _masterAttributeRecordType + marshalSize = marshalSize + 1; // _actionCode + marshalSize = marshalSize + 1; // _padding3 + marshalSize = marshalSize + 2; // _numberAttributeRecordSet + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/AttributePdu.h b/src/dis7/entity_information/AttributePdu.h new file mode 100644 index 00000000..eb9664fa --- /dev/null +++ b/src/dis7/entity_information/AttributePdu.h @@ -0,0 +1,130 @@ +#pragma once + +#include "dis7/EntityInformationFamilyPdu.h" +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about individual attributes for a particular entity, other +// object, or event may be communicated using an Attribute PDU. The Attribute +// PDU shall not be used to exchange data available in any other PDU except +// where explicitly mentioned in the PDU issuance instructions within this +// standard. See 5.3.6 for the information requirements and issuance and receipt +// rules for this PDU. Section 7.2.6. INCOMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AttributePdu : public EntityInformationFamilyPdu { + protected: + /** This field shall identify the simulation issuing the Attribute PDU. It + * shall be represented by a Simulation Address record (see 6.2.79). */ + SimulationAddress _originatingSimulationAddress; + + /** Padding */ + int _padding1; + + /** Padding */ + int16_t _padding2; + + /** This field shall represent the type of the PDU that is being extended or + * updated, if applicable. It shall be represented by an 8-bit enumeration. */ + uint8_t _attributeRecordPduType; + + /** This field shall indicate the Protocol Version associated with the + * Attribute Record PDU Type. It shall be represented by an 8-bit enumeration. + */ + uint8_t _attributeRecordProtocolVersion; + + /** This field shall contain the Attribute record type of the Attribute + * records in the PDU if they all have the same Attribute record type. It + * shall be represented by a 32-bit enumeration. */ + uint32_t _masterAttributeRecordType; + + /** This field shall identify the action code applicable to this Attribute + * PDU. The Action Code shall apply to all Attribute records contained in the + * PDU. It shall be represented by an 8-bit enumeration. */ + uint8_t _actionCode; + + /** Padding */ + char _padding3; + + /** This field shall specify the number of Attribute Record Sets that make up + * the remainder of the PDU. It shall be represented by a 16-bit unsigned + * integer. */ + uint16_t _numberAttributeRecordSet; + + public: + AttributePdu(); + virtual ~AttributePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getOriginatingSimulationAddress(); + const SimulationAddress& getOriginatingSimulationAddress() const; + void setOriginatingSimulationAddress(const SimulationAddress& pX); + + int getPadding1() const; + void setPadding1(int pX); + + int16_t getPadding2() const; + void setPadding2(int16_t pX); + + uint8_t getAttributeRecordPduType() const; + void setAttributeRecordPduType(uint8_t pX); + + uint8_t getAttributeRecordProtocolVersion() const; + void setAttributeRecordProtocolVersion(uint8_t pX); + + uint32_t getMasterAttributeRecordType() const; + void setMasterAttributeRecordType(uint32_t pX); + + uint8_t getActionCode() const; + void setActionCode(uint8_t pX); + + char getPadding3() const; + void setPadding3(char pX); + + uint16_t getNumberAttributeRecordSet() const; + void setNumberAttributeRecordSet(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AttributePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/CMakeLists.txt b/src/dis7/entity_information/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/entity_information/CollisionElasticPdu.cpp b/src/dis7/entity_information/CollisionElasticPdu.cpp new file mode 100644 index 00000000..380a3008 --- /dev/null +++ b/src/dis7/entity_information/CollisionElasticPdu.cpp @@ -0,0 +1,290 @@ +#include "dis7/CollisionElasticPdu.h" + +using namespace DIS; + +CollisionElasticPdu::CollisionElasticPdu() + : EntityInformationFamilyPdu(), + _issuingEntityID(), + _collidingEntityID(), + _collisionEventID(), + _pad(0), + _contactVelocity(), + _mass(0.0), + _locationOfImpact(), + _collisionIntermediateResultXX(0.0), + _collisionIntermediateResultXY(0.0), + _collisionIntermediateResultXZ(0.0), + _collisionIntermediateResultYY(0.0), + _collisionIntermediateResultYZ(0.0), + _collisionIntermediateResultZZ(0.0), + _unitSurfaceNormal(), + _coefficientOfRestitution(0.0) { + setPduType(66); + setProtocolFamily(1); +} + +CollisionElasticPdu::~CollisionElasticPdu() {} + +EntityID& CollisionElasticPdu::getIssuingEntityID() { return _issuingEntityID; } + +const EntityID& CollisionElasticPdu::getIssuingEntityID() const { + return _issuingEntityID; +} + +void CollisionElasticPdu::setIssuingEntityID(const EntityID& pX) { + _issuingEntityID = pX; +} + +EntityID& CollisionElasticPdu::getCollidingEntityID() { + return _collidingEntityID; +} + +const EntityID& CollisionElasticPdu::getCollidingEntityID() const { + return _collidingEntityID; +} + +void CollisionElasticPdu::setCollidingEntityID(const EntityID& pX) { + _collidingEntityID = pX; +} + +EventIdentifier& CollisionElasticPdu::getCollisionEventID() { + return _collisionEventID; +} + +const EventIdentifier& CollisionElasticPdu::getCollisionEventID() const { + return _collisionEventID; +} + +void CollisionElasticPdu::setCollisionEventID(const EventIdentifier& pX) { + _collisionEventID = pX; +} + +int16_t CollisionElasticPdu::getPad() const { return _pad; } + +void CollisionElasticPdu::setPad(int16_t pX) { _pad = pX; } + +Vector3Float& CollisionElasticPdu::getContactVelocity() { + return _contactVelocity; +} + +const Vector3Float& CollisionElasticPdu::getContactVelocity() const { + return _contactVelocity; +} + +void CollisionElasticPdu::setContactVelocity(const Vector3Float& pX) { + _contactVelocity = pX; +} + +float CollisionElasticPdu::getMass() const { return _mass; } + +void CollisionElasticPdu::setMass(float pX) { _mass = pX; } + +Vector3Float& CollisionElasticPdu::getLocationOfImpact() { + return _locationOfImpact; +} + +const Vector3Float& CollisionElasticPdu::getLocationOfImpact() const { + return _locationOfImpact; +} + +void CollisionElasticPdu::setLocationOfImpact(const Vector3Float& pX) { + _locationOfImpact = pX; +} + +float CollisionElasticPdu::getCollisionIntermediateResultXX() const { + return _collisionIntermediateResultXX; +} + +void CollisionElasticPdu::setCollisionIntermediateResultXX(float pX) { + _collisionIntermediateResultXX = pX; +} + +float CollisionElasticPdu::getCollisionIntermediateResultXY() const { + return _collisionIntermediateResultXY; +} + +void CollisionElasticPdu::setCollisionIntermediateResultXY(float pX) { + _collisionIntermediateResultXY = pX; +} + +float CollisionElasticPdu::getCollisionIntermediateResultXZ() const { + return _collisionIntermediateResultXZ; +} + +void CollisionElasticPdu::setCollisionIntermediateResultXZ(float pX) { + _collisionIntermediateResultXZ = pX; +} + +float CollisionElasticPdu::getCollisionIntermediateResultYY() const { + return _collisionIntermediateResultYY; +} + +void CollisionElasticPdu::setCollisionIntermediateResultYY(float pX) { + _collisionIntermediateResultYY = pX; +} + +float CollisionElasticPdu::getCollisionIntermediateResultYZ() const { + return _collisionIntermediateResultYZ; +} + +void CollisionElasticPdu::setCollisionIntermediateResultYZ(float pX) { + _collisionIntermediateResultYZ = pX; +} + +float CollisionElasticPdu::getCollisionIntermediateResultZZ() const { + return _collisionIntermediateResultZZ; +} + +void CollisionElasticPdu::setCollisionIntermediateResultZZ(float pX) { + _collisionIntermediateResultZZ = pX; +} + +Vector3Float& CollisionElasticPdu::getUnitSurfaceNormal() { + return _unitSurfaceNormal; +} + +const Vector3Float& CollisionElasticPdu::getUnitSurfaceNormal() const { + return _unitSurfaceNormal; +} + +void CollisionElasticPdu::setUnitSurfaceNormal(const Vector3Float& pX) { + _unitSurfaceNormal = pX; +} + +float CollisionElasticPdu::getCoefficientOfRestitution() const { + return _coefficientOfRestitution; +} + +void CollisionElasticPdu::setCoefficientOfRestitution(float pX) { + _coefficientOfRestitution = pX; +} + +void CollisionElasticPdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _issuingEntityID.marshal(dataStream); + _collidingEntityID.marshal(dataStream); + _collisionEventID.marshal(dataStream); + dataStream << _pad; + _contactVelocity.marshal(dataStream); + dataStream << _mass; + _locationOfImpact.marshal(dataStream); + dataStream << _collisionIntermediateResultXX; + dataStream << _collisionIntermediateResultXY; + dataStream << _collisionIntermediateResultXZ; + dataStream << _collisionIntermediateResultYY; + dataStream << _collisionIntermediateResultYZ; + dataStream << _collisionIntermediateResultZZ; + _unitSurfaceNormal.marshal(dataStream); + dataStream << _coefficientOfRestitution; +} + +void CollisionElasticPdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _issuingEntityID.unmarshal(dataStream); + _collidingEntityID.unmarshal(dataStream); + _collisionEventID.unmarshal(dataStream); + dataStream >> _pad; + _contactVelocity.unmarshal(dataStream); + dataStream >> _mass; + _locationOfImpact.unmarshal(dataStream); + dataStream >> _collisionIntermediateResultXX; + dataStream >> _collisionIntermediateResultXY; + dataStream >> _collisionIntermediateResultXZ; + dataStream >> _collisionIntermediateResultYY; + dataStream >> _collisionIntermediateResultYZ; + dataStream >> _collisionIntermediateResultZZ; + _unitSurfaceNormal.unmarshal(dataStream); + dataStream >> _coefficientOfRestitution; +} + +bool CollisionElasticPdu::operator==(const CollisionElasticPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_issuingEntityID == rhs._issuingEntityID)) ivarsEqual = false; + if (!(_collidingEntityID == rhs._collidingEntityID)) ivarsEqual = false; + if (!(_collisionEventID == rhs._collisionEventID)) ivarsEqual = false; + if (!(_pad == rhs._pad)) ivarsEqual = false; + if (!(_contactVelocity == rhs._contactVelocity)) ivarsEqual = false; + if (!(_mass == rhs._mass)) ivarsEqual = false; + if (!(_locationOfImpact == rhs._locationOfImpact)) ivarsEqual = false; + if (!(_collisionIntermediateResultXX == rhs._collisionIntermediateResultXX)) + ivarsEqual = false; + if (!(_collisionIntermediateResultXY == rhs._collisionIntermediateResultXY)) + ivarsEqual = false; + if (!(_collisionIntermediateResultXZ == rhs._collisionIntermediateResultXZ)) + ivarsEqual = false; + if (!(_collisionIntermediateResultYY == rhs._collisionIntermediateResultYY)) + ivarsEqual = false; + if (!(_collisionIntermediateResultYZ == rhs._collisionIntermediateResultYZ)) + ivarsEqual = false; + if (!(_collisionIntermediateResultZZ == rhs._collisionIntermediateResultZZ)) + ivarsEqual = false; + if (!(_unitSurfaceNormal == rhs._unitSurfaceNormal)) ivarsEqual = false; + if (!(_coefficientOfRestitution == rhs._coefficientOfRestitution)) + ivarsEqual = false; + + return ivarsEqual; +} + +int CollisionElasticPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _issuingEntityID.getMarshalledSize(); // _issuingEntityID + marshalSize = marshalSize + + _collidingEntityID.getMarshalledSize(); // _collidingEntityID + marshalSize = + marshalSize + _collisionEventID.getMarshalledSize(); // _collisionEventID + marshalSize = marshalSize + 2; // _pad + marshalSize = + marshalSize + _contactVelocity.getMarshalledSize(); // _contactVelocity + marshalSize = marshalSize + 4; // _mass + marshalSize = + marshalSize + _locationOfImpact.getMarshalledSize(); // _locationOfImpact + marshalSize = marshalSize + 4; // _collisionIntermediateResultXX + marshalSize = marshalSize + 4; // _collisionIntermediateResultXY + marshalSize = marshalSize + 4; // _collisionIntermediateResultXZ + marshalSize = marshalSize + 4; // _collisionIntermediateResultYY + marshalSize = marshalSize + 4; // _collisionIntermediateResultYZ + marshalSize = marshalSize + 4; // _collisionIntermediateResultZZ + marshalSize = marshalSize + + _unitSurfaceNormal.getMarshalledSize(); // _unitSurfaceNormal + marshalSize = marshalSize + 4; // _coefficientOfRestitution + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/CollisionElasticPdu.h b/src/dis7/entity_information/CollisionElasticPdu.h new file mode 100644 index 00000000..29323a49 --- /dev/null +++ b/src/dis7/entity_information/CollisionElasticPdu.h @@ -0,0 +1,181 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/EntityInformationFamilyPdu.h" +#include "dis7/EventIdentifier.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about elastic collisions in a DIS exercise shall be communicated +// using a Collision-Elastic PDU. Section 7.2.4. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT CollisionElasticPdu : public EntityInformationFamilyPdu { + protected: + /** This field shall identify the entity that is issuing the PDU and shall be + * represented by an Entity Identifier record (see 6.2.28) */ + EntityID _issuingEntityID; + + /** This field shall identify the entity that has collided with the issuing + * entity. This field shall be a valid identifier of an entity or server + * capable of responding to the receipt of this Collision-Elastic PDU. This + * field shall be represented by an Entity Identifier record (see 6.2.28). */ + EntityID _collidingEntityID; + + /** This field shall contain an identification generated by the issuing + * simulation application to associate related collision events. This field + * shall be represented by an Event Identifier record (see 6.2.34). */ + EventIdentifier _collisionEventID; + + /** some padding */ + int16_t _pad; + + /** This field shall contain the velocity at the time the collision is + * detected at the point the collision is detected. The velocity shall be + * represented in world coordinates. This field shall be represented by the + * Linear Velocity Vector record [see 6.2.95 item c)] */ + Vector3Float _contactVelocity; + + /** This field shall contain the mass of the issuing entity and shall be + * represented by a 32-bit floating point number representing kilograms */ + float _mass; + + /** This field shall specify the location of the collision with respect to the + * entity with which the issuing entity collided. This field shall be + * represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. */ + Vector3Float _locationOfImpact; + + /** These six records represent the six independent components of a positive + * semi-definite matrix formed by pre-multiplying and post-multiplying the + * tensor of inertia, by the anti-symmetric matrix generated by the moment + * arm, and shall be represented by 32-bit floating point numbers + * (see 5.3.4.4) */ + float _collisionIntermediateResultXX; + + /** tensor values */ + float _collisionIntermediateResultXY; + + /** tensor values */ + float _collisionIntermediateResultXZ; + + /** tensor values */ + float _collisionIntermediateResultYY; + + /** tensor values */ + float _collisionIntermediateResultYZ; + + /** tensor values */ + float _collisionIntermediateResultZZ; + + /** This record shall represent the normal vector to the surface at the point + * of collision detection. The surface normal shall be represented in world + * coordinates. This field shall be represented by an Entity Coordinate Vector + * record [see 6.2.95 item a)]. */ + Vector3Float _unitSurfaceNormal; + + /** This field shall represent the degree to which energy is conserved in a + * collision and shall be represented by a 32-bit floating point number. In + * addition, it represents a free parameter by which simulation application + * developers may “tune” their collision interactions. */ + float _coefficientOfRestitution; + + public: + CollisionElasticPdu(); + virtual ~CollisionElasticPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getIssuingEntityID(); + const EntityID& getIssuingEntityID() const; + void setIssuingEntityID(const EntityID& pX); + + EntityID& getCollidingEntityID(); + const EntityID& getCollidingEntityID() const; + void setCollidingEntityID(const EntityID& pX); + + EventIdentifier& getCollisionEventID(); + const EventIdentifier& getCollisionEventID() const; + void setCollisionEventID(const EventIdentifier& pX); + + int16_t getPad() const; + void setPad(int16_t pX); + + Vector3Float& getContactVelocity(); + const Vector3Float& getContactVelocity() const; + void setContactVelocity(const Vector3Float& pX); + + float getMass() const; + void setMass(float pX); + + Vector3Float& getLocationOfImpact(); + const Vector3Float& getLocationOfImpact() const; + void setLocationOfImpact(const Vector3Float& pX); + + float getCollisionIntermediateResultXX() const; + void setCollisionIntermediateResultXX(float pX); + + float getCollisionIntermediateResultXY() const; + void setCollisionIntermediateResultXY(float pX); + + float getCollisionIntermediateResultXZ() const; + void setCollisionIntermediateResultXZ(float pX); + + float getCollisionIntermediateResultYY() const; + void setCollisionIntermediateResultYY(float pX); + + float getCollisionIntermediateResultYZ() const; + void setCollisionIntermediateResultYZ(float pX); + + float getCollisionIntermediateResultZZ() const; + void setCollisionIntermediateResultZZ(float pX); + + Vector3Float& getUnitSurfaceNormal(); + const Vector3Float& getUnitSurfaceNormal() const; + void setUnitSurfaceNormal(const Vector3Float& pX); + + float getCoefficientOfRestitution() const; + void setCoefficientOfRestitution(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CollisionElasticPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/CollisionPdu.cpp b/src/dis7/entity_information/CollisionPdu.cpp new file mode 100644 index 00000000..ac904bb3 --- /dev/null +++ b/src/dis7/entity_information/CollisionPdu.cpp @@ -0,0 +1,160 @@ +#include "dis7/CollisionPdu.h" + +using namespace DIS; + +CollisionPdu::CollisionPdu() + : EntityInformationFamilyPdu(), + _issuingEntityID(), + _collidingEntityID(), + _eventID(), + _collisionType(0), + _pad(0), + _velocity(), + _mass(0.0), + _location() { + setPduType(4); + setProtocolFamily(1); +} + +CollisionPdu::~CollisionPdu() {} + +EntityID& CollisionPdu::getIssuingEntityID() { return _issuingEntityID; } + +const EntityID& CollisionPdu::getIssuingEntityID() const { + return _issuingEntityID; +} + +void CollisionPdu::setIssuingEntityID(const EntityID& pX) { + _issuingEntityID = pX; +} + +EntityID& CollisionPdu::getCollidingEntityID() { return _collidingEntityID; } + +const EntityID& CollisionPdu::getCollidingEntityID() const { + return _collidingEntityID; +} + +void CollisionPdu::setCollidingEntityID(const EntityID& pX) { + _collidingEntityID = pX; +} + +EventIdentifier& CollisionPdu::getEventID() { return _eventID; } + +const EventIdentifier& CollisionPdu::getEventID() const { return _eventID; } + +void CollisionPdu::setEventID(const EventIdentifier& pX) { _eventID = pX; } + +uint8_t CollisionPdu::getCollisionType() const { return _collisionType; } + +void CollisionPdu::setCollisionType(uint8_t pX) { _collisionType = pX; } + +char CollisionPdu::getPad() const { return _pad; } + +void CollisionPdu::setPad(char pX) { _pad = pX; } + +Vector3Float& CollisionPdu::getVelocity() { return _velocity; } + +const Vector3Float& CollisionPdu::getVelocity() const { return _velocity; } + +void CollisionPdu::setVelocity(const Vector3Float& pX) { _velocity = pX; } + +float CollisionPdu::getMass() const { return _mass; } + +void CollisionPdu::setMass(float pX) { _mass = pX; } + +Vector3Float& CollisionPdu::getLocation() { return _location; } + +const Vector3Float& CollisionPdu::getLocation() const { return _location; } + +void CollisionPdu::setLocation(const Vector3Float& pX) { _location = pX; } + +void CollisionPdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _issuingEntityID.marshal(dataStream); + _collidingEntityID.marshal(dataStream); + _eventID.marshal(dataStream); + dataStream << _collisionType; + dataStream << _pad; + _velocity.marshal(dataStream); + dataStream << _mass; + _location.marshal(dataStream); +} + +void CollisionPdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _issuingEntityID.unmarshal(dataStream); + _collidingEntityID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + dataStream >> _collisionType; + dataStream >> _pad; + _velocity.unmarshal(dataStream); + dataStream >> _mass; + _location.unmarshal(dataStream); +} + +bool CollisionPdu::operator==(const CollisionPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_issuingEntityID == rhs._issuingEntityID)) ivarsEqual = false; + if (!(_collidingEntityID == rhs._collidingEntityID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_collisionType == rhs._collisionType)) ivarsEqual = false; + if (!(_pad == rhs._pad)) ivarsEqual = false; + if (!(_velocity == rhs._velocity)) ivarsEqual = false; + if (!(_mass == rhs._mass)) ivarsEqual = false; + if (!(_location == rhs._location)) ivarsEqual = false; + + return ivarsEqual; +} + +int CollisionPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _issuingEntityID.getMarshalledSize(); // _issuingEntityID + marshalSize = marshalSize + + _collidingEntityID.getMarshalledSize(); // _collidingEntityID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + 1; // _collisionType + marshalSize = marshalSize + 1; // _pad + marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity + marshalSize = marshalSize + 4; // _mass + marshalSize = marshalSize + _location.getMarshalledSize(); // _location + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/CollisionPdu.h b/src/dis7/entity_information/CollisionPdu.h new file mode 100644 index 00000000..44e0234e --- /dev/null +++ b/src/dis7/entity_information/CollisionPdu.h @@ -0,0 +1,128 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/EntityInformationFamilyPdu.h" +#include "dis7/EventIdentifier.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.2.3 Collisions between entities shall be communicated by issuing a +// Collision PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT CollisionPdu : public EntityInformationFamilyPdu { + protected: + /** This field shall identify the entity that is issuing the PDU, and shall be + * represented by an Entity Identifier record (see 6.2.28). */ + EntityID _issuingEntityID; + + /** This field shall identify the entity that has collided with the issuing + * entity (see 5.3.3.4). This field shall be represented by an Entity + * Identifier record (see 6.2.28). */ + EntityID _collidingEntityID; + + /** This field shall contain an identification generated by the issuing + * simulation application to associate related collision events. This field + * shall be represented by an Event Identifier record (see 6.2.34). */ + EventIdentifier _eventID; + + /** This field shall identify the type of collision. The Collision Type field + * shall be represented by an 8-bit record of enumerations */ + uint8_t _collisionType; + + /** some padding */ + char _pad; + + /** This field shall contain the velocity (at the time the collision is + * detected) of the issuing entity. The velocity shall be represented in world + * coordinates. This field shall be represented by the Linear Velocity Vector + * record [see 6.2.95 item c)]. */ + Vector3Float _velocity; + + /** This field shall contain the mass of the issuing entity, and shall be + * represented by a 32-bit floating point number representing kilograms. */ + float _mass; + + /** This field shall specify the location of the collision with respect to the + * entity with which the issuing entity collided. The Location field shall be + * represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. */ + Vector3Float _location; + + public: + CollisionPdu(); + virtual ~CollisionPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getIssuingEntityID(); + const EntityID& getIssuingEntityID() const; + void setIssuingEntityID(const EntityID& pX); + + EntityID& getCollidingEntityID(); + const EntityID& getCollidingEntityID() const; + void setCollidingEntityID(const EntityID& pX); + + EventIdentifier& getEventID(); + const EventIdentifier& getEventID() const; + void setEventID(const EventIdentifier& pX); + + uint8_t getCollisionType() const; + void setCollisionType(uint8_t pX); + + char getPad() const; + void setPad(char pX); + + Vector3Float& getVelocity(); + const Vector3Float& getVelocity() const; + void setVelocity(const Vector3Float& pX); + + float getMass() const; + void setMass(float pX); + + Vector3Float& getLocation(); + const Vector3Float& getLocation() const; + void setLocation(const Vector3Float& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CollisionPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/DeadReckoningParameters.cpp b/src/dis7/entity_information/DeadReckoningParameters.cpp new file mode 100644 index 00000000..a774c79d --- /dev/null +++ b/src/dis7/entity_information/DeadReckoningParameters.cpp @@ -0,0 +1,147 @@ +#include "dis7/DeadReckoningParameters.h" + +using namespace DIS; + +DeadReckoningParameters::DeadReckoningParameters() + : _deadReckoningAlgorithm(0), + _entityLinearAcceleration(), + _entityAngularVelocity() { + // Initialize fixed length array + for (int lengthparameters = 0; lengthparameters < 15; lengthparameters++) { + _parameters[lengthparameters] = 0; + } +} + +DeadReckoningParameters::~DeadReckoningParameters() {} + +uint8_t DeadReckoningParameters::getDeadReckoningAlgorithm() const { + return _deadReckoningAlgorithm; +} + +void DeadReckoningParameters::setDeadReckoningAlgorithm(uint8_t pX) { + _deadReckoningAlgorithm = pX; +} + +uint8_t* DeadReckoningParameters::getParameters() { return _parameters; } + +const uint8_t* DeadReckoningParameters::getParameters() const { + return _parameters; +} + +void DeadReckoningParameters::setParameters(const uint8_t* x) { + for (int i = 0; i < 15; i++) { + _parameters[i] = x[i]; + } +} + +Vector3Float& DeadReckoningParameters::getEntityLinearAcceleration() { + return _entityLinearAcceleration; +} + +const Vector3Float& DeadReckoningParameters::getEntityLinearAcceleration() + const { + return _entityLinearAcceleration; +} + +void DeadReckoningParameters::setEntityLinearAcceleration( + const Vector3Float& pX) { + _entityLinearAcceleration = pX; +} + +Vector3Float& DeadReckoningParameters::getEntityAngularVelocity() { + return _entityAngularVelocity; +} + +const Vector3Float& DeadReckoningParameters::getEntityAngularVelocity() const { + return _entityAngularVelocity; +} + +void DeadReckoningParameters::setEntityAngularVelocity(const Vector3Float& pX) { + _entityAngularVelocity = pX; +} + +void DeadReckoningParameters::marshal(DataStream& dataStream) const { + dataStream << _deadReckoningAlgorithm; + + for (size_t idx = 0; idx < 15; idx++) { + dataStream << _parameters[idx]; + } + + _entityLinearAcceleration.marshal(dataStream); + _entityAngularVelocity.marshal(dataStream); +} + +void DeadReckoningParameters::unmarshal(DataStream& dataStream) { + dataStream >> _deadReckoningAlgorithm; + + for (size_t idx = 0; idx < 15; idx++) { + dataStream >> _parameters[idx]; + } + + _entityLinearAcceleration.unmarshal(dataStream); + _entityAngularVelocity.unmarshal(dataStream); +} + +bool DeadReckoningParameters::operator==( + const DeadReckoningParameters& rhs) const { + bool ivarsEqual = true; + + if (!(_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm)) + ivarsEqual = false; + + for (uint8_t idx = 0; idx < 15; idx++) { + if (!(_parameters[idx] == rhs._parameters[idx])) ivarsEqual = false; + } + + if (!(_entityLinearAcceleration == rhs._entityLinearAcceleration)) + ivarsEqual = false; + if (!(_entityAngularVelocity == rhs._entityAngularVelocity)) + ivarsEqual = false; + + return ivarsEqual; +} + +int DeadReckoningParameters::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _deadReckoningAlgorithm + marshalSize = marshalSize + 15 * 1; // _parameters + marshalSize = + marshalSize + _entityLinearAcceleration + .getMarshalledSize(); // _entityLinearAcceleration + marshalSize = + marshalSize + + _entityAngularVelocity.getMarshalledSize(); // _entityAngularVelocity + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/DeadReckoningParameters.h b/src/dis7/entity_information/DeadReckoningParameters.h new file mode 100644 index 00000000..bb664c9a --- /dev/null +++ b/src/dis7/entity_information/DeadReckoningParameters.h @@ -0,0 +1,86 @@ +#pragma once + +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Not specified in the standard. This is used by the ESPDU + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DeadReckoningParameters { + protected: + /** Algorithm to use in computing dead reckoning. See EBV doc. */ + uint8_t _deadReckoningAlgorithm; + + /** Dead reckoning parameters. Contents depends on algorithm. */ + uint8_t _parameters[15]; + + /** Linear acceleration of the entity */ + Vector3Float _entityLinearAcceleration; + + /** Angular velocity of the entity */ + Vector3Float _entityAngularVelocity; + + public: + DeadReckoningParameters(); + virtual ~DeadReckoningParameters(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getDeadReckoningAlgorithm() const; + void setDeadReckoningAlgorithm(uint8_t pX); + + uint8_t* getParameters(); + const uint8_t* getParameters() const; + void setParameters(const uint8_t* pX); + + Vector3Float& getEntityLinearAcceleration(); + const Vector3Float& getEntityLinearAcceleration() const; + void setEntityLinearAcceleration(const Vector3Float& pX); + + Vector3Float& getEntityAngularVelocity(); + const Vector3Float& getEntityAngularVelocity() const; + void setEntityAngularVelocity(const Vector3Float& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DeadReckoningParameters& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/EntityInformationFamilyPdu.cpp b/src/dis7/entity_information/EntityInformationFamilyPdu.cpp new file mode 100644 index 00000000..cfa00ebf --- /dev/null +++ b/src/dis7/entity_information/EntityInformationFamilyPdu.cpp @@ -0,0 +1,67 @@ +#include "dis7/EntityInformationFamilyPdu.h" + +using namespace DIS; + +EntityInformationFamilyPdu::EntityInformationFamilyPdu() + : Pdu() + +{ + setProtocolFamily(1); +} + +EntityInformationFamilyPdu::~EntityInformationFamilyPdu() {} + +void EntityInformationFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void EntityInformationFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool EntityInformationFamilyPdu::operator==( + const EntityInformationFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int EntityInformationFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/EntityInformationFamilyPdu.h b/src/dis7/entity_information/EntityInformationFamilyPdu.h new file mode 100644 index 00000000..365b7468 --- /dev/null +++ b/src/dis7/entity_information/EntityInformationFamilyPdu.h @@ -0,0 +1,61 @@ +#pragma once + +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.3. Common superclass for EntityState, Collision, +// collision-elastic, and entity state update PDUs. This should be abstract. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityInformationFamilyPdu : public Pdu { + protected: + public: + EntityInformationFamilyPdu(); + virtual ~EntityInformationFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityInformationFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/EntityMarking.cpp b/src/dis7/entity_information/EntityMarking.cpp new file mode 100644 index 00000000..6579d62d --- /dev/null +++ b/src/dis7/entity_information/EntityMarking.cpp @@ -0,0 +1,102 @@ +#include + +#include "dis7/EntityMarking.h" + +using namespace DIS; + +EntityMarking::EntityMarking() : _characterSet(0) { + // Initialize fixed length array + for (int lengthcharacters = 0; lengthcharacters < 11; lengthcharacters++) { + _characters[lengthcharacters] = 0; + } +} + +EntityMarking::~EntityMarking() {} + +uint8_t EntityMarking::getCharacterSet() const { return _characterSet; } + +void EntityMarking::setCharacterSet(uint8_t pX) { _characterSet = pX; } + +char* EntityMarking::getCharacters() { return _characters; } + +const char* EntityMarking::getCharacters() const { return _characters; } + +void EntityMarking::setCharacters(const char* x) { + for (int i = 0; i < 11; i++) { + _characters[i] = x[i]; + } +} + +// An alternate method to set the value if this could be a string. This is not +// strictly comnpliant with the DIS standard. +void EntityMarking::setByStringCharacters(const char* x) { + std::strncpy(_characters, x, 11 - 1); + _characters[11 - 1] = '\0'; +} + +void EntityMarking::marshal(DataStream& dataStream) const { + dataStream << _characterSet; + + for (size_t idx = 0; idx < 11; idx++) { + dataStream << _characters[idx]; + } +} + +void EntityMarking::unmarshal(DataStream& dataStream) { + dataStream >> _characterSet; + + for (size_t idx = 0; idx < 11; idx++) { + dataStream >> _characters[idx]; + } +} + +bool EntityMarking::operator==(const EntityMarking& rhs) const { + bool ivarsEqual = true; + + if (!(_characterSet == rhs._characterSet)) ivarsEqual = false; + + for (uint8_t idx = 0; idx < 11; idx++) { + if (!(_characters[idx] == rhs._characters[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int EntityMarking::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _characterSet + marshalSize = marshalSize + 11 * 1; // _characters + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/EntityMarking.h b/src/dis7/entity_information/EntityMarking.h new file mode 100644 index 00000000..50dde113 --- /dev/null +++ b/src/dis7/entity_information/EntityMarking.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Specifies the character set used inthe first byte, followed by 11 characters +// of text data. Section 6.29 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityMarking { + protected: + /** The character set */ + uint8_t _characterSet; + + /** The characters */ + char _characters[11]; + + public: + EntityMarking(); + virtual ~EntityMarking(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getCharacterSet() const; + void setCharacterSet(uint8_t pX); + + char* getCharacters(); + const char* getCharacters() const; + void setCharacters(const char* pX); + void setByStringCharacters(const char* pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityMarking& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/EntityStatePdu.cpp b/src/dis7/entity_information/EntityStatePdu.cpp new file mode 100644 index 00000000..155c17d4 --- /dev/null +++ b/src/dis7/entity_information/EntityStatePdu.cpp @@ -0,0 +1,271 @@ +#include "dis7/EntityStatePdu.h" + +using namespace DIS; + +EntityStatePdu::EntityStatePdu() + : EntityInformationFamilyPdu(), + _entityID(), + _forceId(0), + _numberOfVariableParameters(0), + _entityType(), + _alternativeEntityType(), + _entityLinearVelocity(), + _entityLocation(), + _entityOrientation(), + _entityAppearance(0), + _deadReckoningParameters(), + _marking(), + _capabilities(0) { + setPduType(1); +} + +EntityStatePdu::~EntityStatePdu() { _variableParameters.clear(); } + +EntityID& EntityStatePdu::getEntityID() { return _entityID; } + +const EntityID& EntityStatePdu::getEntityID() const { return _entityID; } + +void EntityStatePdu::setEntityID(const EntityID& pX) { _entityID = pX; } + +uint8_t EntityStatePdu::getForceId() const { return _forceId; } + +void EntityStatePdu::setForceId(uint8_t pX) { _forceId = pX; } + +uint8_t EntityStatePdu::getNumberOfVariableParameters() const { + return _variableParameters.size(); +} + +EntityType& EntityStatePdu::getEntityType() { return _entityType; } + +const EntityType& EntityStatePdu::getEntityType() const { return _entityType; } + +void EntityStatePdu::setEntityType(const EntityType& pX) { _entityType = pX; } + +EntityType& EntityStatePdu::getAlternativeEntityType() { + return _alternativeEntityType; +} + +const EntityType& EntityStatePdu::getAlternativeEntityType() const { + return _alternativeEntityType; +} + +void EntityStatePdu::setAlternativeEntityType(const EntityType& pX) { + _alternativeEntityType = pX; +} + +Vector3Float& EntityStatePdu::getEntityLinearVelocity() { + return _entityLinearVelocity; +} + +const Vector3Float& EntityStatePdu::getEntityLinearVelocity() const { + return _entityLinearVelocity; +} + +void EntityStatePdu::setEntityLinearVelocity(const Vector3Float& pX) { + _entityLinearVelocity = pX; +} + +Vector3Double& EntityStatePdu::getEntityLocation() { return _entityLocation; } + +const Vector3Double& EntityStatePdu::getEntityLocation() const { + return _entityLocation; +} + +void EntityStatePdu::setEntityLocation(const Vector3Double& pX) { + _entityLocation = pX; +} + +EulerAngles& EntityStatePdu::getEntityOrientation() { + return _entityOrientation; +} + +const EulerAngles& EntityStatePdu::getEntityOrientation() const { + return _entityOrientation; +} + +void EntityStatePdu::setEntityOrientation(const EulerAngles& pX) { + _entityOrientation = pX; +} + +uint32_t EntityStatePdu::getEntityAppearance() const { + return _entityAppearance; +} + +void EntityStatePdu::setEntityAppearance(uint32_t pX) { + _entityAppearance = pX; +} + +DeadReckoningParameters& EntityStatePdu::getDeadReckoningParameters() { + return _deadReckoningParameters; +} + +const DeadReckoningParameters& EntityStatePdu::getDeadReckoningParameters() + const { + return _deadReckoningParameters; +} + +void EntityStatePdu::setDeadReckoningParameters( + const DeadReckoningParameters& pX) { + _deadReckoningParameters = pX; +} + +EntityMarking& EntityStatePdu::getMarking() { return _marking; } + +const EntityMarking& EntityStatePdu::getMarking() const { return _marking; } + +void EntityStatePdu::setMarking(const EntityMarking& pX) { _marking = pX; } + +uint32_t EntityStatePdu::getCapabilities() const { return _capabilities; } + +void EntityStatePdu::setCapabilities(uint32_t pX) { _capabilities = pX; } + +std::vector& EntityStatePdu::getVariableParameters() { + return _variableParameters; +} + +const std::vector& EntityStatePdu::getVariableParameters() + const { + return _variableParameters; +} + +void EntityStatePdu::setVariableParameters( + const std::vector& pX) { + _variableParameters = pX; +} + +void EntityStatePdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _entityID.marshal(dataStream); + dataStream << _forceId; + dataStream << (uint8_t)_variableParameters.size(); + _entityType.marshal(dataStream); + _alternativeEntityType.marshal(dataStream); + _entityLinearVelocity.marshal(dataStream); + _entityLocation.marshal(dataStream); + _entityOrientation.marshal(dataStream); + dataStream << _entityAppearance; + _deadReckoningParameters.marshal(dataStream); + _marking.marshal(dataStream); + dataStream << _capabilities; + + for (size_t idx = 0; idx < _variableParameters.size(); idx++) { + VariableParameter x = _variableParameters[idx]; + x.marshal(dataStream); + } +} + +void EntityStatePdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _entityID.unmarshal(dataStream); + dataStream >> _forceId; + dataStream >> _numberOfVariableParameters; + _entityType.unmarshal(dataStream); + _alternativeEntityType.unmarshal(dataStream); + _entityLinearVelocity.unmarshal(dataStream); + _entityLocation.unmarshal(dataStream); + _entityOrientation.unmarshal(dataStream); + dataStream >> _entityAppearance; + _deadReckoningParameters.unmarshal(dataStream); + _marking.unmarshal(dataStream); + dataStream >> _capabilities; + + _variableParameters.clear(); + for (size_t idx = 0; idx < _numberOfVariableParameters; idx++) { + VariableParameter x; + x.unmarshal(dataStream); + _variableParameters.push_back(x); + } +} + +bool EntityStatePdu::operator==(const EntityStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_forceId == rhs._forceId)) ivarsEqual = false; + if (!(_entityType == rhs._entityType)) ivarsEqual = false; + if (!(_alternativeEntityType == rhs._alternativeEntityType)) + ivarsEqual = false; + if (!(_entityLinearVelocity == rhs._entityLinearVelocity)) ivarsEqual = false; + if (!(_entityLocation == rhs._entityLocation)) ivarsEqual = false; + if (!(_entityOrientation == rhs._entityOrientation)) ivarsEqual = false; + if (!(_entityAppearance == rhs._entityAppearance)) ivarsEqual = false; + if (!(_deadReckoningParameters == rhs._deadReckoningParameters)) + ivarsEqual = false; + if (!(_marking == rhs._marking)) ivarsEqual = false; + if (!(_capabilities == rhs._capabilities)) ivarsEqual = false; + + for (size_t idx = 0; idx < _variableParameters.size(); idx++) { + if (!(_variableParameters[idx] == rhs._variableParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int EntityStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID + marshalSize = marshalSize + 1; // _forceId + marshalSize = marshalSize + 1; // _numberOfVariableParameters + marshalSize = marshalSize + _entityType.getMarshalledSize(); // _entityType + marshalSize = + marshalSize + + _alternativeEntityType.getMarshalledSize(); // _alternativeEntityType + marshalSize = + marshalSize + + _entityLinearVelocity.getMarshalledSize(); // _entityLinearVelocity + marshalSize = + marshalSize + _entityLocation.getMarshalledSize(); // _entityLocation + marshalSize = marshalSize + + _entityOrientation.getMarshalledSize(); // _entityOrientation + marshalSize = marshalSize + 4; // _entityAppearance + marshalSize = + marshalSize + + _deadReckoningParameters.getMarshalledSize(); // _deadReckoningParameters + marshalSize = marshalSize + _marking.getMarshalledSize(); // _marking + marshalSize = marshalSize + 4; // _capabilities + + for (uint64_t idx = 0; idx < _variableParameters.size(); idx++) { + VariableParameter listElement = _variableParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/EntityStatePdu.h b/src/dis7/entity_information/EntityStatePdu.h new file mode 100644 index 00000000..3c76a8a4 --- /dev/null +++ b/src/dis7/entity_information/EntityStatePdu.h @@ -0,0 +1,159 @@ +#pragma once + +#include + +#include "dis7/DeadReckoningParameters.h" +#include "dis7/EntityID.h" +#include "dis7/EntityInformationFamilyPdu.h" +#include "dis7/EntityMarking.h" +#include "dis7/EntityType.h" +#include "dis7/EulerAngles.h" +#include "dis7/VariableParameter.h" +#include "dis7/Vector3Double.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Represents the postion and state of one entity in the world. Section 7.2.2. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityStatePdu : public EntityInformationFamilyPdu { + protected: + /** Unique ID for an entity that is tied to this state information */ + EntityID _entityID; + + /** What force this entity is affiliated with, eg red, blue, neutral, etc */ + uint8_t _forceId; + + /** How many variable parameters are in the variable length list. In earlier + * versions of DIS these were known as articulation parameters */ + uint8_t _numberOfVariableParameters; + + /** Describes the type of entity in the world */ + EntityType _entityType; + + EntityType _alternativeEntityType; + + /** Describes the speed of the entity in the world */ + Vector3Float _entityLinearVelocity; + + /** describes the location of the entity in the world */ + Vector3Double _entityLocation; + + /** describes the orientation of the entity, in euler angles */ + EulerAngles _entityOrientation; + + /** a series of bit flags that are used to help draw the entity, such as + * smoking, on fire, etc. */ + uint32_t _entityAppearance; + + /** parameters used for dead reckoning */ + DeadReckoningParameters _deadReckoningParameters; + + /** characters that can be used for debugging, or to draw unique strings on + * the side of entities in the world */ + EntityMarking _marking; + + /** a series of bit flags */ + uint32_t _capabilities; + + /** variable length list of variable parameters. In earlier DIS versions this + * was articulation parameters. */ + std::vector _variableParameters; + + public: + EntityStatePdu(); + virtual ~EntityStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + uint8_t getForceId() const; + void setForceId(uint8_t pX); + + uint8_t getNumberOfVariableParameters() const; + + EntityType& getEntityType(); + const EntityType& getEntityType() const; + void setEntityType(const EntityType& pX); + + EntityType& getAlternativeEntityType(); + const EntityType& getAlternativeEntityType() const; + void setAlternativeEntityType(const EntityType& pX); + + Vector3Float& getEntityLinearVelocity(); + const Vector3Float& getEntityLinearVelocity() const; + void setEntityLinearVelocity(const Vector3Float& pX); + + Vector3Double& getEntityLocation(); + const Vector3Double& getEntityLocation() const; + void setEntityLocation(const Vector3Double& pX); + + EulerAngles& getEntityOrientation(); + const EulerAngles& getEntityOrientation() const; + void setEntityOrientation(const EulerAngles& pX); + + uint32_t getEntityAppearance() const; + void setEntityAppearance(uint32_t pX); + + DeadReckoningParameters& getDeadReckoningParameters(); + const DeadReckoningParameters& getDeadReckoningParameters() const; + void setDeadReckoningParameters(const DeadReckoningParameters& pX); + + EntityMarking& getMarking(); + const EntityMarking& getMarking() const; + void setMarking(const EntityMarking& pX); + + uint32_t getCapabilities() const; + void setCapabilities(uint32_t pX); + + std::vector& getVariableParameters(); + const std::vector& getVariableParameters() const; + void setVariableParameters(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/EntityStateUpdatePdu.cpp b/src/dis7/entity_information/EntityStateUpdatePdu.cpp new file mode 100644 index 00000000..6dfc972e --- /dev/null +++ b/src/dis7/entity_information/EntityStateUpdatePdu.cpp @@ -0,0 +1,201 @@ +#include "dis7/EntityStateUpdatePdu.h" + +using namespace DIS; + +EntityStateUpdatePdu::EntityStateUpdatePdu() + : EntityInformationFamilyPdu(), + _entityID(), + _padding1(0), + _numberOfVariableParameters(0), + _entityLinearVelocity(), + _entityLocation(), + _entityOrientation(), + _entityAppearance(0) { + setPduType(67); + setProtocolFamily(1); +} + +EntityStateUpdatePdu::~EntityStateUpdatePdu() { _variableParameters.clear(); } + +EntityID& EntityStateUpdatePdu::getEntityID() { return _entityID; } + +const EntityID& EntityStateUpdatePdu::getEntityID() const { return _entityID; } + +void EntityStateUpdatePdu::setEntityID(const EntityID& pX) { _entityID = pX; } + +char EntityStateUpdatePdu::getPadding1() const { return _padding1; } + +void EntityStateUpdatePdu::setPadding1(char pX) { _padding1 = pX; } + +uint8_t EntityStateUpdatePdu::getNumberOfVariableParameters() const { + return _variableParameters.size(); +} + +Vector3Float& EntityStateUpdatePdu::getEntityLinearVelocity() { + return _entityLinearVelocity; +} + +const Vector3Float& EntityStateUpdatePdu::getEntityLinearVelocity() const { + return _entityLinearVelocity; +} + +void EntityStateUpdatePdu::setEntityLinearVelocity(const Vector3Float& pX) { + _entityLinearVelocity = pX; +} + +Vector3Double& EntityStateUpdatePdu::getEntityLocation() { + return _entityLocation; +} + +const Vector3Double& EntityStateUpdatePdu::getEntityLocation() const { + return _entityLocation; +} + +void EntityStateUpdatePdu::setEntityLocation(const Vector3Double& pX) { + _entityLocation = pX; +} + +EulerAngles& EntityStateUpdatePdu::getEntityOrientation() { + return _entityOrientation; +} + +const EulerAngles& EntityStateUpdatePdu::getEntityOrientation() const { + return _entityOrientation; +} + +void EntityStateUpdatePdu::setEntityOrientation(const EulerAngles& pX) { + _entityOrientation = pX; +} + +uint32_t EntityStateUpdatePdu::getEntityAppearance() const { + return _entityAppearance; +} + +void EntityStateUpdatePdu::setEntityAppearance(uint32_t pX) { + _entityAppearance = pX; +} + +std::vector& EntityStateUpdatePdu::getVariableParameters() { + return _variableParameters; +} + +const std::vector& +EntityStateUpdatePdu::getVariableParameters() const { + return _variableParameters; +} + +void EntityStateUpdatePdu::setVariableParameters( + const std::vector& pX) { + _variableParameters = pX; +} + +void EntityStateUpdatePdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _entityID.marshal(dataStream); + dataStream << _padding1; + dataStream << (uint8_t)_variableParameters.size(); + _entityLinearVelocity.marshal(dataStream); + _entityLocation.marshal(dataStream); + _entityOrientation.marshal(dataStream); + dataStream << _entityAppearance; + + for (size_t idx = 0; idx < _variableParameters.size(); idx++) { + VariableParameter x = _variableParameters[idx]; + x.marshal(dataStream); + } +} + +void EntityStateUpdatePdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _entityID.unmarshal(dataStream); + dataStream >> _padding1; + dataStream >> _numberOfVariableParameters; + _entityLinearVelocity.unmarshal(dataStream); + _entityLocation.unmarshal(dataStream); + _entityOrientation.unmarshal(dataStream); + dataStream >> _entityAppearance; + + _variableParameters.clear(); + for (size_t idx = 0; idx < _numberOfVariableParameters; idx++) { + VariableParameter x; + x.unmarshal(dataStream); + _variableParameters.push_back(x); + } +} + +bool EntityStateUpdatePdu::operator==(const EntityStateUpdatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_entityLinearVelocity == rhs._entityLinearVelocity)) ivarsEqual = false; + if (!(_entityLocation == rhs._entityLocation)) ivarsEqual = false; + if (!(_entityOrientation == rhs._entityOrientation)) ivarsEqual = false; + if (!(_entityAppearance == rhs._entityAppearance)) ivarsEqual = false; + + for (size_t idx = 0; idx < _variableParameters.size(); idx++) { + if (!(_variableParameters[idx] == rhs._variableParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int EntityStateUpdatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _entityID.getMarshalledSize(); // _entityID + marshalSize = marshalSize + 1; // _padding1 + marshalSize = marshalSize + 1; // _numberOfVariableParameters + marshalSize = + marshalSize + + _entityLinearVelocity.getMarshalledSize(); // _entityLinearVelocity + marshalSize = + marshalSize + _entityLocation.getMarshalledSize(); // _entityLocation + marshalSize = marshalSize + + _entityOrientation.getMarshalledSize(); // _entityOrientation + marshalSize = marshalSize + 4; // _entityAppearance + + for (uint64_t idx = 0; idx < _variableParameters.size(); idx++) { + VariableParameter listElement = _variableParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/EntityStateUpdatePdu.h b/src/dis7/entity_information/EntityStateUpdatePdu.h new file mode 100644 index 00000000..ff64191e --- /dev/null +++ b/src/dis7/entity_information/EntityStateUpdatePdu.h @@ -0,0 +1,130 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/EntityInformationFamilyPdu.h" +#include "dis7/EulerAngles.h" +#include "dis7/VariableParameter.h" +#include "dis7/Vector3Double.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Nonstatic information about a particular entity may be communicated by +// issuing an Entity State Update PDU. Section 7.2.5. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityStateUpdatePdu : public EntityInformationFamilyPdu { + protected: + /** This field shall identify the entity issuing the PDU, and shall be + * represented by an Entity Identifier record (see 6.2.28). */ + EntityID _entityID; + + /** Padding */ + char _padding1; + + /** This field shall specify the number of variable parameters present. This + * field shall be represented by an 8-bit uint32_teger (see Annex I). */ + uint8_t _numberOfVariableParameters; + + /** This field shall specify an entity’s linear velocity. The coordinate + * system for an entity’s linear velocity depends on the dead reckoning + * algorithm used. This field shall be represented by a Linear Velocity Vector + * record [see 6.2.95 item c)]). */ + Vector3Float _entityLinearVelocity; + + /** This field shall specify an entity’s physical location in the simulated + * world and shall be represented by a World Coordinates record (see 6.2.97). + */ + Vector3Double _entityLocation; + + /** This field shall specify an entity’s orientation and shall be represented + * by an Euler Angles record (see 6.2.33). */ + EulerAngles _entityOrientation; + + /** This field shall specify the dynamic changes to the entity’s appearance + * attributes. This field shall be represented by an Entity Appearance record + * (see 6.2.26). */ + uint32_t _entityAppearance; + + /** This field shall specify the parameter values for each Variable Parameter + * record that is included (see 6.2.93 and Annex I). */ + std::vector _variableParameters; + + public: + EntityStateUpdatePdu(); + virtual ~EntityStateUpdatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + char getPadding1() const; + void setPadding1(char pX); + + uint8_t getNumberOfVariableParameters() const; + + Vector3Float& getEntityLinearVelocity(); + const Vector3Float& getEntityLinearVelocity() const; + void setEntityLinearVelocity(const Vector3Float& pX); + + Vector3Double& getEntityLocation(); + const Vector3Double& getEntityLocation() const; + void setEntityLocation(const Vector3Double& pX); + + EulerAngles& getEntityOrientation(); + const EulerAngles& getEntityOrientation() const; + void setEntityOrientation(const EulerAngles& pX); + + uint32_t getEntityAppearance() const; + void setEntityAppearance(uint32_t pX); + + std::vector& getVariableParameters(); + const std::vector& getVariableParameters() const; + void setVariableParameters(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityStateUpdatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/FastEntityStatePdu.cpp b/src/dis7/entity_information/FastEntityStatePdu.cpp new file mode 100644 index 00000000..f829db7b --- /dev/null +++ b/src/dis7/entity_information/FastEntityStatePdu.cpp @@ -0,0 +1,547 @@ +#include + +#include "dis7/FastEntityStatePdu.h" + +using namespace DIS; + +FastEntityStatePdu::FastEntityStatePdu() + : EntityInformationFamilyPdu(), + _site(0), + _application(0), + _entity(0), + _forceId(0), + _numberOfVariableParameters(0), + _entityKind(0), + _domain(0), + _country(0), + _category(0), + _subcategory(0), + _specific(0), + _extra(0), + _altEntityKind(0), + _altDomain(0), + _altCountry(0), + _altCategory(0), + _altSubcategory(0), + _altSpecific(0), + _altExtra(0), + _xVelocity(0.0), + _yVelocity(0.0), + _zVelocity(0.0), + _xLocation(0.0), + _yLocation(0.0), + _zLocation(0.0), + _psi(0.0), + _theta(0.0), + _phi(0.0), + _entityAppearance(0), + _deadReckoningAlgorithm(0), + _xAcceleration(0.0), + _yAcceleration(0.0), + _zAcceleration(0.0), + _xAngularVelocity(0.0), + _yAngularVelocity(0.0), + _zAngularVelocity(0.0), + _capabilities(0) { + setPduType(1); + // Initialize fixed length array + for (int lengthotherParameters = 0; lengthotherParameters < 15; + lengthotherParameters++) { + _otherParameters[lengthotherParameters] = 0; + } + + // Initialize fixed length array + for (int lengthmarking = 0; lengthmarking < 12; lengthmarking++) { + _marking[lengthmarking] = 0; + } +} + +FastEntityStatePdu::~FastEntityStatePdu() { _variableParameters.clear(); } + +uint16_t FastEntityStatePdu::getSite() const { return _site; } + +void FastEntityStatePdu::setSite(uint16_t pX) { _site = pX; } + +uint16_t FastEntityStatePdu::getApplication() const { + return _application; +} + +void FastEntityStatePdu::setApplication(uint16_t pX) { + _application = pX; +} + +uint16_t FastEntityStatePdu::getEntity() const { return _entity; } + +void FastEntityStatePdu::setEntity(uint16_t pX) { _entity = pX; } + +uint8_t FastEntityStatePdu::getForceId() const { return _forceId; } + +void FastEntityStatePdu::setForceId(uint8_t pX) { _forceId = pX; } + +char FastEntityStatePdu::getNumberOfVariableParameters() const { + return _variableParameters.size(); +} + +uint8_t FastEntityStatePdu::getEntityKind() const { return _entityKind; } + +void FastEntityStatePdu::setEntityKind(uint8_t pX) { _entityKind = pX; } + +uint8_t FastEntityStatePdu::getDomain() const { return _domain; } + +void FastEntityStatePdu::setDomain(uint8_t pX) { _domain = pX; } + +uint16_t FastEntityStatePdu::getCountry() const { return _country; } + +void FastEntityStatePdu::setCountry(uint16_t pX) { _country = pX; } + +uint8_t FastEntityStatePdu::getCategory() const { return _category; } + +void FastEntityStatePdu::setCategory(uint8_t pX) { _category = pX; } + +uint8_t FastEntityStatePdu::getSubcategory() const { + return _subcategory; +} + +void FastEntityStatePdu::setSubcategory(uint8_t pX) { _subcategory = pX; } + +uint8_t FastEntityStatePdu::getSpecific() const { return _specific; } + +void FastEntityStatePdu::setSpecific(uint8_t pX) { _specific = pX; } + +uint8_t FastEntityStatePdu::getExtra() const { return _extra; } + +void FastEntityStatePdu::setExtra(uint8_t pX) { _extra = pX; } + +uint8_t FastEntityStatePdu::getAltEntityKind() const { + return _altEntityKind; +} + +void FastEntityStatePdu::setAltEntityKind(uint8_t pX) { + _altEntityKind = pX; +} + +uint8_t FastEntityStatePdu::getAltDomain() const { return _altDomain; } + +void FastEntityStatePdu::setAltDomain(uint8_t pX) { _altDomain = pX; } + +uint16_t FastEntityStatePdu::getAltCountry() const { return _altCountry; } + +void FastEntityStatePdu::setAltCountry(uint16_t pX) { _altCountry = pX; } + +uint8_t FastEntityStatePdu::getAltCategory() const { + return _altCategory; +} + +void FastEntityStatePdu::setAltCategory(uint8_t pX) { _altCategory = pX; } + +uint8_t FastEntityStatePdu::getAltSubcategory() const { + return _altSubcategory; +} + +void FastEntityStatePdu::setAltSubcategory(uint8_t pX) { + _altSubcategory = pX; +} + +uint8_t FastEntityStatePdu::getAltSpecific() const { + return _altSpecific; +} + +void FastEntityStatePdu::setAltSpecific(uint8_t pX) { _altSpecific = pX; } + +uint8_t FastEntityStatePdu::getAltExtra() const { return _altExtra; } + +void FastEntityStatePdu::setAltExtra(uint8_t pX) { _altExtra = pX; } + +float FastEntityStatePdu::getXVelocity() const { return _xVelocity; } + +void FastEntityStatePdu::setXVelocity(float pX) { _xVelocity = pX; } + +float FastEntityStatePdu::getYVelocity() const { return _yVelocity; } + +void FastEntityStatePdu::setYVelocity(float pX) { _yVelocity = pX; } + +float FastEntityStatePdu::getZVelocity() const { return _zVelocity; } + +void FastEntityStatePdu::setZVelocity(float pX) { _zVelocity = pX; } + +double FastEntityStatePdu::getXLocation() const { return _xLocation; } + +void FastEntityStatePdu::setXLocation(double pX) { _xLocation = pX; } + +double FastEntityStatePdu::getYLocation() const { return _yLocation; } + +void FastEntityStatePdu::setYLocation(double pX) { _yLocation = pX; } + +double FastEntityStatePdu::getZLocation() const { return _zLocation; } + +void FastEntityStatePdu::setZLocation(double pX) { _zLocation = pX; } + +float FastEntityStatePdu::getPsi() const { return _psi; } + +void FastEntityStatePdu::setPsi(float pX) { _psi = pX; } + +float FastEntityStatePdu::getTheta() const { return _theta; } + +void FastEntityStatePdu::setTheta(float pX) { _theta = pX; } + +float FastEntityStatePdu::getPhi() const { return _phi; } + +void FastEntityStatePdu::setPhi(float pX) { _phi = pX; } + +int FastEntityStatePdu::getEntityAppearance() const { + return _entityAppearance; +} + +void FastEntityStatePdu::setEntityAppearance(int pX) { _entityAppearance = pX; } + +uint8_t FastEntityStatePdu::getDeadReckoningAlgorithm() const { + return _deadReckoningAlgorithm; +} + +void FastEntityStatePdu::setDeadReckoningAlgorithm(uint8_t pX) { + _deadReckoningAlgorithm = pX; +} + +char* FastEntityStatePdu::getOtherParameters() { return _otherParameters; } + +const char* FastEntityStatePdu::getOtherParameters() const { + return _otherParameters; +} + +void FastEntityStatePdu::setOtherParameters(const char* x) { + for (int i = 0; i < 15; i++) { + _otherParameters[i] = x[i]; + } +} + +float FastEntityStatePdu::getXAcceleration() const { return _xAcceleration; } + +void FastEntityStatePdu::setXAcceleration(float pX) { _xAcceleration = pX; } + +float FastEntityStatePdu::getYAcceleration() const { return _yAcceleration; } + +void FastEntityStatePdu::setYAcceleration(float pX) { _yAcceleration = pX; } + +float FastEntityStatePdu::getZAcceleration() const { return _zAcceleration; } + +void FastEntityStatePdu::setZAcceleration(float pX) { _zAcceleration = pX; } + +float FastEntityStatePdu::getXAngularVelocity() const { + return _xAngularVelocity; +} + +void FastEntityStatePdu::setXAngularVelocity(float pX) { + _xAngularVelocity = pX; +} + +float FastEntityStatePdu::getYAngularVelocity() const { + return _yAngularVelocity; +} + +void FastEntityStatePdu::setYAngularVelocity(float pX) { + _yAngularVelocity = pX; +} + +float FastEntityStatePdu::getZAngularVelocity() const { + return _zAngularVelocity; +} + +void FastEntityStatePdu::setZAngularVelocity(float pX) { + _zAngularVelocity = pX; +} + +char* FastEntityStatePdu::getMarking() { return _marking; } + +const char* FastEntityStatePdu::getMarking() const { return _marking; } + +void FastEntityStatePdu::setMarking(const char* x) { + for (int i = 0; i < 12; i++) { + _marking[i] = x[i]; + } +} + +// An alternate method to set the value if this could be a string. This is not +// strictly comnpliant with the DIS standard. +void FastEntityStatePdu::setByStringMarking(const char* x) { + std::strncpy(_marking, x, 12 - 1); + _marking[12 - 1] = '\0'; +} + +int FastEntityStatePdu::getCapabilities() const { return _capabilities; } + +void FastEntityStatePdu::setCapabilities(int pX) { _capabilities = pX; } + +std::vector& FastEntityStatePdu::getVariableParameters() { + return _variableParameters; +} + +const std::vector& +FastEntityStatePdu::getVariableParameters() const { + return _variableParameters; +} + +void FastEntityStatePdu::setVariableParameters( + const std::vector& pX) { + _variableParameters = pX; +} + +void FastEntityStatePdu::marshal(DataStream& dataStream) const { + EntityInformationFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _site; + dataStream << _application; + dataStream << _entity; + dataStream << _forceId; + dataStream << (char)_variableParameters.size(); + dataStream << _entityKind; + dataStream << _domain; + dataStream << _country; + dataStream << _category; + dataStream << _subcategory; + dataStream << _specific; + dataStream << _extra; + dataStream << _altEntityKind; + dataStream << _altDomain; + dataStream << _altCountry; + dataStream << _altCategory; + dataStream << _altSubcategory; + dataStream << _altSpecific; + dataStream << _altExtra; + dataStream << _xVelocity; + dataStream << _yVelocity; + dataStream << _zVelocity; + dataStream << _xLocation; + dataStream << _yLocation; + dataStream << _zLocation; + dataStream << _psi; + dataStream << _theta; + dataStream << _phi; + dataStream << _entityAppearance; + dataStream << _deadReckoningAlgorithm; + + for (size_t idx = 0; idx < 15; idx++) { + dataStream << _otherParameters[idx]; + } + + dataStream << _xAcceleration; + dataStream << _yAcceleration; + dataStream << _zAcceleration; + dataStream << _xAngularVelocity; + dataStream << _yAngularVelocity; + dataStream << _zAngularVelocity; + + for (size_t idx = 0; idx < 12; idx++) { + dataStream << _marking[idx]; + } + + dataStream << _capabilities; + + for (size_t idx = 0; idx < _variableParameters.size(); idx++) { + VariableParameter x = _variableParameters[idx]; + x.marshal(dataStream); + } +} + +void FastEntityStatePdu::unmarshal(DataStream& dataStream) { + EntityInformationFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _site; + dataStream >> _application; + dataStream >> _entity; + dataStream >> _forceId; + dataStream >> _numberOfVariableParameters; + dataStream >> _entityKind; + dataStream >> _domain; + dataStream >> _country; + dataStream >> _category; + dataStream >> _subcategory; + dataStream >> _specific; + dataStream >> _extra; + dataStream >> _altEntityKind; + dataStream >> _altDomain; + dataStream >> _altCountry; + dataStream >> _altCategory; + dataStream >> _altSubcategory; + dataStream >> _altSpecific; + dataStream >> _altExtra; + dataStream >> _xVelocity; + dataStream >> _yVelocity; + dataStream >> _zVelocity; + dataStream >> _xLocation; + dataStream >> _yLocation; + dataStream >> _zLocation; + dataStream >> _psi; + dataStream >> _theta; + dataStream >> _phi; + dataStream >> _entityAppearance; + dataStream >> _deadReckoningAlgorithm; + + for (size_t idx = 0; idx < 15; idx++) { + dataStream >> _otherParameters[idx]; + } + + dataStream >> _xAcceleration; + dataStream >> _yAcceleration; + dataStream >> _zAcceleration; + dataStream >> _xAngularVelocity; + dataStream >> _yAngularVelocity; + dataStream >> _zAngularVelocity; + + for (size_t idx = 0; idx < 12; idx++) { + dataStream >> _marking[idx]; + } + + dataStream >> _capabilities; + + _variableParameters.clear(); + for (size_t idx = 0; idx < _numberOfVariableParameters; idx++) { + VariableParameter x; + x.unmarshal(dataStream); + _variableParameters.push_back(x); + } +} + +bool FastEntityStatePdu::operator==(const FastEntityStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityInformationFamilyPdu::operator==(rhs); + + if (!(_site == rhs._site)) ivarsEqual = false; + if (!(_application == rhs._application)) ivarsEqual = false; + if (!(_entity == rhs._entity)) ivarsEqual = false; + if (!(_forceId == rhs._forceId)) ivarsEqual = false; + if (!(_entityKind == rhs._entityKind)) ivarsEqual = false; + if (!(_domain == rhs._domain)) ivarsEqual = false; + if (!(_country == rhs._country)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_subcategory == rhs._subcategory)) ivarsEqual = false; + if (!(_specific == rhs._specific)) ivarsEqual = false; + if (!(_extra == rhs._extra)) ivarsEqual = false; + if (!(_altEntityKind == rhs._altEntityKind)) ivarsEqual = false; + if (!(_altDomain == rhs._altDomain)) ivarsEqual = false; + if (!(_altCountry == rhs._altCountry)) ivarsEqual = false; + if (!(_altCategory == rhs._altCategory)) ivarsEqual = false; + if (!(_altSubcategory == rhs._altSubcategory)) ivarsEqual = false; + if (!(_altSpecific == rhs._altSpecific)) ivarsEqual = false; + if (!(_altExtra == rhs._altExtra)) ivarsEqual = false; + if (!(_xVelocity == rhs._xVelocity)) ivarsEqual = false; + if (!(_yVelocity == rhs._yVelocity)) ivarsEqual = false; + if (!(_zVelocity == rhs._zVelocity)) ivarsEqual = false; + if (!(_xLocation == rhs._xLocation)) ivarsEqual = false; + if (!(_yLocation == rhs._yLocation)) ivarsEqual = false; + if (!(_zLocation == rhs._zLocation)) ivarsEqual = false; + if (!(_psi == rhs._psi)) ivarsEqual = false; + if (!(_theta == rhs._theta)) ivarsEqual = false; + if (!(_phi == rhs._phi)) ivarsEqual = false; + if (!(_entityAppearance == rhs._entityAppearance)) ivarsEqual = false; + if (!(_deadReckoningAlgorithm == rhs._deadReckoningAlgorithm)) + ivarsEqual = false; + + for (uint8_t idx = 0; idx < 15; idx++) { + if (!(_otherParameters[idx] == rhs._otherParameters[idx])) + ivarsEqual = false; + } + + if (!(_xAcceleration == rhs._xAcceleration)) ivarsEqual = false; + if (!(_yAcceleration == rhs._yAcceleration)) ivarsEqual = false; + if (!(_zAcceleration == rhs._zAcceleration)) ivarsEqual = false; + if (!(_xAngularVelocity == rhs._xAngularVelocity)) ivarsEqual = false; + if (!(_yAngularVelocity == rhs._yAngularVelocity)) ivarsEqual = false; + if (!(_zAngularVelocity == rhs._zAngularVelocity)) ivarsEqual = false; + + for (uint8_t idx = 0; idx < 12; idx++) { + if (!(_marking[idx] == rhs._marking[idx])) ivarsEqual = false; + } + + if (!(_capabilities == rhs._capabilities)) ivarsEqual = false; + + for (size_t idx = 0; idx < _variableParameters.size(); idx++) { + if (!(_variableParameters[idx] == rhs._variableParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int FastEntityStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityInformationFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 2; // _site + marshalSize = marshalSize + 2; // _application + marshalSize = marshalSize + 2; // _entity + marshalSize = marshalSize + 1; // _forceId + marshalSize = marshalSize + 1; // _numberOfVariableParameters + marshalSize = marshalSize + 1; // _entityKind + marshalSize = marshalSize + 1; // _domain + marshalSize = marshalSize + 2; // _country + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _subcategory + marshalSize = marshalSize + 1; // _specific + marshalSize = marshalSize + 1; // _extra + marshalSize = marshalSize + 1; // _altEntityKind + marshalSize = marshalSize + 1; // _altDomain + marshalSize = marshalSize + 2; // _altCountry + marshalSize = marshalSize + 1; // _altCategory + marshalSize = marshalSize + 1; // _altSubcategory + marshalSize = marshalSize + 1; // _altSpecific + marshalSize = marshalSize + 1; // _altExtra + marshalSize = marshalSize + 4; // _xVelocity + marshalSize = marshalSize + 4; // _yVelocity + marshalSize = marshalSize + 4; // _zVelocity + marshalSize = marshalSize + 8; // _xLocation + marshalSize = marshalSize + 8; // _yLocation + marshalSize = marshalSize + 8; // _zLocation + marshalSize = marshalSize + 4; // _psi + marshalSize = marshalSize + 4; // _theta + marshalSize = marshalSize + 4; // _phi + marshalSize = marshalSize + 4; // _entityAppearance + marshalSize = marshalSize + 1; // _deadReckoningAlgorithm + marshalSize = marshalSize + 15 * 1; // _otherParameters + marshalSize = marshalSize + 4; // _xAcceleration + marshalSize = marshalSize + 4; // _yAcceleration + marshalSize = marshalSize + 4; // _zAcceleration + marshalSize = marshalSize + 4; // _xAngularVelocity + marshalSize = marshalSize + 4; // _yAngularVelocity + marshalSize = marshalSize + 4; // _zAngularVelocity + marshalSize = marshalSize + 12 * 1; // _marking + marshalSize = marshalSize + 4; // _capabilities + + for (uint64_t idx = 0; idx < _variableParameters.size(); idx++) { + VariableParameter listElement = _variableParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_information/FastEntityStatePdu.h b/src/dis7/entity_information/FastEntityStatePdu.h new file mode 100644 index 00000000..3ac2e507 --- /dev/null +++ b/src/dis7/entity_information/FastEntityStatePdu.h @@ -0,0 +1,306 @@ +#pragma once + +#include + +#include "dis7/EntityInformationFamilyPdu.h" +#include "dis7/VariableParameter.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Represents the postion and state of one entity in the world. This is +// identical in function to entity state pdu, but generates less garbage to +// collect in the Java world. Section 7.2.2. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT FastEntityStatePdu : public EntityInformationFamilyPdu { + protected: + /** The site ID */ + uint16_t _site; + + /** The application ID */ + uint16_t _application; + + /** the entity ID */ + uint16_t _entity; + + /** what force this entity is affiliated with, eg red, blue, neutral, etc */ + uint8_t _forceId; + + /** How many variable (nee articulation) parameters are in the variable length + * list */ + uint8_t _numberOfVariableParameters; + + /** Kind of entity */ + uint8_t _entityKind; + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _domain; + + /** country to which the design of the entity is attributed */ + uint16_t _country; + + /** category of entity */ + uint8_t _category; + + /** subcategory of entity */ + uint8_t _subcategory; + + /** specific info based on subcategory field */ + uint8_t _specific; + + uint8_t _extra; + + /** Kind of entity */ + uint8_t _altEntityKind; + + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _altDomain; + + /** country to which the design of the entity is attributed */ + uint16_t _altCountry; + + /** category of entity */ + uint8_t _altCategory; + + /** subcategory of entity */ + uint8_t _altSubcategory; + + /** specific info based on subcategory field */ + uint8_t _altSpecific; + + uint8_t _altExtra; + + /** X velo */ + float _xVelocity; + + /** y Value */ + float _yVelocity; + + /** Z value */ + float _zVelocity; + + /** X value */ + double _xLocation; + + /** y Value */ + double _yLocation; + + /** Z value */ + double _zLocation; + + float _psi; + + float _theta; + + float _phi; + + /** a series of bit flags that are used to help draw the entity, such as + * smoking, on fire, etc. */ + int _entityAppearance; + + /** enumeration of what dead reckoning algorighm to use */ + uint8_t _deadReckoningAlgorithm; + + /** other parameters to use in the dead reckoning algorithm */ + char _otherParameters[15]; + + /** X value */ + float _xAcceleration; + + /** y Value */ + float _yAcceleration; + + /** Z value */ + float _zAcceleration; + + /** X value */ + float _xAngularVelocity; + + /** y Value */ + float _yAngularVelocity; + + /** Z value */ + float _zAngularVelocity; + + /** characters that can be used for debugging, or to draw unique strings on + * the side of entities in the world */ + char _marking[12]; + + /** a series of bit flags */ + int _capabilities; + + /** variable length list of variable parameters. In earlier versions of DIS + * these were known as articulation parameters */ + std::vector _variableParameters; + + public: + FastEntityStatePdu(); + virtual ~FastEntityStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getSite() const; + void setSite(uint16_t pX); + + uint16_t getApplication() const; + void setApplication(uint16_t pX); + + uint16_t getEntity() const; + void setEntity(uint16_t pX); + + uint8_t getForceId() const; + void setForceId(uint8_t pX); + + char getNumberOfVariableParameters() const; + + uint8_t getEntityKind() const; + void setEntityKind(uint8_t pX); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint16_t getCountry() const; + void setCountry(uint16_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + uint8_t getSpecific() const; + void setSpecific(uint8_t pX); + + uint8_t getExtra() const; + void setExtra(uint8_t pX); + + uint8_t getAltEntityKind() const; + void setAltEntityKind(uint8_t pX); + + uint8_t getAltDomain() const; + void setAltDomain(uint8_t pX); + + uint16_t getAltCountry() const; + void setAltCountry(uint16_t pX); + + uint8_t getAltCategory() const; + void setAltCategory(uint8_t pX); + + uint8_t getAltSubcategory() const; + void setAltSubcategory(uint8_t pX); + + uint8_t getAltSpecific() const; + void setAltSpecific(uint8_t pX); + + uint8_t getAltExtra() const; + void setAltExtra(uint8_t pX); + + float getXVelocity() const; + void setXVelocity(float pX); + + float getYVelocity() const; + void setYVelocity(float pX); + + float getZVelocity() const; + void setZVelocity(float pX); + + double getXLocation() const; + void setXLocation(double pX); + + double getYLocation() const; + void setYLocation(double pX); + + double getZLocation() const; + void setZLocation(double pX); + + float getPsi() const; + void setPsi(float pX); + + float getTheta() const; + void setTheta(float pX); + + float getPhi() const; + void setPhi(float pX); + + int getEntityAppearance() const; + void setEntityAppearance(int pX); + + uint8_t getDeadReckoningAlgorithm() const; + void setDeadReckoningAlgorithm(uint8_t pX); + + char* getOtherParameters(); + const char* getOtherParameters() const; + void setOtherParameters(const char* pX); + + float getXAcceleration() const; + void setXAcceleration(float pX); + + float getYAcceleration() const; + void setYAcceleration(float pX); + + float getZAcceleration() const; + void setZAcceleration(float pX); + + float getXAngularVelocity() const; + void setXAngularVelocity(float pX); + + float getYAngularVelocity() const; + void setYAngularVelocity(float pX); + + float getZAngularVelocity() const; + void setZAngularVelocity(float pX); + + char* getMarking(); + const char* getMarking() const; + void setMarking(const char* pX); + void setByStringMarking(const char* pX); + + int getCapabilities() const; + void setCapabilities(int pX); + + std::vector& getVariableParameters(); + const std::vector& getVariableParameters() const; + void setVariableParameters(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FastEntityStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_management/CMakeLists.txt b/src/dis7/entity_management/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/entity_management/EntityManagementFamilyPdu.cpp b/src/dis7/entity_management/EntityManagementFamilyPdu.cpp new file mode 100644 index 00000000..73d70332 --- /dev/null +++ b/src/dis7/entity_management/EntityManagementFamilyPdu.cpp @@ -0,0 +1,67 @@ +#include "dis7/EntityManagementFamilyPdu.h" + +using namespace DIS; + +EntityManagementFamilyPdu::EntityManagementFamilyPdu() + : Pdu() + +{ + setProtocolFamily(7); +} + +EntityManagementFamilyPdu::~EntityManagementFamilyPdu() {} + +void EntityManagementFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void EntityManagementFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool EntityManagementFamilyPdu::operator==( + const EntityManagementFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int EntityManagementFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_management/EntityManagementFamilyPdu.h b/src/dis7/entity_management/EntityManagementFamilyPdu.h new file mode 100644 index 00000000..65284d17 --- /dev/null +++ b/src/dis7/entity_management/EntityManagementFamilyPdu.h @@ -0,0 +1,59 @@ +#pragma once + +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Managment of grouping of PDUs, and more. Section 7.8 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityManagementFamilyPdu : public Pdu { + protected: + public: + EntityManagementFamilyPdu(); + virtual ~EntityManagementFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityManagementFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_management/IsPartOfPdu.cpp b/src/dis7/entity_management/IsPartOfPdu.cpp new file mode 100644 index 00000000..d20d38d7 --- /dev/null +++ b/src/dis7/entity_management/IsPartOfPdu.cpp @@ -0,0 +1,165 @@ +#include "dis7/IsPartOfPdu.h" + +using namespace DIS; + +IsPartOfPdu::IsPartOfPdu() + : EntityManagementFamilyPdu(), + _orginatingEntityID(), + _receivingEntityID(), + _relationship(), + _partLocation(), + _namedLocationID(), + _partEntityType() { + setPduType(36); +} + +IsPartOfPdu::~IsPartOfPdu() {} + +EntityID& IsPartOfPdu::getOrginatingEntityID() { return _orginatingEntityID; } + +const EntityID& IsPartOfPdu::getOrginatingEntityID() const { + return _orginatingEntityID; +} + +void IsPartOfPdu::setOrginatingEntityID(const EntityID& pX) { + _orginatingEntityID = pX; +} + +EntityID& IsPartOfPdu::getReceivingEntityID() { return _receivingEntityID; } + +const EntityID& IsPartOfPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void IsPartOfPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +Relationship& IsPartOfPdu::getRelationship() { return _relationship; } + +const Relationship& IsPartOfPdu::getRelationship() const { + return _relationship; +} + +void IsPartOfPdu::setRelationship(const Relationship& pX) { + _relationship = pX; +} + +Vector3Float& IsPartOfPdu::getPartLocation() { return _partLocation; } + +const Vector3Float& IsPartOfPdu::getPartLocation() const { + return _partLocation; +} + +void IsPartOfPdu::setPartLocation(const Vector3Float& pX) { + _partLocation = pX; +} + +NamedLocationIdentification& IsPartOfPdu::getNamedLocationID() { + return _namedLocationID; +} + +const NamedLocationIdentification& IsPartOfPdu::getNamedLocationID() const { + return _namedLocationID; +} + +void IsPartOfPdu::setNamedLocationID(const NamedLocationIdentification& pX) { + _namedLocationID = pX; +} + +EntityType& IsPartOfPdu::getPartEntityType() { return _partEntityType; } + +const EntityType& IsPartOfPdu::getPartEntityType() const { + return _partEntityType; +} + +void IsPartOfPdu::setPartEntityType(const EntityType& pX) { + _partEntityType = pX; +} + +void IsPartOfPdu::marshal(DataStream& dataStream) const { + EntityManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _orginatingEntityID.marshal(dataStream); + _receivingEntityID.marshal(dataStream); + _relationship.marshal(dataStream); + _partLocation.marshal(dataStream); + _namedLocationID.marshal(dataStream); + _partEntityType.marshal(dataStream); +} + +void IsPartOfPdu::unmarshal(DataStream& dataStream) { + EntityManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _orginatingEntityID.unmarshal(dataStream); + _receivingEntityID.unmarshal(dataStream); + _relationship.unmarshal(dataStream); + _partLocation.unmarshal(dataStream); + _namedLocationID.unmarshal(dataStream); + _partEntityType.unmarshal(dataStream); +} + +bool IsPartOfPdu::operator==(const IsPartOfPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = EntityManagementFamilyPdu::operator==(rhs); + + if (!(_orginatingEntityID == rhs._orginatingEntityID)) ivarsEqual = false; + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_relationship == rhs._relationship)) ivarsEqual = false; + if (!(_partLocation == rhs._partLocation)) ivarsEqual = false; + if (!(_namedLocationID == rhs._namedLocationID)) ivarsEqual = false; + if (!(_partEntityType == rhs._partEntityType)) ivarsEqual = false; + + return ivarsEqual; +} + +int IsPartOfPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = EntityManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _orginatingEntityID.getMarshalledSize(); // _orginatingEntityID + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = + marshalSize + _relationship.getMarshalledSize(); // _relationship + marshalSize = + marshalSize + _partLocation.getMarshalledSize(); // _partLocation + marshalSize = + marshalSize + _namedLocationID.getMarshalledSize(); // _namedLocationID + marshalSize = + marshalSize + _partEntityType.getMarshalledSize(); // _partEntityType + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_management/IsPartOfPdu.h b/src/dis7/entity_management/IsPartOfPdu.h new file mode 100644 index 00000000..66b7ea3f --- /dev/null +++ b/src/dis7/entity_management/IsPartOfPdu.h @@ -0,0 +1,108 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/EntityManagementFamilyPdu.h" +#include "dis7/EntityType.h" +#include "dis7/NamedLocationIdentification.h" +#include "dis7/Relationship.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The joining of two or more simulation entities is communicated by this PDU. +// Section 7.8.5 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT IsPartOfPdu : public EntityManagementFamilyPdu { + protected: + /** ID of entity originating PDU */ + EntityID _orginatingEntityID; + + /** ID of entity receiving PDU */ + EntityID _receivingEntityID; + + /** relationship of joined parts */ + Relationship _relationship; + + /** location of part; centroid of part in host's coordinate system. x=range, + * y=bearing, z=0 */ + Vector3Float _partLocation; + + /** named location */ + NamedLocationIdentification _namedLocationID; + + /** entity type */ + EntityType _partEntityType; + + public: + IsPartOfPdu(); + virtual ~IsPartOfPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOrginatingEntityID(); + const EntityID& getOrginatingEntityID() const; + void setOrginatingEntityID(const EntityID& pX); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + Relationship& getRelationship(); + const Relationship& getRelationship() const; + void setRelationship(const Relationship& pX); + + Vector3Float& getPartLocation(); + const Vector3Float& getPartLocation() const; + void setPartLocation(const Vector3Float& pX); + + NamedLocationIdentification& getNamedLocationID(); + const NamedLocationIdentification& getNamedLocationID() const; + void setNamedLocationID(const NamedLocationIdentification& pX); + + EntityType& getPartEntityType(); + const EntityType& getPartEntityType() const; + void setPartEntityType(const EntityType& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IsPartOfPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_management/NamedLocationIdentification.cpp b/src/dis7/entity_management/NamedLocationIdentification.cpp new file mode 100644 index 00000000..3e83b03e --- /dev/null +++ b/src/dis7/entity_management/NamedLocationIdentification.cpp @@ -0,0 +1,83 @@ +#include "dis7/NamedLocationIdentification.h" + +using namespace DIS; + +NamedLocationIdentification::NamedLocationIdentification() + : _stationName(0), _stationNumber(0) {} + +NamedLocationIdentification::~NamedLocationIdentification() {} + +uint16_t NamedLocationIdentification::getStationName() const { + return _stationName; +} + +void NamedLocationIdentification::setStationName(uint16_t pX) { + _stationName = pX; +} + +uint16_t NamedLocationIdentification::getStationNumber() const { + return _stationNumber; +} + +void NamedLocationIdentification::setStationNumber(uint16_t pX) { + _stationNumber = pX; +} + +void NamedLocationIdentification::marshal(DataStream& dataStream) const { + dataStream << _stationName; + dataStream << _stationNumber; +} + +void NamedLocationIdentification::unmarshal(DataStream& dataStream) { + dataStream >> _stationName; + dataStream >> _stationNumber; +} + +bool NamedLocationIdentification::operator==( + const NamedLocationIdentification& rhs) const { + bool ivarsEqual = true; + + if (!(_stationName == rhs._stationName)) ivarsEqual = false; + if (!(_stationNumber == rhs._stationNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int NamedLocationIdentification::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _stationName + marshalSize = marshalSize + 2; // _stationNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_management/NamedLocationIdentification.h b/src/dis7/entity_management/NamedLocationIdentification.h new file mode 100644 index 00000000..3bc3588d --- /dev/null +++ b/src/dis7/entity_management/NamedLocationIdentification.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about the discrete positional relationship of the part entity +// with respect to the its host entity Section 6.2.62 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT NamedLocationIdentification { + protected: + /** the station name within the host at which the part entity is located. If + * the part entity is On Station, this field shall specify the representation + * of the part’s location data fields. This field shall be specified by a + * 16-bit enumeration */ + uint16_t _stationName; + + /** the number of the particular wing station, cargo hold etc., at which the + * part is attached. */ + uint16_t _stationNumber; + + public: + NamedLocationIdentification(); + virtual ~NamedLocationIdentification(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getStationName() const; + void setStationName(uint16_t pX); + + uint16_t getStationNumber() const; + void setStationNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const NamedLocationIdentification& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_management/Relationship.cpp b/src/dis7/entity_management/Relationship.cpp new file mode 100644 index 00000000..8e9ac6d8 --- /dev/null +++ b/src/dis7/entity_management/Relationship.cpp @@ -0,0 +1,73 @@ +#include "dis7/Relationship.h" + +using namespace DIS; + +Relationship::Relationship() : _nature(0), _position(0) {} + +Relationship::~Relationship() {} + +uint16_t Relationship::getNature() const { return _nature; } + +void Relationship::setNature(uint16_t pX) { _nature = pX; } + +uint16_t Relationship::getPosition() const { return _position; } + +void Relationship::setPosition(uint16_t pX) { _position = pX; } + +void Relationship::marshal(DataStream& dataStream) const { + dataStream << _nature; + dataStream << _position; +} + +void Relationship::unmarshal(DataStream& dataStream) { + dataStream >> _nature; + dataStream >> _position; +} + +bool Relationship::operator==(const Relationship& rhs) const { + bool ivarsEqual = true; + + if (!(_nature == rhs._nature)) ivarsEqual = false; + if (!(_position == rhs._position)) ivarsEqual = false; + + return ivarsEqual; +} + +int Relationship::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _nature + marshalSize = marshalSize + 2; // _position + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/entity_management/Relationship.h b/src/dis7/entity_management/Relationship.h new file mode 100644 index 00000000..75522c7f --- /dev/null +++ b/src/dis7/entity_management/Relationship.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The relationship of the part entity to its host entity. Section 6.2.73. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT Relationship { + protected: + /** the nature or purpose for joining of the part entity to the host entity + * and shall be represented by a 16-bit enumeration */ + uint16_t _nature; + + /** the position of the part entity with respect to the host entity and shall + * be represented by a 16-bit enumeration */ + uint16_t _position; + + public: + Relationship(); + virtual ~Relationship(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getNature() const; + void setNature(uint16_t pX); + + uint16_t getPosition() const; + void setPosition(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const Relationship& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/CMakeLists.txt b/src/dis7/logistics/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/logistics/LogisticsFamilyPdu.cpp b/src/dis7/logistics/LogisticsFamilyPdu.cpp new file mode 100644 index 00000000..1ab339d5 --- /dev/null +++ b/src/dis7/logistics/LogisticsFamilyPdu.cpp @@ -0,0 +1,66 @@ +#include "dis7/LogisticsFamilyPdu.h" + +using namespace DIS; + +LogisticsFamilyPdu::LogisticsFamilyPdu() + : Pdu() + +{ + setProtocolFamily(3); +} + +LogisticsFamilyPdu::~LogisticsFamilyPdu() {} + +void LogisticsFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void LogisticsFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool LogisticsFamilyPdu::operator==(const LogisticsFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int LogisticsFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/LogisticsFamilyPdu.h b/src/dis7/logistics/LogisticsFamilyPdu.h new file mode 100644 index 00000000..0d7dd9bc --- /dev/null +++ b/src/dis7/logistics/LogisticsFamilyPdu.h @@ -0,0 +1,59 @@ +#pragma once + +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Abstract superclass for logistics PDUs. Section 7.4 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT LogisticsFamilyPdu : public Pdu { + protected: + public: + LogisticsFamilyPdu(); + virtual ~LogisticsFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const LogisticsFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/RepairCompletePdu.cpp b/src/dis7/logistics/RepairCompletePdu.cpp new file mode 100644 index 00000000..dd0884f9 --- /dev/null +++ b/src/dis7/logistics/RepairCompletePdu.cpp @@ -0,0 +1,121 @@ +#include "dis7/RepairCompletePdu.h" + +using namespace DIS; + +RepairCompletePdu::RepairCompletePdu() + : LogisticsFamilyPdu(), + _receivingEntityID(), + _repairingEntityID(), + _repair(0), + _padding4(0) { + setPduType(9); +} + +RepairCompletePdu::~RepairCompletePdu() {} + +EntityID& RepairCompletePdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& RepairCompletePdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void RepairCompletePdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& RepairCompletePdu::getRepairingEntityID() { + return _repairingEntityID; +} + +const EntityID& RepairCompletePdu::getRepairingEntityID() const { + return _repairingEntityID; +} + +void RepairCompletePdu::setRepairingEntityID(const EntityID& pX) { + _repairingEntityID = pX; +} + +uint16_t RepairCompletePdu::getRepair() const { return _repair; } + +void RepairCompletePdu::setRepair(uint16_t pX) { _repair = pX; } + +int16_t RepairCompletePdu::getPadding4() const { return _padding4; } + +void RepairCompletePdu::setPadding4(int16_t pX) { _padding4 = pX; } + +void RepairCompletePdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _repairingEntityID.marshal(dataStream); + dataStream << _repair; + dataStream << _padding4; +} + +void RepairCompletePdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _repairingEntityID.unmarshal(dataStream); + dataStream >> _repair; + dataStream >> _padding4; +} + +bool RepairCompletePdu::operator==(const RepairCompletePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_repairingEntityID == rhs._repairingEntityID)) ivarsEqual = false; + if (!(_repair == rhs._repair)) ivarsEqual = false; + if (!(_padding4 == rhs._padding4)) ivarsEqual = false; + + return ivarsEqual; +} + +int RepairCompletePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _repairingEntityID.getMarshalledSize(); // _repairingEntityID + marshalSize = marshalSize + 2; // _repair + marshalSize = marshalSize + 2; // _padding4 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/RepairCompletePdu.h b/src/dis7/logistics/RepairCompletePdu.h new file mode 100644 index 00000000..a04a678c --- /dev/null +++ b/src/dis7/logistics/RepairCompletePdu.h @@ -0,0 +1,87 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/LogisticsFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.4.6. Service Request PDU is received and repair is complete. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RepairCompletePdu : public LogisticsFamilyPdu { + protected: + /** Entity that is receiving service. See 6.2.28 */ + EntityID _receivingEntityID; + + /** Entity that is supplying. See 6.2.28 */ + EntityID _repairingEntityID; + + /** Enumeration for type of repair. See 6.2.74 */ + uint16_t _repair; + + /** padding, number prevents conflict with superclass ivar name */ + int16_t _padding4; + + public: + RepairCompletePdu(); + virtual ~RepairCompletePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getRepairingEntityID(); + const EntityID& getRepairingEntityID() const; + void setRepairingEntityID(const EntityID& pX); + + uint16_t getRepair() const; + void setRepair(uint16_t pX); + + int16_t getPadding4() const; + void setPadding4(int16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RepairCompletePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/RepairResponsePdu.cpp b/src/dis7/logistics/RepairResponsePdu.cpp new file mode 100644 index 00000000..6240207e --- /dev/null +++ b/src/dis7/logistics/RepairResponsePdu.cpp @@ -0,0 +1,134 @@ +#include "dis7/RepairResponsePdu.h" + +using namespace DIS; + +RepairResponsePdu::RepairResponsePdu() + : LogisticsFamilyPdu(), + _receivingEntityID(), + _repairingEntityID(), + _repairResult(0), + _padding1(0), + _padding2(0) { + setPduType(10); +} + +RepairResponsePdu::~RepairResponsePdu() {} + +EntityID& RepairResponsePdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& RepairResponsePdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void RepairResponsePdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& RepairResponsePdu::getRepairingEntityID() { + return _repairingEntityID; +} + +const EntityID& RepairResponsePdu::getRepairingEntityID() const { + return _repairingEntityID; +} + +void RepairResponsePdu::setRepairingEntityID(const EntityID& pX) { + _repairingEntityID = pX; +} + +uint8_t RepairResponsePdu::getRepairResult() const { + return _repairResult; +} + +void RepairResponsePdu::setRepairResult(uint8_t pX) { + _repairResult = pX; +} + +int16_t RepairResponsePdu::getPadding1() const { return _padding1; } + +void RepairResponsePdu::setPadding1(int16_t pX) { _padding1 = pX; } + +char RepairResponsePdu::getPadding2() const { return _padding2; } + +void RepairResponsePdu::setPadding2(char pX) { _padding2 = pX; } + +void RepairResponsePdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _repairingEntityID.marshal(dataStream); + dataStream << _repairResult; + dataStream << _padding1; + dataStream << _padding2; +} + +void RepairResponsePdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _repairingEntityID.unmarshal(dataStream); + dataStream >> _repairResult; + dataStream >> _padding1; + dataStream >> _padding2; +} + +bool RepairResponsePdu::operator==(const RepairResponsePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_repairingEntityID == rhs._repairingEntityID)) ivarsEqual = false; + if (!(_repairResult == rhs._repairResult)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + return ivarsEqual; +} + +int RepairResponsePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _repairingEntityID.getMarshalledSize(); // _repairingEntityID + marshalSize = marshalSize + 1; // _repairResult + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 1; // _padding2 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/RepairResponsePdu.h b/src/dis7/logistics/RepairResponsePdu.h new file mode 100644 index 00000000..fa1bd53f --- /dev/null +++ b/src/dis7/logistics/RepairResponsePdu.h @@ -0,0 +1,92 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/LogisticsFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.4.7. Sent after repair complete PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RepairResponsePdu : public LogisticsFamilyPdu { + protected: + /** Entity that requested repairs. See 6.2.28 */ + EntityID _receivingEntityID; + + /** Entity that is repairing. See 6.2.28 */ + EntityID _repairingEntityID; + + /** Result of repair operation */ + uint8_t _repairResult; + + /** padding */ + int16_t _padding1; + + /** padding */ + char _padding2; + + public: + RepairResponsePdu(); + virtual ~RepairResponsePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getRepairingEntityID(); + const EntityID& getRepairingEntityID() const; + void setRepairingEntityID(const EntityID& pX); + + uint8_t getRepairResult() const; + void setRepairResult(uint8_t pX); + + int16_t getPadding1() const; + void setPadding1(int16_t pX); + + char getPadding2() const; + void setPadding2(char pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RepairResponsePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/ResupplyOfferPdu.cpp b/src/dis7/logistics/ResupplyOfferPdu.cpp new file mode 100644 index 00000000..b8f0cdd7 --- /dev/null +++ b/src/dis7/logistics/ResupplyOfferPdu.cpp @@ -0,0 +1,163 @@ +#include "dis7/ResupplyOfferPdu.h" + +using namespace DIS; + +ResupplyOfferPdu::ResupplyOfferPdu() + : LogisticsFamilyPdu(), + _receivingEntityID(), + _supplyingEntityID(), + _numberOfSupplyTypes(0), + _padding1(0), + _padding2(0) { + setPduType(6); +} + +ResupplyOfferPdu::~ResupplyOfferPdu() { _supplies.clear(); } + +EntityID& ResupplyOfferPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& ResupplyOfferPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void ResupplyOfferPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& ResupplyOfferPdu::getSupplyingEntityID() { + return _supplyingEntityID; +} + +const EntityID& ResupplyOfferPdu::getSupplyingEntityID() const { + return _supplyingEntityID; +} + +void ResupplyOfferPdu::setSupplyingEntityID(const EntityID& pX) { + _supplyingEntityID = pX; +} + +uint8_t ResupplyOfferPdu::getNumberOfSupplyTypes() const { + return _supplies.size(); +} + +char ResupplyOfferPdu::getPadding1() const { return _padding1; } + +void ResupplyOfferPdu::setPadding1(char pX) { _padding1 = pX; } + +int16_t ResupplyOfferPdu::getPadding2() const { return _padding2; } + +void ResupplyOfferPdu::setPadding2(int16_t pX) { _padding2 = pX; } + +std::vector& ResupplyOfferPdu::getSupplies() { + return _supplies; +} + +const std::vector& ResupplyOfferPdu::getSupplies() const { + return _supplies; +} + +void ResupplyOfferPdu::setSupplies(const std::vector& pX) { + _supplies = pX; +} + +void ResupplyOfferPdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _supplyingEntityID.marshal(dataStream); + dataStream << (uint8_t)_supplies.size(); + dataStream << _padding1; + dataStream << _padding2; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity x = _supplies[idx]; + x.marshal(dataStream); + } +} + +void ResupplyOfferPdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _supplyingEntityID.unmarshal(dataStream); + dataStream >> _numberOfSupplyTypes; + dataStream >> _padding1; + dataStream >> _padding2; + + _supplies.clear(); + for (size_t idx = 0; idx < _numberOfSupplyTypes; idx++) { + SupplyQuantity x; + x.unmarshal(dataStream); + _supplies.push_back(x); + } +} + +bool ResupplyOfferPdu::operator==(const ResupplyOfferPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_supplyingEntityID == rhs._supplyingEntityID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + if (!(_supplies[idx] == rhs._supplies[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ResupplyOfferPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID + marshalSize = marshalSize + 1; // _numberOfSupplyTypes + marshalSize = marshalSize + 1; // _padding1 + marshalSize = marshalSize + 2; // _padding2 + + for (uint64_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity listElement = _supplies[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/ResupplyOfferPdu.h b/src/dis7/logistics/ResupplyOfferPdu.h new file mode 100644 index 00000000..8128e074 --- /dev/null +++ b/src/dis7/logistics/ResupplyOfferPdu.h @@ -0,0 +1,106 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/LogisticsFamilyPdu.h" +#include "dis7/SupplyQuantity.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information used to communicate the offer of supplies by a supplying entity +// to a receiving entity. Section 7.4.3 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ResupplyOfferPdu : public LogisticsFamilyPdu { + protected: + /** Field identifies the Entity and respective Entity Record ID that is + * receiving service (see 6.2.28), Section 7.4.3 */ + EntityID _receivingEntityID; + + /** Identifies the Entity and respective Entity ID Record that is supplying + * (see 6.2.28), Section 7.4.3 */ + EntityID _supplyingEntityID; + + /** How many supplies types are being offered, Section 7.4.3 */ + uint8_t _numberOfSupplyTypes; + + /** padding */ + char _padding1; + + /** padding */ + int16_t _padding2; + + /** A Reord that Specifies the type of supply and the amount of that supply + * for each of the supply types in numberOfSupplyTypes (see 6.2.85), + * Section 7.4.3 */ + std::vector _supplies; + + public: + ResupplyOfferPdu(); + virtual ~ResupplyOfferPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getSupplyingEntityID(); + const EntityID& getSupplyingEntityID() const; + void setSupplyingEntityID(const EntityID& pX); + + uint8_t getNumberOfSupplyTypes() const; + + char getPadding1() const; + void setPadding1(char pX); + + int16_t getPadding2() const; + void setPadding2(int16_t pX); + + std::vector& getSupplies(); + const std::vector& getSupplies() const; + void setSupplies(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ResupplyOfferPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/ResupplyReceivedPdu.cpp b/src/dis7/logistics/ResupplyReceivedPdu.cpp new file mode 100644 index 00000000..088216b6 --- /dev/null +++ b/src/dis7/logistics/ResupplyReceivedPdu.cpp @@ -0,0 +1,163 @@ +#include "dis7/ResupplyReceivedPdu.h" + +using namespace DIS; + +ResupplyReceivedPdu::ResupplyReceivedPdu() + : LogisticsFamilyPdu(), + _receivingEntityID(), + _supplyingEntityID(), + _numberOfSupplyTypes(0), + _padding1(0), + _padding2(0) { + setPduType(7); +} + +ResupplyReceivedPdu::~ResupplyReceivedPdu() { _supplies.clear(); } + +EntityID& ResupplyReceivedPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& ResupplyReceivedPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void ResupplyReceivedPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +EntityID& ResupplyReceivedPdu::getSupplyingEntityID() { + return _supplyingEntityID; +} + +const EntityID& ResupplyReceivedPdu::getSupplyingEntityID() const { + return _supplyingEntityID; +} + +void ResupplyReceivedPdu::setSupplyingEntityID(const EntityID& pX) { + _supplyingEntityID = pX; +} + +uint8_t ResupplyReceivedPdu::getNumberOfSupplyTypes() const { + return _supplies.size(); +} + +int16_t ResupplyReceivedPdu::getPadding1() const { return _padding1; } + +void ResupplyReceivedPdu::setPadding1(int16_t pX) { _padding1 = pX; } + +char ResupplyReceivedPdu::getPadding2() const { return _padding2; } + +void ResupplyReceivedPdu::setPadding2(char pX) { _padding2 = pX; } + +std::vector& ResupplyReceivedPdu::getSupplies() { + return _supplies; +} + +const std::vector& ResupplyReceivedPdu::getSupplies() const { + return _supplies; +} + +void ResupplyReceivedPdu::setSupplies(const std::vector& pX) { + _supplies = pX; +} + +void ResupplyReceivedPdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _receivingEntityID.marshal(dataStream); + _supplyingEntityID.marshal(dataStream); + dataStream << (uint8_t)_supplies.size(); + dataStream << _padding1; + dataStream << _padding2; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity x = _supplies[idx]; + x.marshal(dataStream); + } +} + +void ResupplyReceivedPdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _receivingEntityID.unmarshal(dataStream); + _supplyingEntityID.unmarshal(dataStream); + dataStream >> _numberOfSupplyTypes; + dataStream >> _padding1; + dataStream >> _padding2; + + _supplies.clear(); + for (size_t idx = 0; idx < _numberOfSupplyTypes; idx++) { + SupplyQuantity x; + x.unmarshal(dataStream); + _supplies.push_back(x); + } +} + +bool ResupplyReceivedPdu::operator==(const ResupplyReceivedPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + if (!(_supplyingEntityID == rhs._supplyingEntityID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + if (!(_supplies[idx] == rhs._supplies[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ResupplyReceivedPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + marshalSize = marshalSize + + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID + marshalSize = marshalSize + 1; // _numberOfSupplyTypes + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 1; // _padding2 + + for (uint64_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity listElement = _supplies[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/ResupplyReceivedPdu.h b/src/dis7/logistics/ResupplyReceivedPdu.h new file mode 100644 index 00000000..deb69ff2 --- /dev/null +++ b/src/dis7/logistics/ResupplyReceivedPdu.h @@ -0,0 +1,105 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/LogisticsFamilyPdu.h" +#include "dis7/SupplyQuantity.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.4.4. Receipt of supplies is communicated by issuing Resupply +// Received PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ResupplyReceivedPdu : public LogisticsFamilyPdu { + protected: + /** Entity that is receiving service. Shall be represented by Entity + * Identifier record (see 6.2.28) */ + EntityID _receivingEntityID; + + /** Entity that is supplying. Shall be represented by Entity Identifier + * record (see 6.2.28) */ + EntityID _supplyingEntityID; + + /** How many supplies are taken by receiving entity */ + uint8_t _numberOfSupplyTypes; + + /** padding */ + int16_t _padding1; + + /** padding */ + char _padding2; + + /** Type and amount of supplies for each specified supply type. See 6.2.85 + * for supply quantity record. */ + std::vector _supplies; + + public: + ResupplyReceivedPdu(); + virtual ~ResupplyReceivedPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + EntityID& getSupplyingEntityID(); + const EntityID& getSupplyingEntityID() const; + void setSupplyingEntityID(const EntityID& pX); + + uint8_t getNumberOfSupplyTypes() const; + + int16_t getPadding1() const; + void setPadding1(int16_t pX); + + char getPadding2() const; + void setPadding2(char pX); + + std::vector& getSupplies(); + const std::vector& getSupplies() const; + void setSupplies(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ResupplyReceivedPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/ServiceRequestPdu.cpp b/src/dis7/logistics/ServiceRequestPdu.cpp new file mode 100644 index 00000000..8307be2b --- /dev/null +++ b/src/dis7/logistics/ServiceRequestPdu.cpp @@ -0,0 +1,172 @@ +#include "dis7/ServiceRequestPdu.h" + +using namespace DIS; + +ServiceRequestPdu::ServiceRequestPdu() + : LogisticsFamilyPdu(), + _requestingEntityID(), + _servicingEntityID(), + _serviceTypeRequested(0), + _numberOfSupplyTypes(0), + _serviceRequestPadding(0) { + setPduType(5); +} + +ServiceRequestPdu::~ServiceRequestPdu() { _supplies.clear(); } + +EntityID& ServiceRequestPdu::getRequestingEntityID() { + return _requestingEntityID; +} + +const EntityID& ServiceRequestPdu::getRequestingEntityID() const { + return _requestingEntityID; +} + +void ServiceRequestPdu::setRequestingEntityID(const EntityID& pX) { + _requestingEntityID = pX; +} + +EntityID& ServiceRequestPdu::getServicingEntityID() { + return _servicingEntityID; +} + +const EntityID& ServiceRequestPdu::getServicingEntityID() const { + return _servicingEntityID; +} + +void ServiceRequestPdu::setServicingEntityID(const EntityID& pX) { + _servicingEntityID = pX; +} + +uint8_t ServiceRequestPdu::getServiceTypeRequested() const { + return _serviceTypeRequested; +} + +void ServiceRequestPdu::setServiceTypeRequested(uint8_t pX) { + _serviceTypeRequested = pX; +} + +uint8_t ServiceRequestPdu::getNumberOfSupplyTypes() const { + return _supplies.size(); +} + +int16_t ServiceRequestPdu::getServiceRequestPadding() const { + return _serviceRequestPadding; +} + +void ServiceRequestPdu::setServiceRequestPadding(int16_t pX) { + _serviceRequestPadding = pX; +} + +std::vector& ServiceRequestPdu::getSupplies() { + return _supplies; +} + +const std::vector& ServiceRequestPdu::getSupplies() const { + return _supplies; +} + +void ServiceRequestPdu::setSupplies(const std::vector& pX) { + _supplies = pX; +} + +void ServiceRequestPdu::marshal(DataStream& dataStream) const { + LogisticsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _requestingEntityID.marshal(dataStream); + _servicingEntityID.marshal(dataStream); + dataStream << _serviceTypeRequested; + dataStream << (uint8_t)_supplies.size(); + dataStream << _serviceRequestPadding; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity x = _supplies[idx]; + x.marshal(dataStream); + } +} + +void ServiceRequestPdu::unmarshal(DataStream& dataStream) { + LogisticsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _requestingEntityID.unmarshal(dataStream); + _servicingEntityID.unmarshal(dataStream); + dataStream >> _serviceTypeRequested; + dataStream >> _numberOfSupplyTypes; + dataStream >> _serviceRequestPadding; + + _supplies.clear(); + for (size_t idx = 0; idx < _numberOfSupplyTypes; idx++) { + SupplyQuantity x; + x.unmarshal(dataStream); + _supplies.push_back(x); + } +} + +bool ServiceRequestPdu::operator==(const ServiceRequestPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = LogisticsFamilyPdu::operator==(rhs); + + if (!(_requestingEntityID == rhs._requestingEntityID)) ivarsEqual = false; + if (!(_servicingEntityID == rhs._servicingEntityID)) ivarsEqual = false; + if (!(_serviceTypeRequested == rhs._serviceTypeRequested)) ivarsEqual = false; + if (!(_serviceRequestPadding == rhs._serviceRequestPadding)) + ivarsEqual = false; + + for (size_t idx = 0; idx < _supplies.size(); idx++) { + if (!(_supplies[idx] == rhs._supplies[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ServiceRequestPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = LogisticsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _requestingEntityID.getMarshalledSize(); // _requestingEntityID + marshalSize = marshalSize + + _servicingEntityID.getMarshalledSize(); // _servicingEntityID + marshalSize = marshalSize + 1; // _serviceTypeRequested + marshalSize = marshalSize + 1; // _numberOfSupplyTypes + marshalSize = marshalSize + 2; // _serviceRequestPadding + + for (uint64_t idx = 0; idx < _supplies.size(); idx++) { + SupplyQuantity listElement = _supplies[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/ServiceRequestPdu.h b/src/dis7/logistics/ServiceRequestPdu.h new file mode 100644 index 00000000..6595fbc6 --- /dev/null +++ b/src/dis7/logistics/ServiceRequestPdu.h @@ -0,0 +1,101 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/LogisticsFamilyPdu.h" +#include "dis7/SupplyQuantity.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Service Request PDU shall be used to communicate information associated with +// one entity requesting a service from another). Section 7.4.2 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ServiceRequestPdu : public LogisticsFamilyPdu { + protected: + /** Entity that is requesting service (see 6.2.28), Section 7.4.2 */ + EntityID _requestingEntityID; + + /** Entity that is providing the service (see 6.2.28), Section 7.4.2 */ + EntityID _servicingEntityID; + + /** Type of service requested, Section 7.4.2 */ + uint8_t _serviceTypeRequested; + + /** How many requested, Section 7.4.2 */ + uint8_t _numberOfSupplyTypes; + + /** padding */ + int16_t _serviceRequestPadding; + + std::vector _supplies; + + public: + ServiceRequestPdu(); + virtual ~ServiceRequestPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getRequestingEntityID(); + const EntityID& getRequestingEntityID() const; + void setRequestingEntityID(const EntityID& pX); + + EntityID& getServicingEntityID(); + const EntityID& getServicingEntityID() const; + void setServicingEntityID(const EntityID& pX); + + uint8_t getServiceTypeRequested() const; + void setServiceTypeRequested(uint8_t pX); + + uint8_t getNumberOfSupplyTypes() const; + + int16_t getServiceRequestPadding() const; + void setServiceRequestPadding(int16_t pX); + + std::vector& getSupplies(); + const std::vector& getSupplies() const; + void setSupplies(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ServiceRequestPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/SupplyQuantity.cpp b/src/dis7/logistics/SupplyQuantity.cpp new file mode 100644 index 00000000..1659e888 --- /dev/null +++ b/src/dis7/logistics/SupplyQuantity.cpp @@ -0,0 +1,75 @@ +#include "dis7/SupplyQuantity.h" + +using namespace DIS; + +SupplyQuantity::SupplyQuantity() : _supplyType(), _quantity(0.0) {} + +SupplyQuantity::~SupplyQuantity() {} + +EntityType& SupplyQuantity::getSupplyType() { return _supplyType; } + +const EntityType& SupplyQuantity::getSupplyType() const { return _supplyType; } + +void SupplyQuantity::setSupplyType(const EntityType& pX) { _supplyType = pX; } + +float SupplyQuantity::getQuantity() const { return _quantity; } + +void SupplyQuantity::setQuantity(float pX) { _quantity = pX; } + +void SupplyQuantity::marshal(DataStream& dataStream) const { + _supplyType.marshal(dataStream); + dataStream << _quantity; +} + +void SupplyQuantity::unmarshal(DataStream& dataStream) { + _supplyType.unmarshal(dataStream); + dataStream >> _quantity; +} + +bool SupplyQuantity::operator==(const SupplyQuantity& rhs) const { + bool ivarsEqual = true; + + if (!(_supplyType == rhs._supplyType)) ivarsEqual = false; + if (!(_quantity == rhs._quantity)) ivarsEqual = false; + + return ivarsEqual; +} + +int SupplyQuantity::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + _supplyType.getMarshalledSize(); // _supplyType + marshalSize = marshalSize + 4; // _quantity + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/logistics/SupplyQuantity.h b/src/dis7/logistics/SupplyQuantity.h new file mode 100644 index 00000000..eb032bba --- /dev/null +++ b/src/dis7/logistics/SupplyQuantity.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// A supply, and the amount of that supply. Section 6.2.85 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SupplyQuantity { + protected: + /** Type of supply */ + EntityType _supplyType; + + /** the number of units of a supply type. */ + float _quantity; + + public: + SupplyQuantity(); + virtual ~SupplyQuantity(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getSupplyType(); + const EntityType& getSupplyType() const; + void setSupplyType(const EntityType& pX); + + float getQuantity() const; + void setQuantity(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SupplyQuantity& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/CMakeLists.txt b/src/dis7/minefield/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/minefield/MinefieldFamilyPdu.cpp b/src/dis7/minefield/MinefieldFamilyPdu.cpp new file mode 100644 index 00000000..50940679 --- /dev/null +++ b/src/dis7/minefield/MinefieldFamilyPdu.cpp @@ -0,0 +1,66 @@ +#include "dis7/MinefieldFamilyPdu.h" + +using namespace DIS; + +MinefieldFamilyPdu::MinefieldFamilyPdu() + : Pdu() + +{ + setProtocolFamily(8); +} + +MinefieldFamilyPdu::~MinefieldFamilyPdu() {} + +void MinefieldFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void MinefieldFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool MinefieldFamilyPdu::operator==(const MinefieldFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int MinefieldFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/MinefieldFamilyPdu.h b/src/dis7/minefield/MinefieldFamilyPdu.h new file mode 100644 index 00000000..edad597e --- /dev/null +++ b/src/dis7/minefield/MinefieldFamilyPdu.h @@ -0,0 +1,59 @@ +#pragma once + +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Abstract superclass for PDUs relating to minefields. Section 7.9 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT MinefieldFamilyPdu : public Pdu { + protected: + public: + MinefieldFamilyPdu(); + virtual ~MinefieldFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/MinefieldIdentifier.cpp b/src/dis7/minefield/MinefieldIdentifier.cpp new file mode 100644 index 00000000..c71786e5 --- /dev/null +++ b/src/dis7/minefield/MinefieldIdentifier.cpp @@ -0,0 +1,87 @@ +#include "dis7/MinefieldIdentifier.h" + +using namespace DIS; + +MinefieldIdentifier::MinefieldIdentifier() + : _simulationAddress(), _minefieldNumber(0) {} + +MinefieldIdentifier::~MinefieldIdentifier() {} + +SimulationAddress& MinefieldIdentifier::getSimulationAddress() { + return _simulationAddress; +} + +const SimulationAddress& MinefieldIdentifier::getSimulationAddress() const { + return _simulationAddress; +} + +void MinefieldIdentifier::setSimulationAddress(const SimulationAddress& pX) { + _simulationAddress = pX; +} + +uint16_t MinefieldIdentifier::getMinefieldNumber() const { + return _minefieldNumber; +} + +void MinefieldIdentifier::setMinefieldNumber(uint16_t pX) { + _minefieldNumber = pX; +} + +void MinefieldIdentifier::marshal(DataStream& dataStream) const { + _simulationAddress.marshal(dataStream); + dataStream << _minefieldNumber; +} + +void MinefieldIdentifier::unmarshal(DataStream& dataStream) { + _simulationAddress.unmarshal(dataStream); + dataStream >> _minefieldNumber; +} + +bool MinefieldIdentifier::operator==(const MinefieldIdentifier& rhs) const { + bool ivarsEqual = true; + + if (!(_simulationAddress == rhs._simulationAddress)) ivarsEqual = false; + if (!(_minefieldNumber == rhs._minefieldNumber)) ivarsEqual = false; + + return ivarsEqual; +} + +int MinefieldIdentifier::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + + _simulationAddress.getMarshalledSize(); // _simulationAddress + marshalSize = marshalSize + 2; // _minefieldNumber + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/MinefieldIdentifier.h b/src/dis7/minefield/MinefieldIdentifier.h new file mode 100644 index 00000000..a41289cb --- /dev/null +++ b/src/dis7/minefield/MinefieldIdentifier.h @@ -0,0 +1,72 @@ +#pragma once + +#include "dis7/SimulationAddress.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of a minefield Section 6.2.57 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT MinefieldIdentifier { + protected: + /** */ + SimulationAddress _simulationAddress; + + /** */ + uint16_t _minefieldNumber; + + public: + MinefieldIdentifier(); + virtual ~MinefieldIdentifier(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + SimulationAddress& getSimulationAddress(); + const SimulationAddress& getSimulationAddress() const; + void setSimulationAddress(const SimulationAddress& pX); + + uint16_t getMinefieldNumber() const; + void setMinefieldNumber(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldIdentifier& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/MinefieldResponseNackPdu.cpp b/src/dis7/minefield/MinefieldResponseNackPdu.cpp new file mode 100644 index 00000000..e43e7191 --- /dev/null +++ b/src/dis7/minefield/MinefieldResponseNackPdu.cpp @@ -0,0 +1,164 @@ +#include "dis7/MinefieldResponseNackPdu.h" + +using namespace DIS; + +MinefieldResponseNackPdu::MinefieldResponseNackPdu() + : MinefieldFamilyPdu(), + _minefieldID(), + _requestingEntityID(), + _requestID(0), + _numberOfMissingPdus(0) { + setPduType(40); +} + +MinefieldResponseNackPdu::~MinefieldResponseNackPdu() { + _missingPduSequenceNumbers.clear(); +} + +EntityID& MinefieldResponseNackPdu::getMinefieldID() { return _minefieldID; } + +const EntityID& MinefieldResponseNackPdu::getMinefieldID() const { + return _minefieldID; +} + +void MinefieldResponseNackPdu::setMinefieldID(const EntityID& pX) { + _minefieldID = pX; +} + +EntityID& MinefieldResponseNackPdu::getRequestingEntityID() { + return _requestingEntityID; +} + +const EntityID& MinefieldResponseNackPdu::getRequestingEntityID() const { + return _requestingEntityID; +} + +void MinefieldResponseNackPdu::setRequestingEntityID(const EntityID& pX) { + _requestingEntityID = pX; +} + +uint8_t MinefieldResponseNackPdu::getRequestID() const { + return _requestID; +} + +void MinefieldResponseNackPdu::setRequestID(uint8_t pX) { + _requestID = pX; +} + +uint8_t MinefieldResponseNackPdu::getNumberOfMissingPdus() const { + return _missingPduSequenceNumbers.size(); +} + +std::vector& +MinefieldResponseNackPdu::getMissingPduSequenceNumbers() { + return _missingPduSequenceNumbers; +} + +const std::vector& +MinefieldResponseNackPdu::getMissingPduSequenceNumbers() const { + return _missingPduSequenceNumbers; +} + +void MinefieldResponseNackPdu::setMissingPduSequenceNumbers( + const std::vector& pX) { + _missingPduSequenceNumbers = pX; +} + +void MinefieldResponseNackPdu::marshal(DataStream& dataStream) const { + MinefieldFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _minefieldID.marshal(dataStream); + _requestingEntityID.marshal(dataStream); + dataStream << _requestID; + dataStream << (uint8_t)_missingPduSequenceNumbers.size(); + + for (size_t idx = 0; idx < _missingPduSequenceNumbers.size(); idx++) { + EightByteChunk x = _missingPduSequenceNumbers[idx]; + x.marshal(dataStream); + } +} + +void MinefieldResponseNackPdu::unmarshal(DataStream& dataStream) { + MinefieldFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _minefieldID.unmarshal(dataStream); + _requestingEntityID.unmarshal(dataStream); + dataStream >> _requestID; + dataStream >> _numberOfMissingPdus; + + _missingPduSequenceNumbers.clear(); + for (size_t idx = 0; idx < _numberOfMissingPdus; idx++) { + EightByteChunk x; + x.unmarshal(dataStream); + _missingPduSequenceNumbers.push_back(x); + } +} + +bool MinefieldResponseNackPdu::operator==( + const MinefieldResponseNackPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = MinefieldFamilyPdu::operator==(rhs); + + if (!(_minefieldID == rhs._minefieldID)) ivarsEqual = false; + if (!(_requestingEntityID == rhs._requestingEntityID)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _missingPduSequenceNumbers.size(); idx++) { + if (!(_missingPduSequenceNumbers[idx] == + rhs._missingPduSequenceNumbers[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int MinefieldResponseNackPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = MinefieldFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID + marshalSize = marshalSize + + _requestingEntityID.getMarshalledSize(); // _requestingEntityID + marshalSize = marshalSize + 1; // _requestID + marshalSize = marshalSize + 1; // _numberOfMissingPdus + + for (uint64_t idx = 0; idx < _missingPduSequenceNumbers.size(); + idx++) { + EightByteChunk listElement = _missingPduSequenceNumbers[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/MinefieldResponseNackPdu.h b/src/dis7/minefield/MinefieldResponseNackPdu.h new file mode 100644 index 00000000..8ad94832 --- /dev/null +++ b/src/dis7/minefield/MinefieldResponseNackPdu.h @@ -0,0 +1,96 @@ +#pragma once + +#include + +#include "dis7/EightByteChunk.h" +#include "dis7/EntityID.h" +#include "dis7/MinefieldFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// proivde the means to request a retransmit of a minefield data pdu. +// Section 7.9.5 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT MinefieldResponseNackPdu : public MinefieldFamilyPdu { + protected: + /** Minefield ID */ + EntityID _minefieldID; + + /** entity ID making the request */ + EntityID _requestingEntityID; + + /** request ID */ + uint8_t _requestID; + + /** how many pdus were missing */ + uint8_t _numberOfMissingPdus; + + /** PDU sequence numbers that were missing */ + std::vector _missingPduSequenceNumbers; + + public: + MinefieldResponseNackPdu(); + virtual ~MinefieldResponseNackPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getMinefieldID(); + const EntityID& getMinefieldID() const; + void setMinefieldID(const EntityID& pX); + + EntityID& getRequestingEntityID(); + const EntityID& getRequestingEntityID() const; + void setRequestingEntityID(const EntityID& pX); + + uint8_t getRequestID() const; + void setRequestID(uint8_t pX); + + uint8_t getNumberOfMissingPdus() const; + + std::vector& getMissingPduSequenceNumbers(); + const std::vector& getMissingPduSequenceNumbers() const; + void setMissingPduSequenceNumbers(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldResponseNackPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/MinefieldStatePdu.cpp b/src/dis7/minefield/MinefieldStatePdu.cpp new file mode 100644 index 00000000..8d58eb2b --- /dev/null +++ b/src/dis7/minefield/MinefieldStatePdu.cpp @@ -0,0 +1,267 @@ +#include "dis7/MinefieldStatePdu.h" + +using namespace DIS; + +MinefieldStatePdu::MinefieldStatePdu() + : MinefieldFamilyPdu(), + _minefieldID(), + _minefieldSequence(0), + _forceID(0), + _numberOfPerimeterPoints(0), + _minefieldType(), + _numberOfMineTypes(0), + _minefieldLocation(), + _minefieldOrientation(), + _appearance(0), + _protocolMode(0) { + setPduType(37); +} + +MinefieldStatePdu::~MinefieldStatePdu() { + _perimeterPoints.clear(); + _mineType.clear(); +} + +MinefieldIdentifier& MinefieldStatePdu::getMinefieldID() { + return _minefieldID; +} + +const MinefieldIdentifier& MinefieldStatePdu::getMinefieldID() const { + return _minefieldID; +} + +void MinefieldStatePdu::setMinefieldID(const MinefieldIdentifier& pX) { + _minefieldID = pX; +} + +uint16_t MinefieldStatePdu::getMinefieldSequence() const { + return _minefieldSequence; +} + +void MinefieldStatePdu::setMinefieldSequence(uint16_t pX) { + _minefieldSequence = pX; +} + +uint8_t MinefieldStatePdu::getForceID() const { return _forceID; } + +void MinefieldStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t MinefieldStatePdu::getNumberOfPerimeterPoints() const { + return _perimeterPoints.size(); +} + +EntityType& MinefieldStatePdu::getMinefieldType() { return _minefieldType; } + +const EntityType& MinefieldStatePdu::getMinefieldType() const { + return _minefieldType; +} + +void MinefieldStatePdu::setMinefieldType(const EntityType& pX) { + _minefieldType = pX; +} + +uint16_t MinefieldStatePdu::getNumberOfMineTypes() const { + return _mineType.size(); +} + +Vector3Double& MinefieldStatePdu::getMinefieldLocation() { + return _minefieldLocation; +} + +const Vector3Double& MinefieldStatePdu::getMinefieldLocation() const { + return _minefieldLocation; +} + +void MinefieldStatePdu::setMinefieldLocation(const Vector3Double& pX) { + _minefieldLocation = pX; +} + +EulerAngles& MinefieldStatePdu::getMinefieldOrientation() { + return _minefieldOrientation; +} + +const EulerAngles& MinefieldStatePdu::getMinefieldOrientation() const { + return _minefieldOrientation; +} + +void MinefieldStatePdu::setMinefieldOrientation(const EulerAngles& pX) { + _minefieldOrientation = pX; +} + +uint16_t MinefieldStatePdu::getAppearance() const { return _appearance; } + +void MinefieldStatePdu::setAppearance(uint16_t pX) { _appearance = pX; } + +uint16_t MinefieldStatePdu::getProtocolMode() const { + return _protocolMode; +} + +void MinefieldStatePdu::setProtocolMode(uint16_t pX) { + _protocolMode = pX; +} + +std::vector& MinefieldStatePdu::getPerimeterPoints() { + return _perimeterPoints; +} + +const std::vector& MinefieldStatePdu::getPerimeterPoints() const { + return _perimeterPoints; +} + +void MinefieldStatePdu::setPerimeterPoints( + const std::vector& pX) { + _perimeterPoints = pX; +} + +std::vector& MinefieldStatePdu::getMineType() { return _mineType; } + +const std::vector& MinefieldStatePdu::getMineType() const { + return _mineType; +} + +void MinefieldStatePdu::setMineType(const std::vector& pX) { + _mineType = pX; +} + +void MinefieldStatePdu::marshal(DataStream& dataStream) const { + MinefieldFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _minefieldID.marshal(dataStream); + dataStream << _minefieldSequence; + dataStream << _forceID; + dataStream << (uint8_t)_perimeterPoints.size(); + _minefieldType.marshal(dataStream); + dataStream << (uint16_t)_mineType.size(); + _minefieldLocation.marshal(dataStream); + _minefieldOrientation.marshal(dataStream); + dataStream << _appearance; + dataStream << _protocolMode; + + for (size_t idx = 0; idx < _perimeterPoints.size(); idx++) { + Vector2Float x = _perimeterPoints[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _mineType.size(); idx++) { + EntityType x = _mineType[idx]; + x.marshal(dataStream); + } +} + +void MinefieldStatePdu::unmarshal(DataStream& dataStream) { + MinefieldFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _minefieldID.unmarshal(dataStream); + dataStream >> _minefieldSequence; + dataStream >> _forceID; + dataStream >> _numberOfPerimeterPoints; + _minefieldType.unmarshal(dataStream); + dataStream >> _numberOfMineTypes; + _minefieldLocation.unmarshal(dataStream); + _minefieldOrientation.unmarshal(dataStream); + dataStream >> _appearance; + dataStream >> _protocolMode; + + _perimeterPoints.clear(); + for (size_t idx = 0; idx < _numberOfPerimeterPoints; idx++) { + Vector2Float x; + x.unmarshal(dataStream); + _perimeterPoints.push_back(x); + } + + _mineType.clear(); + for (size_t idx = 0; idx < _numberOfMineTypes; idx++) { + EntityType x; + x.unmarshal(dataStream); + _mineType.push_back(x); + } +} + +bool MinefieldStatePdu::operator==(const MinefieldStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = MinefieldFamilyPdu::operator==(rhs); + + if (!(_minefieldID == rhs._minefieldID)) ivarsEqual = false; + if (!(_minefieldSequence == rhs._minefieldSequence)) ivarsEqual = false; + if (!(_forceID == rhs._forceID)) ivarsEqual = false; + if (!(_minefieldType == rhs._minefieldType)) ivarsEqual = false; + if (!(_minefieldLocation == rhs._minefieldLocation)) ivarsEqual = false; + if (!(_minefieldOrientation == rhs._minefieldOrientation)) ivarsEqual = false; + if (!(_appearance == rhs._appearance)) ivarsEqual = false; + if (!(_protocolMode == rhs._protocolMode)) ivarsEqual = false; + + for (size_t idx = 0; idx < _perimeterPoints.size(); idx++) { + if (!(_perimeterPoints[idx] == rhs._perimeterPoints[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _mineType.size(); idx++) { + if (!(_mineType[idx] == rhs._mineType[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int MinefieldStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = MinefieldFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID + marshalSize = marshalSize + 2; // _minefieldSequence + marshalSize = marshalSize + 1; // _forceID + marshalSize = marshalSize + 1; // _numberOfPerimeterPoints + marshalSize = + marshalSize + _minefieldType.getMarshalledSize(); // _minefieldType + marshalSize = marshalSize + 2; // _numberOfMineTypes + marshalSize = marshalSize + + _minefieldLocation.getMarshalledSize(); // _minefieldLocation + marshalSize = + marshalSize + + _minefieldOrientation.getMarshalledSize(); // _minefieldOrientation + marshalSize = marshalSize + 2; // _appearance + marshalSize = marshalSize + 2; // _protocolMode + + for (uint64_t idx = 0; idx < _perimeterPoints.size(); idx++) { + Vector2Float listElement = _perimeterPoints[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _mineType.size(); idx++) { + EntityType listElement = _mineType[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/MinefieldStatePdu.h b/src/dis7/minefield/MinefieldStatePdu.h new file mode 100644 index 00000000..5838a2d7 --- /dev/null +++ b/src/dis7/minefield/MinefieldStatePdu.h @@ -0,0 +1,143 @@ +#pragma once + +#include + +#include "dis7/EntityType.h" +#include "dis7/EulerAngles.h" +#include "dis7/MinefieldFamilyPdu.h" +#include "dis7/MinefieldIdentifier.h" +#include "dis7/Vector2Float.h" +#include "dis7/Vector3Double.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// information about the complete minefield. The minefield presence, perimiter, +// etc. Section 7.9.2 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT MinefieldStatePdu : public MinefieldFamilyPdu { + protected: + /** Minefield ID */ + MinefieldIdentifier _minefieldID; + + /** Minefield sequence */ + uint16_t _minefieldSequence; + + /** force ID */ + uint8_t _forceID; + + /** Number of permieter points */ + uint8_t _numberOfPerimeterPoints; + + /** type of minefield */ + EntityType _minefieldType; + + /** how many mine types */ + uint16_t _numberOfMineTypes; + + /** location of center of minefield in world coords */ + Vector3Double _minefieldLocation; + + /** orientation of minefield */ + EulerAngles _minefieldOrientation; + + /** appearance bitflags */ + uint16_t _appearance; + + /** protocolMode. First two bits are the protocol mode, 14 bits reserved. */ + uint16_t _protocolMode; + + /** perimeter points for the minefield */ + std::vector _perimeterPoints; + + /** Type of mines */ + std::vector _mineType; + + public: + MinefieldStatePdu(); + virtual ~MinefieldStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + MinefieldIdentifier& getMinefieldID(); + const MinefieldIdentifier& getMinefieldID() const; + void setMinefieldID(const MinefieldIdentifier& pX); + + uint16_t getMinefieldSequence() const; + void setMinefieldSequence(uint16_t pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getNumberOfPerimeterPoints() const; + + EntityType& getMinefieldType(); + const EntityType& getMinefieldType() const; + void setMinefieldType(const EntityType& pX); + + uint16_t getNumberOfMineTypes() const; + + Vector3Double& getMinefieldLocation(); + const Vector3Double& getMinefieldLocation() const; + void setMinefieldLocation(const Vector3Double& pX); + + EulerAngles& getMinefieldOrientation(); + const EulerAngles& getMinefieldOrientation() const; + void setMinefieldOrientation(const EulerAngles& pX); + + uint16_t getAppearance() const; + void setAppearance(uint16_t pX); + + uint16_t getProtocolMode() const; + void setProtocolMode(uint16_t pX); + + std::vector& getPerimeterPoints(); + const std::vector& getPerimeterPoints() const; + void setPerimeterPoints(const std::vector& pX); + + std::vector& getMineType(); + const std::vector& getMineType() const; + void setMineType(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MinefieldStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/minefield/Vector2Float.cpp b/src/dis7/minefield/Vector2Float.cpp new file mode 100644 index 00000000..a1ba65dd --- /dev/null +++ b/src/dis7/minefield/Vector2Float.cpp @@ -0,0 +1,73 @@ +#include "dis7/Vector2Float.h" + +using namespace DIS; + +Vector2Float::Vector2Float() : _x(0.0), _y(0.0) {} + +Vector2Float::~Vector2Float() {} + +float Vector2Float::getX() const { return _x; } + +void Vector2Float::setX(float pX) { _x = pX; } + +float Vector2Float::getY() const { return _y; } + +void Vector2Float::setY(float pX) { _y = pX; } + +void Vector2Float::marshal(DataStream& dataStream) const { + dataStream << _x; + dataStream << _y; +} + +void Vector2Float::unmarshal(DataStream& dataStream) { + dataStream >> _x; + dataStream >> _y; +} + +bool Vector2Float::operator==(const Vector2Float& rhs) const { + bool ivarsEqual = true; + + if (!(_x == rhs._x)) ivarsEqual = false; + if (!(_y == rhs._y)) ivarsEqual = false; + + return ivarsEqual; +} + +int Vector2Float::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _x + marshalSize = marshalSize + 4; // _y + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/Vector2Float.h b/src/dis7/minefield/Vector2Float.h similarity index 77% rename from src/dis7/Vector2Float.h rename to src/dis7/minefield/Vector2Float.h index e192d75e..cf10bb59 100644 --- a/src/dis7/Vector2Float.h +++ b/src/dis7/minefield/Vector2Float.h @@ -1,52 +1,48 @@ #pragma once -#include -#include +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" - -namespace DIS -{ +namespace DIS { // Two floating point values, x, y -// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All rights reserved. +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. // // @author DMcG, jkg -class OPENDIS7_EXPORT Vector2Float -{ -protected: +class OPENDIS7_EXPORT Vector2Float { + protected: /** X value */ - float _x; + float _x; /** y Value */ - float _y; - + float _y; public: - Vector2Float(); - virtual ~Vector2Float(); - - virtual void marshal(DataStream& dataStream) const; - virtual void unmarshal(DataStream& dataStream); + Vector2Float(); + virtual ~Vector2Float(); - float getX() const; - void setX(float pX); + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); - float getY() const; - void setY(float pX); + float getX() const; + void setX(float pX); + float getY() const; + void setY(float pX); -virtual int getMarshalledSize() const; + virtual int getMarshalledSize() const; - bool operator ==(const Vector2Float& rhs) const; + bool operator==(const Vector2Float& rhs) const; }; -} +} // namespace DIS // Copyright (c) 1995-2009 held by the author(s). All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// +// // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright @@ -59,7 +55,7 @@ virtual int getMarshalledSize() const; // nor the names of its contributors may be used to endorse or // promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/src/dis7/radio_communications/CMakeLists.txt b/src/dis7/radio_communications/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/radio_communications/IntercomSignalPdu.cpp b/src/dis7/radio_communications/IntercomSignalPdu.cpp new file mode 100644 index 00000000..d38e3b73 --- /dev/null +++ b/src/dis7/radio_communications/IntercomSignalPdu.cpp @@ -0,0 +1,161 @@ +#include "dis7/IntercomSignalPdu.h" + +using namespace DIS; + +IntercomSignalPdu::IntercomSignalPdu() + : RadioCommunicationsFamilyPdu(), + _entityID(), + _communicationsDeviceID(0), + _encodingScheme(0), + _tdlType(0), + _sampleRate(0), + _dataLength(0), + _samples(0) { + setPduType(31); +} + +IntercomSignalPdu::~IntercomSignalPdu() { _data.clear(); } + +EntityID& IntercomSignalPdu::getEntityID() { return _entityID; } + +const EntityID& IntercomSignalPdu::getEntityID() const { return _entityID; } + +void IntercomSignalPdu::setEntityID(const EntityID& pX) { _entityID = pX; } + +uint16_t IntercomSignalPdu::getCommunicationsDeviceID() const { + return _communicationsDeviceID; +} + +void IntercomSignalPdu::setCommunicationsDeviceID(uint16_t pX) { + _communicationsDeviceID = pX; +} + +uint16_t IntercomSignalPdu::getEncodingScheme() const { + return _encodingScheme; +} + +void IntercomSignalPdu::setEncodingScheme(uint16_t pX) { + _encodingScheme = pX; +} + +uint16_t IntercomSignalPdu::getTdlType() const { return _tdlType; } + +void IntercomSignalPdu::setTdlType(uint16_t pX) { _tdlType = pX; } + +uint32_t IntercomSignalPdu::getSampleRate() const { return _sampleRate; } + +void IntercomSignalPdu::setSampleRate(uint32_t pX) { _sampleRate = pX; } + +uint16_t IntercomSignalPdu::getDataLength() const { return _data.size(); } + +uint16_t IntercomSignalPdu::getSamples() const { return _samples; } + +void IntercomSignalPdu::setSamples(uint16_t pX) { _samples = pX; } + +std::vector& IntercomSignalPdu::getData() { return _data; } + +const std::vector& IntercomSignalPdu::getData() const { return _data; } + +void IntercomSignalPdu::setData(const std::vector& pX) { _data = pX; } + +void IntercomSignalPdu::marshal(DataStream& dataStream) const { + RadioCommunicationsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _entityID.marshal(dataStream); + dataStream << _communicationsDeviceID; + dataStream << _encodingScheme; + dataStream << _tdlType; + dataStream << _sampleRate; + dataStream << (uint16_t)_data.size(); + dataStream << _samples; + + for (auto& byte : _data) { + dataStream << byte; + } +} + +void IntercomSignalPdu::unmarshal(DataStream& dataStream) { + RadioCommunicationsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _entityID.unmarshal(dataStream); + dataStream >> _communicationsDeviceID; + dataStream >> _encodingScheme; + dataStream >> _tdlType; + dataStream >> _sampleRate; + dataStream >> _dataLength; + dataStream >> _samples; + + _data.clear(); + for (auto idx = 0; idx < _dataLength; idx++) { + uint8_t x; + dataStream >> x; + _data.push_back(x); + } +} + +bool IntercomSignalPdu::operator==(const IntercomSignalPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); + + if (!(_entityID == rhs._entityID)) ivarsEqual = false; + if (!(_communicationsDeviceID == rhs._communicationsDeviceID)) + ivarsEqual = false; + if (!(_encodingScheme == rhs._encodingScheme)) ivarsEqual = false; + if (!(_tdlType == rhs._tdlType)) ivarsEqual = false; + if (!(_sampleRate == rhs._sampleRate)) ivarsEqual = false; + if (!(_samples == rhs._samples)) ivarsEqual = false; + + for (size_t idx = 0; idx < _data.size(); idx++) { + if (!(_data[idx] == rhs._data[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int IntercomSignalPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); + marshalSize += _entityID.getMarshalledSize(); // _entityID + marshalSize += 2; // _communicationsDeviceID + marshalSize += 2; // _encodingScheme + marshalSize += 2; // _tdlType + marshalSize += 4; // _sampleRate + marshalSize += 2; // _dataLength + marshalSize += 2; // _samples + marshalSize += _data.size(); + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/radio_communications/IntercomSignalPdu.h b/src/dis7/radio_communications/IntercomSignalPdu.h new file mode 100644 index 00000000..815a5822 --- /dev/null +++ b/src/dis7/radio_communications/IntercomSignalPdu.h @@ -0,0 +1,111 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/RadioCommunicationsFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Actual transmission of intercome voice data. Section 7.7.5. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT IntercomSignalPdu : public RadioCommunicationsFamilyPdu { + protected: + /** entity ID */ + EntityID _entityID; + + /** ID of communications device */ + uint16_t _communicationsDeviceID; + + /** encoding scheme */ + uint16_t _encodingScheme; + + /** tactical data link type */ + uint16_t _tdlType; + + /** sample rate */ + uint32_t _sampleRate; + + /** data length */ + uint16_t _dataLength; + + /** samples */ + uint16_t _samples; + + /** data bytes */ + std::vector _data; + + public: + IntercomSignalPdu(); + virtual ~IntercomSignalPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityID(); + const EntityID& getEntityID() const; + void setEntityID(const EntityID& pX); + + uint16_t getCommunicationsDeviceID() const; + void setCommunicationsDeviceID(uint16_t pX); + + uint16_t getEncodingScheme() const; + void setEncodingScheme(uint16_t pX); + + uint16_t getTdlType() const; + void setTdlType(uint16_t pX); + + uint32_t getSampleRate() const; + void setSampleRate(uint32_t pX); + + uint16_t getDataLength() const; + + uint16_t getSamples() const; + void setSamples(uint16_t pX); + + std::vector& getData(); + const std::vector& getData() const; + void setData(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const IntercomSignalPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/radio_communications/RadioCommunicationsFamilyPdu.cpp b/src/dis7/radio_communications/RadioCommunicationsFamilyPdu.cpp new file mode 100644 index 00000000..bef5da9e --- /dev/null +++ b/src/dis7/radio_communications/RadioCommunicationsFamilyPdu.cpp @@ -0,0 +1,92 @@ +#include "dis7/RadioCommunicationsFamilyPdu.h" + +using namespace DIS; + +RadioCommunicationsFamilyPdu::RadioCommunicationsFamilyPdu() + : Pdu(), _entityId(), _radioId(0) { + setProtocolFamily(4); +} + +RadioCommunicationsFamilyPdu::~RadioCommunicationsFamilyPdu() {} + +EntityID& RadioCommunicationsFamilyPdu::getEntityId() { return _entityId; } + +const EntityID& RadioCommunicationsFamilyPdu::getEntityId() const { + return _entityId; +} + +void RadioCommunicationsFamilyPdu::setEntityId(const EntityID& pX) { + _entityId = pX; +} + +uint16_t RadioCommunicationsFamilyPdu::getRadioId() const { + return _radioId; +} + +void RadioCommunicationsFamilyPdu::setRadioId(uint16_t pX) { + _radioId = pX; +} + +void RadioCommunicationsFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first + _entityId.marshal(dataStream); + dataStream << _radioId; +} + +void RadioCommunicationsFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first + _entityId.unmarshal(dataStream); + dataStream >> _radioId; +} + +bool RadioCommunicationsFamilyPdu::operator==( + const RadioCommunicationsFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + if (!(_entityId == rhs._entityId)) ivarsEqual = false; + if (!(_radioId == rhs._radioId)) ivarsEqual = false; + + return ivarsEqual; +} + +int RadioCommunicationsFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + marshalSize = marshalSize + _entityId.getMarshalledSize(); // _entityId + marshalSize = marshalSize + 2; // _radioId + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/radio_communications/RadioCommunicationsFamilyPdu.h b/src/dis7/radio_communications/RadioCommunicationsFamilyPdu.h new file mode 100644 index 00000000..cafa5853 --- /dev/null +++ b/src/dis7/radio_communications/RadioCommunicationsFamilyPdu.h @@ -0,0 +1,73 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Abstract superclass for radio communications PDUs. Section 7.7 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RadioCommunicationsFamilyPdu : public Pdu { + protected: + /** ID of the entitythat is the source of the communication */ + EntityID _entityId; + + /** particular radio within an entity */ + uint16_t _radioId; + + public: + RadioCommunicationsFamilyPdu(); + virtual ~RadioCommunicationsFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getEntityId(); + const EntityID& getEntityId() const; + void setEntityId(const EntityID& pX); + + uint16_t getRadioId() const; + void setRadioId(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RadioCommunicationsFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/radio_communications/ReceiverPdu.cpp b/src/dis7/radio_communications/ReceiverPdu.cpp new file mode 100644 index 00000000..f3c06d41 --- /dev/null +++ b/src/dis7/radio_communications/ReceiverPdu.cpp @@ -0,0 +1,124 @@ +#include "dis7/ReceiverPdu.h" + +using namespace DIS; + +ReceiverPdu::ReceiverPdu() + : RadioCommunicationsFamilyPdu(), + _receiverState(0), + _padding1(0), + _receivedPower(0.0), + _transmitterEntityId(), + _transmitterRadioId(0) { + setPduType(27); +} + +ReceiverPdu::~ReceiverPdu() {} + +uint16_t ReceiverPdu::getReceiverState() const { return _receiverState; } + +void ReceiverPdu::setReceiverState(uint16_t pX) { _receiverState = pX; } + +uint16_t ReceiverPdu::getPadding1() const { return _padding1; } + +void ReceiverPdu::setPadding1(uint16_t pX) { _padding1 = pX; } + +float ReceiverPdu::getReceivedPower() const { return _receivedPower; } + +void ReceiverPdu::setReceivedPower(float pX) { _receivedPower = pX; } + +EntityID& ReceiverPdu::getTransmitterEntityId() { return _transmitterEntityId; } + +const EntityID& ReceiverPdu::getTransmitterEntityId() const { + return _transmitterEntityId; +} + +void ReceiverPdu::setTransmitterEntityId(const EntityID& pX) { + _transmitterEntityId = pX; +} + +uint16_t ReceiverPdu::getTransmitterRadioId() const { + return _transmitterRadioId; +} + +void ReceiverPdu::setTransmitterRadioId(uint16_t pX) { + _transmitterRadioId = pX; +} + +void ReceiverPdu::marshal(DataStream& dataStream) const { + RadioCommunicationsFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _receiverState; + dataStream << _padding1; + dataStream << _receivedPower; + _transmitterEntityId.marshal(dataStream); + dataStream << _transmitterRadioId; +} + +void ReceiverPdu::unmarshal(DataStream& dataStream) { + RadioCommunicationsFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _receiverState; + dataStream >> _padding1; + dataStream >> _receivedPower; + _transmitterEntityId.unmarshal(dataStream); + dataStream >> _transmitterRadioId; +} + +bool ReceiverPdu::operator==(const ReceiverPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs); + + if (!(_receiverState == rhs._receiverState)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_receivedPower == rhs._receivedPower)) ivarsEqual = false; + if (!(_transmitterEntityId == rhs._transmitterEntityId)) ivarsEqual = false; + if (!(_transmitterRadioId == rhs._transmitterRadioId)) ivarsEqual = false; + + return ivarsEqual; +} + +int ReceiverPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 2; // _receiverState + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 4; // _receivedPoser + marshalSize = + marshalSize + + _transmitterEntityId.getMarshalledSize(); // _transmitterEntityId + marshalSize = marshalSize + 2; // _transmitterRadioId + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/radio_communications/ReceiverPdu.h b/src/dis7/radio_communications/ReceiverPdu.h new file mode 100644 index 00000000..032d3712 --- /dev/null +++ b/src/dis7/radio_communications/ReceiverPdu.h @@ -0,0 +1,91 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/RadioCommunicationsFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Communication of a receiver state. Section 7.7.4 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ReceiverPdu : public RadioCommunicationsFamilyPdu { + protected: + /** encoding scheme used, and enumeration */ + uint16_t _receiverState; + + /** padding */ + uint16_t _padding1; + + /** received power */ + float _receivedPower; + + /** ID of transmitter */ + EntityID _transmitterEntityId; + + /** ID of transmitting radio */ + uint16_t _transmitterRadioId; + + public: + ReceiverPdu(); + virtual ~ReceiverPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getReceiverState() const; + void setReceiverState(uint16_t pX); + + uint16_t getPadding1() const; + void setPadding1(uint16_t pX); + + float getReceivedPower() const; + void setReceivedPower(float pX); + + EntityID& getTransmitterEntityId(); + const EntityID& getTransmitterEntityId() const; + void setTransmitterEntityId(const EntityID& pX); + + uint16_t getTransmitterRadioId() const; + void setTransmitterRadioId(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ReceiverPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/AcknowledgePdu.cpp b/src/dis7/simulation_management/AcknowledgePdu.cpp new file mode 100644 index 00000000..9fb63852 --- /dev/null +++ b/src/dis7/simulation_management/AcknowledgePdu.cpp @@ -0,0 +1,125 @@ +#include "dis7/AcknowledgePdu.h" + +using namespace DIS; + +AcknowledgePdu::AcknowledgePdu() + : SimulationManagementFamilyPdu(), + _originatingID(), + _receivingID(), + _acknowledgeFlag(0), + _responseFlag(0), + _requestID(0) { + setPduType(15); +} + +AcknowledgePdu::~AcknowledgePdu() {} + +EntityID& AcknowledgePdu::getOriginatingID() { return _originatingID; } + +const EntityID& AcknowledgePdu::getOriginatingID() const { + return _originatingID; +} + +void AcknowledgePdu::setOriginatingID(const EntityID& pX) { + _originatingID = pX; +} + +EntityID& AcknowledgePdu::getReceivingID() { return _receivingID; } + +const EntityID& AcknowledgePdu::getReceivingID() const { return _receivingID; } + +void AcknowledgePdu::setReceivingID(const EntityID& pX) { _receivingID = pX; } + +uint16_t AcknowledgePdu::getAcknowledgeFlag() const { + return _acknowledgeFlag; +} + +void AcknowledgePdu::setAcknowledgeFlag(uint16_t pX) { + _acknowledgeFlag = pX; +} + +uint16_t AcknowledgePdu::getResponseFlag() const { return _responseFlag; } + +void AcknowledgePdu::setResponseFlag(uint16_t pX) { _responseFlag = pX; } + +uint32_t AcknowledgePdu::getRequestID() const { return _requestID; } + +void AcknowledgePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void AcknowledgePdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _originatingID.marshal(dataStream); + _receivingID.marshal(dataStream); + dataStream << _acknowledgeFlag; + dataStream << _responseFlag; + dataStream << _requestID; +} + +void AcknowledgePdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _originatingID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + dataStream >> _acknowledgeFlag; + dataStream >> _responseFlag; + dataStream >> _requestID; +} + +bool AcknowledgePdu::operator==(const AcknowledgePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_originatingID == rhs._originatingID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_acknowledgeFlag == rhs._acknowledgeFlag)) ivarsEqual = false; + if (!(_responseFlag == rhs._responseFlag)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int AcknowledgePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _originatingID.getMarshalledSize(); // _originatingID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = marshalSize + 2; // _acknowledgeFlag + marshalSize = marshalSize + 2; // _responseFlag + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/AcknowledgePdu.h b/src/dis7/simulation_management/AcknowledgePdu.h new file mode 100644 index 00000000..9954c21c --- /dev/null +++ b/src/dis7/simulation_management/AcknowledgePdu.h @@ -0,0 +1,93 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.6. Acknowledge the receipt of a start/resume, stop/freeze, or +// RemoveEntityPDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AcknowledgePdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for originating entity(or simulation) */ + EntityID _originatingID; + + /** Identifier for the receiving entity(or simulation) */ + EntityID _receivingID; + + /** type of message being acknowledged */ + uint16_t _acknowledgeFlag; + + /** Whether or not the receiving entity was able to comply with the request */ + uint16_t _responseFlag; + + /** Request ID that is unique */ + uint32_t _requestID; + + public: + AcknowledgePdu(); + virtual ~AcknowledgePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingID(); + const EntityID& getOriginatingID() const; + void setOriginatingID(const EntityID& pX); + + EntityID& getReceivingID(); + const EntityID& getReceivingID() const; + void setReceivingID(const EntityID& pX); + + uint16_t getAcknowledgeFlag() const; + void setAcknowledgeFlag(uint16_t pX); + + uint16_t getResponseFlag() const; + void setResponseFlag(uint16_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AcknowledgePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/ActionRequestPdu.cpp b/src/dis7/simulation_management/ActionRequestPdu.cpp new file mode 100644 index 00000000..112c553e --- /dev/null +++ b/src/dis7/simulation_management/ActionRequestPdu.cpp @@ -0,0 +1,200 @@ +#include "dis7/ActionRequestPdu.h" + +using namespace DIS; + +ActionRequestPdu::ActionRequestPdu() + : SimulationManagementFamilyPdu(), + _originatingID(), + _receivingID(), + _requestID(0), + _actionID(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(16); +} + +ActionRequestPdu::~ActionRequestPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +EntityID& ActionRequestPdu::getOriginatingID() { return _originatingID; } + +const EntityID& ActionRequestPdu::getOriginatingID() const { + return _originatingID; +} + +void ActionRequestPdu::setOriginatingID(const EntityID& pX) { + _originatingID = pX; +} + +EntityID& ActionRequestPdu::getReceivingID() { return _receivingID; } + +const EntityID& ActionRequestPdu::getReceivingID() const { + return _receivingID; +} + +void ActionRequestPdu::setReceivingID(const EntityID& pX) { _receivingID = pX; } + +uint32_t ActionRequestPdu::getRequestID() const { return _requestID; } + +void ActionRequestPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t ActionRequestPdu::getActionID() const { return _actionID; } + +void ActionRequestPdu::setActionID(uint32_t pX) { _actionID = pX; } + +uint32_t ActionRequestPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t ActionRequestPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& ActionRequestPdu::getFixedDatums() { + return _fixedDatums; +} + +const std::vector& ActionRequestPdu::getFixedDatums() const { + return _fixedDatums; +} + +void ActionRequestPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& ActionRequestPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& ActionRequestPdu::getVariableDatums() const { + return _variableDatums; +} + +void ActionRequestPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void ActionRequestPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _originatingID.marshal(dataStream); + _receivingID.marshal(dataStream); + dataStream << _requestID; + dataStream << _actionID; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void ActionRequestPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _originatingID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + dataStream >> _requestID; + dataStream >> _actionID; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool ActionRequestPdu::operator==(const ActionRequestPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_originatingID == rhs._originatingID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_actionID == rhs._actionID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ActionRequestPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _originatingID.getMarshalledSize(); // _originatingID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _actionID + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/ActionRequestPdu.h b/src/dis7/simulation_management/ActionRequestPdu.h new file mode 100644 index 00000000..097e5134 --- /dev/null +++ b/src/dis7/simulation_management/ActionRequestPdu.h @@ -0,0 +1,116 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.7. Request from simulation manager to a managed entity to perform +// a specified action. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ActionRequestPdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for originating entity(or simulation) */ + EntityID _originatingID; + + /** Identifier for the receiving entity(or simulation) */ + EntityID _receivingID; + + /** identifies the request being made by the simulaton manager */ + uint32_t _requestID; + + /** identifies the particular action being requested(see Section 7 of + * SISO-REF-010). */ + uint32_t _actionID; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + ActionRequestPdu(); + virtual ~ActionRequestPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingID(); + const EntityID& getOriginatingID() const; + void setOriginatingID(const EntityID& pX); + + EntityID& getReceivingID(); + const EntityID& getReceivingID() const; + void setReceivingID(const EntityID& pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getActionID() const; + void setActionID(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ActionRequestPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/ActionResponsePdu.cpp b/src/dis7/simulation_management/ActionResponsePdu.cpp new file mode 100644 index 00000000..39ea4963 --- /dev/null +++ b/src/dis7/simulation_management/ActionResponsePdu.cpp @@ -0,0 +1,207 @@ +#include "dis7/ActionResponsePdu.h" + +using namespace DIS; + +ActionResponsePdu::ActionResponsePdu() + : SimulationManagementFamilyPdu(), + _originatingID(), + _receivingID(), + _requestID(0), + _requestStatus(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(17); +} + +ActionResponsePdu::~ActionResponsePdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +EntityID& ActionResponsePdu::getOriginatingID() { return _originatingID; } + +const EntityID& ActionResponsePdu::getOriginatingID() const { + return _originatingID; +} + +void ActionResponsePdu::setOriginatingID(const EntityID& pX) { + _originatingID = pX; +} + +EntityID& ActionResponsePdu::getReceivingID() { return _receivingID; } + +const EntityID& ActionResponsePdu::getReceivingID() const { + return _receivingID; +} + +void ActionResponsePdu::setReceivingID(const EntityID& pX) { + _receivingID = pX; +} + +uint32_t ActionResponsePdu::getRequestID() const { return _requestID; } + +void ActionResponsePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t ActionResponsePdu::getRequestStatus() const { + return _requestStatus; +} + +void ActionResponsePdu::setRequestStatus(uint32_t pX) { + _requestStatus = pX; +} + +uint32_t ActionResponsePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t ActionResponsePdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& ActionResponsePdu::getFixedDatums() { + return _fixedDatums; +} + +const std::vector& ActionResponsePdu::getFixedDatums() const { + return _fixedDatums; +} + +void ActionResponsePdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& ActionResponsePdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& ActionResponsePdu::getVariableDatums() const { + return _variableDatums; +} + +void ActionResponsePdu::setVariableDatums( + const std::vector& pX) { + _variableDatums = pX; +} + +void ActionResponsePdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _originatingID.marshal(dataStream); + _receivingID.marshal(dataStream); + dataStream << _requestID; + dataStream << _requestStatus; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void ActionResponsePdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _originatingID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + dataStream >> _requestID; + dataStream >> _requestStatus; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool ActionResponsePdu::operator==(const ActionResponsePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_originatingID == rhs._originatingID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_requestStatus == rhs._requestStatus)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ActionResponsePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _originatingID.getMarshalledSize(); // _originatingID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _requestStatus + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/ActionResponsePdu.h b/src/dis7/simulation_management/ActionResponsePdu.h new file mode 100644 index 00000000..736bd21c --- /dev/null +++ b/src/dis7/simulation_management/ActionResponsePdu.h @@ -0,0 +1,114 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.8. response to an action request PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ActionResponsePdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for originating entity(or simulation) */ + EntityID _originatingID; + + /** Identifier for the receiving entity(or simulation) */ + EntityID _receivingID; + + /** Request ID that is unique */ + uint32_t _requestID; + + /** Status of response */ + uint32_t _requestStatus; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + ActionResponsePdu(); + virtual ~ActionResponsePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingID(); + const EntityID& getOriginatingID() const; + void setOriginatingID(const EntityID& pX); + + EntityID& getReceivingID(); + const EntityID& getReceivingID() const; + void setReceivingID(const EntityID& pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getRequestStatus() const; + void setRequestStatus(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ActionResponsePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/CMakeLists.txt b/src/dis7/simulation_management/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/simulation_management/CommentPdu.cpp b/src/dis7/simulation_management/CommentPdu.cpp new file mode 100644 index 00000000..d1e342bd --- /dev/null +++ b/src/dis7/simulation_management/CommentPdu.cpp @@ -0,0 +1,150 @@ +#include "dis7/CommentPdu.h" + +using namespace DIS; + +CommentPdu::CommentPdu() + : SimulationManagementFamilyPdu(), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(22); +} + +CommentPdu::~CommentPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t CommentPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t CommentPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& CommentPdu::getFixedDatums() { return _fixedDatums; } + +const std::vector& CommentPdu::getFixedDatums() const { + return _fixedDatums; +} + +void CommentPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& CommentPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& CommentPdu::getVariableDatums() const { + return _variableDatums; +} + +void CommentPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void CommentPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void CommentPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool CommentPdu::operator==(const CommentPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int CommentPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/CommentPdu.h b/src/dis7/simulation_management/CommentPdu.h new file mode 100644 index 00000000..33c53912 --- /dev/null +++ b/src/dis7/simulation_management/CommentPdu.h @@ -0,0 +1,88 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Arbitrary messages can be entered into the data stream via use of this PDU. +// Section 7.5.13 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT CommentPdu : public SimulationManagementFamilyPdu { + protected: + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + CommentPdu(); + virtual ~CommentPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CommentPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/CreateEntityPdu.cpp b/src/dis7/simulation_management/CreateEntityPdu.cpp new file mode 100644 index 00000000..e40c01c0 --- /dev/null +++ b/src/dis7/simulation_management/CreateEntityPdu.cpp @@ -0,0 +1,103 @@ +#include "dis7/CreateEntityPdu.h" + +using namespace DIS; + +CreateEntityPdu::CreateEntityPdu() + : SimulationManagementFamilyPdu(), + _originatingID(), + _receivingID(), + _requestID(0) { + setPduType(11); +} + +CreateEntityPdu::~CreateEntityPdu() {} + +EntityID& CreateEntityPdu::getOriginatingID() { return _originatingID; } + +const EntityID& CreateEntityPdu::getOriginatingID() const { + return _originatingID; +} + +void CreateEntityPdu::setOriginatingID(const EntityID& pX) { + _originatingID = pX; +} + +EntityID& CreateEntityPdu::getReceivingID() { return _receivingID; } + +const EntityID& CreateEntityPdu::getReceivingID() const { return _receivingID; } + +void CreateEntityPdu::setReceivingID(const EntityID& pX) { _receivingID = pX; } + +uint32_t CreateEntityPdu::getRequestID() const { return _requestID; } + +void CreateEntityPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void CreateEntityPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _originatingID.marshal(dataStream); + _receivingID.marshal(dataStream); + dataStream << _requestID; +} + +void CreateEntityPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _originatingID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + dataStream >> _requestID; +} + +bool CreateEntityPdu::operator==(const CreateEntityPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_originatingID == rhs._originatingID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int CreateEntityPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _originatingID.getMarshalledSize(); // _originatingID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/CreateEntityPdu.h b/src/dis7/simulation_management/CreateEntityPdu.h new file mode 100644 index 00000000..4bd2fcab --- /dev/null +++ b/src/dis7/simulation_management/CreateEntityPdu.h @@ -0,0 +1,80 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.2. Create a new entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT CreateEntityPdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for the request */ + EntityID _originatingID; + + /** Identifier for the request */ + EntityID _receivingID; + + /** Identifier for the request. See 6.2.75 */ + uint32_t _requestID; + + public: + CreateEntityPdu(); + virtual ~CreateEntityPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingID(); + const EntityID& getOriginatingID() const; + void setOriginatingID(const EntityID& pX); + + EntityID& getReceivingID(); + const EntityID& getReceivingID() const; + void setReceivingID(const EntityID& pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CreateEntityPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/DataPdu.cpp b/src/dis7/simulation_management/DataPdu.cpp new file mode 100644 index 00000000..fe85139a --- /dev/null +++ b/src/dis7/simulation_management/DataPdu.cpp @@ -0,0 +1,169 @@ +#include "dis7/DataPdu.h" + +using namespace DIS; + +DataPdu::DataPdu() + : SimulationManagementFamilyPdu(), + _requestID(0), + _padding1(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(20); +} + +DataPdu::~DataPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t DataPdu::getRequestID() const { return _requestID; } + +void DataPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t DataPdu::getPadding1() const { return _padding1; } + +void DataPdu::setPadding1(uint32_t pX) { _padding1 = pX; } + +uint32_t DataPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t DataPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& DataPdu::getFixedDatums() { return _fixedDatums; } + +const std::vector& DataPdu::getFixedDatums() const { + return _fixedDatums; +} + +void DataPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& DataPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& DataPdu::getVariableDatums() const { + return _variableDatums; +} + +void DataPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void DataPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _padding1; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void DataPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _padding1; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool DataPdu::operator==(const DataPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _padding1 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/DataPdu.h b/src/dis7/simulation_management/DataPdu.h new file mode 100644 index 00000000..081c985b --- /dev/null +++ b/src/dis7/simulation_management/DataPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information issued in response to a data query pdu or a set data pdu is +// communicated using a data pdu. Section 7.5.11 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DataPdu : public SimulationManagementFamilyPdu { + protected: + /** ID of request */ + uint32_t _requestID; + + /** padding */ + uint32_t _padding1; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + DataPdu(); + virtual ~DataPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getPadding1() const; + void setPadding1(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/DataQueryPdu.cpp b/src/dis7/simulation_management/DataQueryPdu.cpp new file mode 100644 index 00000000..c8fdf34c --- /dev/null +++ b/src/dis7/simulation_management/DataQueryPdu.cpp @@ -0,0 +1,169 @@ +#include "dis7/DataQueryPdu.h" + +using namespace DIS; + +DataQueryPdu::DataQueryPdu() + : SimulationManagementFamilyPdu(), + _requestID(0), + _timeInterval(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(18); +} + +DataQueryPdu::~DataQueryPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t DataQueryPdu::getRequestID() const { return _requestID; } + +void DataQueryPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t DataQueryPdu::getTimeInterval() const { return _timeInterval; } + +void DataQueryPdu::setTimeInterval(uint32_t pX) { _timeInterval = pX; } + +uint32_t DataQueryPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t DataQueryPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& DataQueryPdu::getFixedDatums() { return _fixedDatums; } + +const std::vector& DataQueryPdu::getFixedDatums() const { + return _fixedDatums; +} + +void DataQueryPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& DataQueryPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& DataQueryPdu::getVariableDatums() const { + return _variableDatums; +} + +void DataQueryPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void DataQueryPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _timeInterval; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void DataQueryPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _timeInterval; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool DataQueryPdu::operator==(const DataQueryPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_timeInterval == rhs._timeInterval)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataQueryPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _timeInterval + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/DataQueryPdu.h b/src/dis7/simulation_management/DataQueryPdu.h new file mode 100644 index 00000000..7611cf11 --- /dev/null +++ b/src/dis7/simulation_management/DataQueryPdu.h @@ -0,0 +1,99 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.9. Request for data from an entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DataQueryPdu : public SimulationManagementFamilyPdu { + protected: + /** ID of request */ + uint32_t _requestID; + + /** time issues between issues of Data PDUs. Zero means send once only. */ + uint32_t _timeInterval; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + DataQueryPdu(); + virtual ~DataQueryPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getTimeInterval() const; + void setTimeInterval(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataQueryPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/EventReportPdu.cpp b/src/dis7/simulation_management/EventReportPdu.cpp new file mode 100644 index 00000000..8b4f573e --- /dev/null +++ b/src/dis7/simulation_management/EventReportPdu.cpp @@ -0,0 +1,171 @@ +#include "dis7/EventReportPdu.h" + +using namespace DIS; + +EventReportPdu::EventReportPdu() + : SimulationManagementFamilyPdu(), + _eventType(0), + _padding1(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(21); +} + +EventReportPdu::~EventReportPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t EventReportPdu::getEventType() const { return _eventType; } + +void EventReportPdu::setEventType(uint32_t pX) { _eventType = pX; } + +uint32_t EventReportPdu::getPadding1() const { return _padding1; } + +void EventReportPdu::setPadding1(uint32_t pX) { _padding1 = pX; } + +uint32_t EventReportPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t EventReportPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& EventReportPdu::getFixedDatums() { + return _fixedDatums; +} + +const std::vector& EventReportPdu::getFixedDatums() const { + return _fixedDatums; +} + +void EventReportPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& EventReportPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& EventReportPdu::getVariableDatums() const { + return _variableDatums; +} + +void EventReportPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void EventReportPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _eventType; + dataStream << _padding1; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void EventReportPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _eventType; + dataStream >> _padding1; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool EventReportPdu::operator==(const EventReportPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_eventType == rhs._eventType)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int EventReportPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _eventType + marshalSize = marshalSize + 4; // _padding1 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/EventReportPdu.h b/src/dis7/simulation_management/EventReportPdu.h new file mode 100644 index 00000000..85e6b21b --- /dev/null +++ b/src/dis7/simulation_management/EventReportPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Reports occurance of a significant event to the simulation manager. +// Section 7.5.12. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EventReportPdu : public SimulationManagementFamilyPdu { + protected: + /** Type of event */ + uint32_t _eventType; + + /** padding */ + uint32_t _padding1; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + EventReportPdu(); + virtual ~EventReportPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getEventType() const; + void setEventType(uint32_t pX); + + uint32_t getPadding1() const; + void setPadding1(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EventReportPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/RemoveEntityPdu.cpp b/src/dis7/simulation_management/RemoveEntityPdu.cpp new file mode 100644 index 00000000..dfb0252f --- /dev/null +++ b/src/dis7/simulation_management/RemoveEntityPdu.cpp @@ -0,0 +1,103 @@ +#include "dis7/RemoveEntityPdu.h" + +using namespace DIS; + +RemoveEntityPdu::RemoveEntityPdu() + : SimulationManagementFamilyPdu(), + _originatingID(), + _receivingID(), + _requestID(0) { + setPduType(12); +} + +RemoveEntityPdu::~RemoveEntityPdu() {} + +EntityID& RemoveEntityPdu::getOriginatingID() { return _originatingID; } + +const EntityID& RemoveEntityPdu::getOriginatingID() const { + return _originatingID; +} + +void RemoveEntityPdu::setOriginatingID(const EntityID& pX) { + _originatingID = pX; +} + +EntityID& RemoveEntityPdu::getReceivingID() { return _receivingID; } + +const EntityID& RemoveEntityPdu::getReceivingID() const { return _receivingID; } + +void RemoveEntityPdu::setReceivingID(const EntityID& pX) { _receivingID = pX; } + +uint32_t RemoveEntityPdu::getRequestID() const { return _requestID; } + +void RemoveEntityPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void RemoveEntityPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _originatingID.marshal(dataStream); + _receivingID.marshal(dataStream); + dataStream << _requestID; +} + +void RemoveEntityPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _originatingID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + dataStream >> _requestID; +} + +bool RemoveEntityPdu::operator==(const RemoveEntityPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_originatingID == rhs._originatingID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int RemoveEntityPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _originatingID.getMarshalledSize(); // _originatingID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/RemoveEntityPdu.h b/src/dis7/simulation_management/RemoveEntityPdu.h new file mode 100644 index 00000000..8600229c --- /dev/null +++ b/src/dis7/simulation_management/RemoveEntityPdu.h @@ -0,0 +1,82 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.3 The removal of an entity from an exercise shall be communicated +// with a Remove Entity PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RemoveEntityPdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for originating entity(or simulation) */ + EntityID _originatingID; + + /** Identifier for the receiving entity(or simulation) */ + EntityID _receivingID; + + /** This field shall identify the specific and unique start/resume request + * being made by the SM */ + uint32_t _requestID; + + public: + RemoveEntityPdu(); + virtual ~RemoveEntityPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingID(); + const EntityID& getOriginatingID() const; + void setOriginatingID(const EntityID& pX); + + EntityID& getReceivingID(); + const EntityID& getReceivingID() const; + void setReceivingID(const EntityID& pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RemoveEntityPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/SetDataPdu.cpp b/src/dis7/simulation_management/SetDataPdu.cpp new file mode 100644 index 00000000..0d3d186f --- /dev/null +++ b/src/dis7/simulation_management/SetDataPdu.cpp @@ -0,0 +1,169 @@ +#include "dis7/SetDataPdu.h" + +using namespace DIS; + +SetDataPdu::SetDataPdu() + : SimulationManagementFamilyPdu(), + _requestID(0), + _padding1(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(19); +} + +SetDataPdu::~SetDataPdu() { + _fixedDatums.clear(); + _variableDatums.clear(); +} + +uint32_t SetDataPdu::getRequestID() const { return _requestID; } + +void SetDataPdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t SetDataPdu::getPadding1() const { return _padding1; } + +void SetDataPdu::setPadding1(uint32_t pX) { _padding1 = pX; } + +uint32_t SetDataPdu::getNumberOfFixedDatumRecords() const { + return _fixedDatums.size(); +} + +uint32_t SetDataPdu::getNumberOfVariableDatumRecords() const { + return _variableDatums.size(); +} + +std::vector& SetDataPdu::getFixedDatums() { return _fixedDatums; } + +const std::vector& SetDataPdu::getFixedDatums() const { + return _fixedDatums; +} + +void SetDataPdu::setFixedDatums(const std::vector& pX) { + _fixedDatums = pX; +} + +std::vector& SetDataPdu::getVariableDatums() { + return _variableDatums; +} + +const std::vector& SetDataPdu::getVariableDatums() const { + return _variableDatums; +} + +void SetDataPdu::setVariableDatums(const std::vector& pX) { + _variableDatums = pX; +} + +void SetDataPdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _padding1; + dataStream << (uint32_t)_fixedDatums.size(); + dataStream << (uint32_t)_variableDatums.size(); + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum x = _fixedDatums[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum x = _variableDatums[idx]; + x.marshal(dataStream); + } +} + +void SetDataPdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _padding1; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatums.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatums.push_back(x); + } + + _variableDatums.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatums.push_back(x); + } +} + +bool SetDataPdu::operator==(const SetDataPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatums.size(); idx++) { + if (!(_fixedDatums[idx] == rhs._fixedDatums[idx])) ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatums.size(); idx++) { + if (!(_variableDatums[idx] == rhs._variableDatums[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int SetDataPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _padding1 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatums.size(); idx++) { + FixedDatum listElement = _fixedDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatums.size(); idx++) { + VariableDatum listElement = _variableDatums[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/SetDataPdu.h b/src/dis7/simulation_management/SetDataPdu.h new file mode 100644 index 00000000..bf5eeaa2 --- /dev/null +++ b/src/dis7/simulation_management/SetDataPdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.10. Change state information with the data contained in this. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SetDataPdu : public SimulationManagementFamilyPdu { + protected: + /** ID of request */ + uint32_t _requestID; + + /** padding */ + uint32_t _padding1; + + /** Number of fixed datum records */ + uint32_t _numberOfFixedDatumRecords; + + /** Number of variable datum records */ + uint32_t _numberOfVariableDatumRecords; + + /** variable length list of fixed datums */ + std::vector _fixedDatums; + + /** variable length list of variable length datums */ + std::vector _variableDatums; + + public: + SetDataPdu(); + virtual ~SetDataPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getPadding1() const; + void setPadding1(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatums(); + const std::vector& getFixedDatums() const; + void setFixedDatums(const std::vector& pX); + + std::vector& getVariableDatums(); + const std::vector& getVariableDatums() const; + void setVariableDatums(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SetDataPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/SimulationManagementFamilyPdu.cpp b/src/dis7/simulation_management/SimulationManagementFamilyPdu.cpp new file mode 100644 index 00000000..e6855f05 --- /dev/null +++ b/src/dis7/simulation_management/SimulationManagementFamilyPdu.cpp @@ -0,0 +1,101 @@ +#include "dis7/SimulationManagementFamilyPdu.h" + +using namespace DIS; + +SimulationManagementFamilyPdu::SimulationManagementFamilyPdu() + : Pdu(), _originatingEntityID(), _receivingEntityID() { + setProtocolFamily(5); +} + +SimulationManagementFamilyPdu::~SimulationManagementFamilyPdu() {} + +EntityID& SimulationManagementFamilyPdu::getOriginatingEntityID() { + return _originatingEntityID; +} + +const EntityID& SimulationManagementFamilyPdu::getOriginatingEntityID() const { + return _originatingEntityID; +} + +void SimulationManagementFamilyPdu::setOriginatingEntityID(const EntityID& pX) { + _originatingEntityID = pX; +} + +EntityID& SimulationManagementFamilyPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& SimulationManagementFamilyPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void SimulationManagementFamilyPdu::setReceivingEntityID(const EntityID& pX) { + _receivingEntityID = pX; +} + +void SimulationManagementFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first + _originatingEntityID.marshal(dataStream); + _receivingEntityID.marshal(dataStream); +} + +void SimulationManagementFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first + _originatingEntityID.unmarshal(dataStream); + _receivingEntityID.unmarshal(dataStream); +} + +bool SimulationManagementFamilyPdu::operator==( + const SimulationManagementFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + if (!(_originatingEntityID == rhs._originatingEntityID)) ivarsEqual = false; + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + + return ivarsEqual; +} + +int SimulationManagementFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + marshalSize = + marshalSize + + _originatingEntityID.getMarshalledSize(); // _originatingEntityID + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/SimulationManagementFamilyPdu.h b/src/dis7/simulation_management/SimulationManagementFamilyPdu.h new file mode 100644 index 00000000..6b545f48 --- /dev/null +++ b/src/dis7/simulation_management/SimulationManagementFamilyPdu.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5 Abstract superclass for PDUs relating to the simulation itself. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SimulationManagementFamilyPdu : public Pdu { + protected: + /** Entity that is sending message */ + EntityID _originatingEntityID; + + /** Entity that is intended to receive message */ + EntityID _receivingEntityID; + + public: + SimulationManagementFamilyPdu(); + virtual ~SimulationManagementFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingEntityID(); + const EntityID& getOriginatingEntityID() const; + void setOriginatingEntityID(const EntityID& pX); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SimulationManagementFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/StartResumePdu.cpp b/src/dis7/simulation_management/StartResumePdu.cpp new file mode 100644 index 00000000..64928be0 --- /dev/null +++ b/src/dis7/simulation_management/StartResumePdu.cpp @@ -0,0 +1,135 @@ +#include "dis7/StartResumePdu.h" + +using namespace DIS; + +StartResumePdu::StartResumePdu() + : SimulationManagementFamilyPdu(), + _originatingID(), + _receivingID(), + _realWorldTime(), + _simulationTime(), + _requestID(0) { + setPduType(13); +} + +StartResumePdu::~StartResumePdu() {} + +EntityID& StartResumePdu::getOriginatingID() { return _originatingID; } + +const EntityID& StartResumePdu::getOriginatingID() const { + return _originatingID; +} + +void StartResumePdu::setOriginatingID(const EntityID& pX) { + _originatingID = pX; +} + +EntityID& StartResumePdu::getReceivingID() { return _receivingID; } + +const EntityID& StartResumePdu::getReceivingID() const { return _receivingID; } + +void StartResumePdu::setReceivingID(const EntityID& pX) { _receivingID = pX; } + +ClockTime& StartResumePdu::getRealWorldTime() { return _realWorldTime; } + +const ClockTime& StartResumePdu::getRealWorldTime() const { + return _realWorldTime; +} + +void StartResumePdu::setRealWorldTime(const ClockTime& pX) { + _realWorldTime = pX; +} + +ClockTime& StartResumePdu::getSimulationTime() { return _simulationTime; } + +const ClockTime& StartResumePdu::getSimulationTime() const { + return _simulationTime; +} + +void StartResumePdu::setSimulationTime(const ClockTime& pX) { + _simulationTime = pX; +} + +uint32_t StartResumePdu::getRequestID() const { return _requestID; } + +void StartResumePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void StartResumePdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _originatingID.marshal(dataStream); + _receivingID.marshal(dataStream); + _realWorldTime.marshal(dataStream); + _simulationTime.marshal(dataStream); + dataStream << _requestID; +} + +void StartResumePdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _originatingID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + _realWorldTime.unmarshal(dataStream); + _simulationTime.unmarshal(dataStream); + dataStream >> _requestID; +} + +bool StartResumePdu::operator==(const StartResumePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_originatingID == rhs._originatingID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_realWorldTime == rhs._realWorldTime)) ivarsEqual = false; + if (!(_simulationTime == rhs._simulationTime)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int StartResumePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _originatingID.getMarshalledSize(); // _originatingID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = + marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime + marshalSize = + marshalSize + _simulationTime.getMarshalledSize(); // _simulationTime + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/StartResumePdu.h b/src/dis7/simulation_management/StartResumePdu.h new file mode 100644 index 00000000..137d20ef --- /dev/null +++ b/src/dis7/simulation_management/StartResumePdu.h @@ -0,0 +1,103 @@ +#pragma once + +#include "dis7/ClockTime.h" +#include "dis7/EntityID.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.4. Start or resume an exercise. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT StartResumePdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for originating entity(or simulation) */ + EntityID _originatingID; + + /** Identifier for the receiving entity(or simulation) */ + EntityID _receivingID; + + /** This field shall specify the real-world time (UTC) at which the entity is + * to start/resume in the exercise. This information shall be used by the + * participating simulation applications to start/resume an exercise + * synchronously. This field shall be represented by a Clock Time record + * (see 6.2.16). */ + ClockTime _realWorldTime; + + /** The reference time within a simulation exercise. This time is established + * ahead of time by simulation management and is common to all participants in + * a particular exercise. Simulation time may be either Absolute Time or + * Relative Time. This field shall be represented by a Clock Time record + * (see 6.2.16) */ + ClockTime _simulationTime; + + /** Identifier for the specific and unique start/resume request */ + uint32_t _requestID; + + public: + StartResumePdu(); + virtual ~StartResumePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingID(); + const EntityID& getOriginatingID() const; + void setOriginatingID(const EntityID& pX); + + EntityID& getReceivingID(); + const EntityID& getReceivingID() const; + void setReceivingID(const EntityID& pX); + + ClockTime& getRealWorldTime(); + const ClockTime& getRealWorldTime() const; + void setRealWorldTime(const ClockTime& pX); + + ClockTime& getSimulationTime(); + const ClockTime& getSimulationTime() const; + void setSimulationTime(const ClockTime& pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StartResumePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/StopFreezePdu.cpp b/src/dis7/simulation_management/StopFreezePdu.cpp new file mode 100644 index 00000000..051589fe --- /dev/null +++ b/src/dis7/simulation_management/StopFreezePdu.cpp @@ -0,0 +1,150 @@ +#include "dis7/StopFreezePdu.h" + +using namespace DIS; + +StopFreezePdu::StopFreezePdu() + : SimulationManagementFamilyPdu(), + _originatingID(), + _receivingID(), + _realWorldTime(), + _reason(0), + _frozenBehavior(0), + _padding1(0), + _requestID(0) { + setPduType(14); +} + +StopFreezePdu::~StopFreezePdu() {} + +EntityID& StopFreezePdu::getOriginatingID() { return _originatingID; } + +const EntityID& StopFreezePdu::getOriginatingID() const { + return _originatingID; +} + +void StopFreezePdu::setOriginatingID(const EntityID& pX) { + _originatingID = pX; +} + +EntityID& StopFreezePdu::getReceivingID() { return _receivingID; } + +const EntityID& StopFreezePdu::getReceivingID() const { return _receivingID; } + +void StopFreezePdu::setReceivingID(const EntityID& pX) { _receivingID = pX; } + +ClockTime& StopFreezePdu::getRealWorldTime() { return _realWorldTime; } + +const ClockTime& StopFreezePdu::getRealWorldTime() const { + return _realWorldTime; +} + +void StopFreezePdu::setRealWorldTime(const ClockTime& pX) { + _realWorldTime = pX; +} + +uint8_t StopFreezePdu::getReason() const { return _reason; } + +void StopFreezePdu::setReason(uint8_t pX) { _reason = pX; } + +uint8_t StopFreezePdu::getFrozenBehavior() const { + return _frozenBehavior; +} + +void StopFreezePdu::setFrozenBehavior(uint8_t pX) { + _frozenBehavior = pX; +} + +int16_t StopFreezePdu::getPadding1() const { return _padding1; } + +void StopFreezePdu::setPadding1(int16_t pX) { _padding1 = pX; } + +uint32_t StopFreezePdu::getRequestID() const { return _requestID; } + +void StopFreezePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void StopFreezePdu::marshal(DataStream& dataStream) const { + SimulationManagementFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _originatingID.marshal(dataStream); + _receivingID.marshal(dataStream); + _realWorldTime.marshal(dataStream); + dataStream << _reason; + dataStream << _frozenBehavior; + dataStream << _padding1; + dataStream << _requestID; +} + +void StopFreezePdu::unmarshal(DataStream& dataStream) { + SimulationManagementFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _originatingID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + _realWorldTime.unmarshal(dataStream); + dataStream >> _reason; + dataStream >> _frozenBehavior; + dataStream >> _padding1; + dataStream >> _requestID; +} + +bool StopFreezePdu::operator==(const StopFreezePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementFamilyPdu::operator==(rhs); + + if (!(_originatingID == rhs._originatingID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_realWorldTime == rhs._realWorldTime)) ivarsEqual = false; + if (!(_reason == rhs._reason)) ivarsEqual = false; + if (!(_frozenBehavior == rhs._frozenBehavior)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int StopFreezePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SimulationManagementFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _originatingID.getMarshalledSize(); // _originatingID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = + marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime + marshalSize = marshalSize + 1; // _reason + marshalSize = marshalSize + 1; // _frozenBehavior + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management/StopFreezePdu.h b/src/dis7/simulation_management/StopFreezePdu.h new file mode 100644 index 00000000..7b5ba7b4 --- /dev/null +++ b/src/dis7/simulation_management/StopFreezePdu.h @@ -0,0 +1,109 @@ +#pragma once + +#include "dis7/ClockTime.h" +#include "dis7/EntityID.h" +#include "dis7/SimulationManagementFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 7.5.5. Stop or freeze an enity (or exercise). COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT StopFreezePdu : public SimulationManagementFamilyPdu { + protected: + /** Identifier for originating entity(or simulation) */ + EntityID _originatingID; + + /** Identifier for the receiving entity(or simulation) */ + EntityID _receivingID; + + /** real-world(UTC) time at which the entity shall stop or freeze in the + * exercise */ + ClockTime _realWorldTime; + + /** Reason the simulation was stopped or frozen (see section 7 of + * SISO-REF-010) represented by an 8-bit enumeration */ + uint8_t _reason; + + /** Internal behavior of the entity(or simulation) and its appearance while + * frozen to the other participants */ + uint8_t _frozenBehavior; + + /** padding */ + int16_t _padding1; + + /** Request ID that is unique */ + uint32_t _requestID; + + public: + StopFreezePdu(); + virtual ~StopFreezePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingID(); + const EntityID& getOriginatingID() const; + void setOriginatingID(const EntityID& pX); + + EntityID& getReceivingID(); + const EntityID& getReceivingID() const; + void setReceivingID(const EntityID& pX); + + ClockTime& getRealWorldTime(); + const ClockTime& getRealWorldTime() const; + void setRealWorldTime(const ClockTime& pX); + + uint8_t getReason() const; + void setReason(uint8_t pX); + + uint8_t getFrozenBehavior() const; + void setFrozenBehavior(uint8_t pX); + + int16_t getPadding1() const; + void setPadding1(int16_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StopFreezePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/AcknowledgeReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/AcknowledgeReliablePdu.cpp new file mode 100644 index 00000000..262a9fdc --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/AcknowledgeReliablePdu.cpp @@ -0,0 +1,104 @@ +#include "dis7/AcknowledgeReliablePdu.h" + +using namespace DIS; + +AcknowledgeReliablePdu::AcknowledgeReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _acknowledgeFlag(0), + _responseFlag(0), + _requestID(0) { + setPduType(55); +} + +AcknowledgeReliablePdu::~AcknowledgeReliablePdu() {} + +uint16_t AcknowledgeReliablePdu::getAcknowledgeFlag() const { + return _acknowledgeFlag; +} + +void AcknowledgeReliablePdu::setAcknowledgeFlag(uint16_t pX) { + _acknowledgeFlag = pX; +} + +uint16_t AcknowledgeReliablePdu::getResponseFlag() const { + return _responseFlag; +} + +void AcknowledgeReliablePdu::setResponseFlag(uint16_t pX) { + _responseFlag = pX; +} + +uint32_t AcknowledgeReliablePdu::getRequestID() const { return _requestID; } + +void AcknowledgeReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void AcknowledgeReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _acknowledgeFlag; + dataStream << _responseFlag; + dataStream << _requestID; +} + +void AcknowledgeReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _acknowledgeFlag; + dataStream >> _responseFlag; + dataStream >> _requestID; +} + +bool AcknowledgeReliablePdu::operator==( + const AcknowledgeReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_acknowledgeFlag == rhs._acknowledgeFlag)) ivarsEqual = false; + if (!(_responseFlag == rhs._responseFlag)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int AcknowledgeReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 2; // _acknowledgeFlag + marshalSize = marshalSize + 2; // _responseFlag + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/AcknowledgeReliablePdu.h b/src/dis7/simulation_management_with_reliability/AcknowledgeReliablePdu.h new file mode 100644 index 00000000..2051ae1a --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/AcknowledgeReliablePdu.h @@ -0,0 +1,79 @@ +#pragma once + +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.5: Ack receipt of a start-resume, stop-freeze, create-entity +// or remove enitty (reliable) pdus. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT AcknowledgeReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** ack flags */ + uint16_t _acknowledgeFlag; + + /** response flags */ + uint16_t _responseFlag; + + /** Request ID */ + uint32_t _requestID; + + public: + AcknowledgeReliablePdu(); + virtual ~AcknowledgeReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getAcknowledgeFlag() const; + void setAcknowledgeFlag(uint16_t pX); + + uint16_t getResponseFlag() const; + void setResponseFlag(uint16_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const AcknowledgeReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/ActionRequestReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/ActionRequestReliablePdu.cpp new file mode 100644 index 00000000..19ec2ec8 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/ActionRequestReliablePdu.cpp @@ -0,0 +1,216 @@ +#include "dis7/ActionRequestReliablePdu.h" + +using namespace DIS; + +ActionRequestReliablePdu::ActionRequestReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0), + _actionID(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(56); +} + +ActionRequestReliablePdu::~ActionRequestReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint8_t ActionRequestReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void ActionRequestReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t ActionRequestReliablePdu::getPad1() const { return _pad1; } + +void ActionRequestReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t ActionRequestReliablePdu::getPad2() const { return _pad2; } + +void ActionRequestReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t ActionRequestReliablePdu::getRequestID() const { + return _requestID; +} + +void ActionRequestReliablePdu::setRequestID(uint32_t pX) { + _requestID = pX; +} + +uint32_t ActionRequestReliablePdu::getActionID() const { return _actionID; } + +void ActionRequestReliablePdu::setActionID(uint32_t pX) { _actionID = pX; } + +uint32_t ActionRequestReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t ActionRequestReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& ActionRequestReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& ActionRequestReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void ActionRequestReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& +ActionRequestReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& +ActionRequestReliablePdu::getVariableDatumRecords() const { + return _variableDatumRecords; +} + +void ActionRequestReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void ActionRequestReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; + dataStream << _actionID; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void ActionRequestReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; + dataStream >> _actionID; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool ActionRequestReliablePdu::operator==( + const ActionRequestReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_actionID == rhs._actionID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int ActionRequestReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _actionID + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/ActionRequestReliablePdu.h b/src/dis7/simulation_management_with_reliability/ActionRequestReliablePdu.h new file mode 100644 index 00000000..59ee1fcf --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/ActionRequestReliablePdu.h @@ -0,0 +1,119 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.6: request from a simulation manager to a managed entity to +// perform a specified action. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ActionRequestReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** request ID */ + uint32_t _requestID; + + /** request ID */ + uint32_t _actionID; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + ActionRequestReliablePdu(); + virtual ~ActionRequestReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getActionID() const; + void setActionID(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ActionRequestReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/ActionResponseReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/ActionResponseReliablePdu.cpp new file mode 100644 index 00000000..36082cac --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/ActionResponseReliablePdu.cpp @@ -0,0 +1,189 @@ +#include "dis7/ActionResponseReliablePdu.h" + +using namespace DIS; + +ActionResponseReliablePdu::ActionResponseReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requestID(0), + _responseStatus(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(57); +} + +ActionResponseReliablePdu::~ActionResponseReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint32_t ActionResponseReliablePdu::getRequestID() const { + return _requestID; +} + +void ActionResponseReliablePdu::setRequestID(uint32_t pX) { + _requestID = pX; +} + +uint32_t ActionResponseReliablePdu::getResponseStatus() const { + return _responseStatus; +} + +void ActionResponseReliablePdu::setResponseStatus(uint32_t pX) { + _responseStatus = pX; +} + +uint32_t ActionResponseReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t ActionResponseReliablePdu::getNumberOfVariableDatumRecords() + const { + return _variableDatumRecords.size(); +} + +std::vector& ActionResponseReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& ActionResponseReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void ActionResponseReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& +ActionResponseReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& +ActionResponseReliablePdu::getVariableDatumRecords() const { + return _variableDatumRecords; +} + +void ActionResponseReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void ActionResponseReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _responseStatus; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void ActionResponseReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _responseStatus; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool ActionResponseReliablePdu::operator==( + const ActionResponseReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_responseStatus == rhs._responseStatus)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int ActionResponseReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _responseStatus + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/ActionResponseReliablePdu.h b/src/dis7/simulation_management_with_reliability/ActionResponseReliablePdu.h new file mode 100644 index 00000000..c17c2352 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/ActionResponseReliablePdu.h @@ -0,0 +1,100 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.7: Response from an entity to an action request PDU. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ActionResponseReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** request ID */ + uint32_t _requestID; + + /** status of response */ + uint32_t _responseStatus; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + ActionResponseReliablePdu(); + virtual ~ActionResponseReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getResponseStatus() const; + void setResponseStatus(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ActionResponseReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/CMakeLists.txt b/src/dis7/simulation_management_with_reliability/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/simulation_management_with_reliability/CommentReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/CommentReliablePdu.cpp new file mode 100644 index 00000000..7efb119d --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/CommentReliablePdu.cpp @@ -0,0 +1,159 @@ +#include "dis7/CommentReliablePdu.h" + +using namespace DIS; + +CommentReliablePdu::CommentReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(62); +} + +CommentReliablePdu::~CommentReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint32_t CommentReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t CommentReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& CommentReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& CommentReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void CommentReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& CommentReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& CommentReliablePdu::getVariableDatumRecords() + const { + return _variableDatumRecords; +} + +void CommentReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void CommentReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void CommentReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool CommentReliablePdu::operator==(const CommentReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int CommentReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/CommentReliablePdu.h b/src/dis7/simulation_management_with_reliability/CommentReliablePdu.h new file mode 100644 index 00000000..25ff7185 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/CommentReliablePdu.h @@ -0,0 +1,89 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.12: Arbitrary messages. Only reliable this time. Neds manual +// intervention to fix padding in variable datums. UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT CommentReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + CommentReliablePdu(); + virtual ~CommentReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CommentReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/CreateEntityReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/CreateEntityReliablePdu.cpp new file mode 100644 index 00000000..348aa413 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/CreateEntityReliablePdu.cpp @@ -0,0 +1,112 @@ +#include "dis7/CreateEntityReliablePdu.h" + +using namespace DIS; + +CreateEntityReliablePdu::CreateEntityReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0) { + setPduType(51); +} + +CreateEntityReliablePdu::~CreateEntityReliablePdu() {} + +uint8_t CreateEntityReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void CreateEntityReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t CreateEntityReliablePdu::getPad1() const { return _pad1; } + +void CreateEntityReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t CreateEntityReliablePdu::getPad2() const { return _pad2; } + +void CreateEntityReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t CreateEntityReliablePdu::getRequestID() const { + return _requestID; +} + +void CreateEntityReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void CreateEntityReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; +} + +void CreateEntityReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; +} + +bool CreateEntityReliablePdu::operator==( + const CreateEntityReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int CreateEntityReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/CreateEntityReliablePdu.h b/src/dis7/simulation_management_with_reliability/CreateEntityReliablePdu.h new file mode 100644 index 00000000..8c535e46 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/CreateEntityReliablePdu.h @@ -0,0 +1,84 @@ +#pragma once + +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.1: creation of an entity , reliable. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT CreateEntityReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Request ID */ + uint32_t _requestID; + + public: + CreateEntityReliablePdu(); + virtual ~CreateEntityReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const CreateEntityReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/DataQueryReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/DataQueryReliablePdu.cpp new file mode 100644 index 00000000..e1f1958a --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/DataQueryReliablePdu.cpp @@ -0,0 +1,214 @@ +#include "dis7/DataQueryReliablePdu.h" + +using namespace DIS; + +DataQueryReliablePdu::DataQueryReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0), + _timeInterval(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(58); +} + +DataQueryReliablePdu::~DataQueryReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint8_t DataQueryReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void DataQueryReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t DataQueryReliablePdu::getPad1() const { return _pad1; } + +void DataQueryReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t DataQueryReliablePdu::getPad2() const { return _pad2; } + +void DataQueryReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t DataQueryReliablePdu::getRequestID() const { return _requestID; } + +void DataQueryReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t DataQueryReliablePdu::getTimeInterval() const { + return _timeInterval; +} + +void DataQueryReliablePdu::setTimeInterval(uint32_t pX) { + _timeInterval = pX; +} + +uint32_t DataQueryReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t DataQueryReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& DataQueryReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& DataQueryReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void DataQueryReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& DataQueryReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& +DataQueryReliablePdu::getVariableDatumRecords() const { + return _variableDatumRecords; +} + +void DataQueryReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void DataQueryReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; + dataStream << _timeInterval; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void DataQueryReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; + dataStream >> _timeInterval; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool DataQueryReliablePdu::operator==(const DataQueryReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_timeInterval == rhs._timeInterval)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataQueryReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _timeInterval + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/DataQueryReliablePdu.h b/src/dis7/simulation_management_with_reliability/DataQueryReliablePdu.h new file mode 100644 index 00000000..f0aa427c --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/DataQueryReliablePdu.h @@ -0,0 +1,118 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.8: request for data from an entity. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DataQueryReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** request ID */ + uint32_t _requestID; + + /** time interval between issuing data query PDUs */ + uint32_t _timeInterval; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + DataQueryReliablePdu(); + virtual ~DataQueryReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getTimeInterval() const; + void setTimeInterval(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataQueryReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/DataReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/DataReliablePdu.cpp new file mode 100644 index 00000000..e7d6e313 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/DataReliablePdu.cpp @@ -0,0 +1,199 @@ +#include "dis7/DataReliablePdu.h" + +using namespace DIS; + +DataReliablePdu::DataReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requestID(0), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(60); +} + +DataReliablePdu::~DataReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint32_t DataReliablePdu::getRequestID() const { return _requestID; } + +void DataReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint8_t DataReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void DataReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t DataReliablePdu::getPad1() const { return _pad1; } + +void DataReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t DataReliablePdu::getPad2() const { return _pad2; } + +void DataReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t DataReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t DataReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& DataReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& DataReliablePdu::getFixedDatumRecords() const { + return _fixedDatumRecords; +} + +void DataReliablePdu::setFixedDatumRecords(const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& DataReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& DataReliablePdu::getVariableDatumRecords() + const { + return _variableDatumRecords; +} + +void DataReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void DataReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void DataReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool DataReliablePdu::operator==(const DataReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int DataReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/DataReliablePdu.h b/src/dis7/simulation_management_with_reliability/DataReliablePdu.h new file mode 100644 index 00000000..506c9118 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/DataReliablePdu.h @@ -0,0 +1,113 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.10: issued in response to a data query R or set dataR pdu. +// Needs manual intervention to fix padding on variable datums. UNFINSIHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DataReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** Request ID */ + uint32_t _requestID; + + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + DataReliablePdu(); + virtual ~DataReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DataReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/EventReportReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/EventReportReliablePdu.cpp new file mode 100644 index 00000000..fd90b889 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/EventReportReliablePdu.cpp @@ -0,0 +1,183 @@ +#include "dis7/EventReportReliablePdu.h" + +using namespace DIS; + +EventReportReliablePdu::EventReportReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _eventType(0), + _pad1(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(61); +} + +EventReportReliablePdu::~EventReportReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint16_t EventReportReliablePdu::getEventType() const { + return _eventType; +} + +void EventReportReliablePdu::setEventType(uint16_t pX) { + _eventType = pX; +} + +uint32_t EventReportReliablePdu::getPad1() const { return _pad1; } + +void EventReportReliablePdu::setPad1(uint32_t pX) { _pad1 = pX; } + +uint32_t EventReportReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t EventReportReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& EventReportReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& EventReportReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void EventReportReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& EventReportReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& +EventReportReliablePdu::getVariableDatumRecords() const { + return _variableDatumRecords; +} + +void EventReportReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void EventReportReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _eventType; + dataStream << _pad1; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void EventReportReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _eventType; + dataStream >> _pad1; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool EventReportReliablePdu::operator==( + const EventReportReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_eventType == rhs._eventType)) ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int EventReportReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 2; // _eventType + marshalSize = marshalSize + 4; // _pad1 + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/EventReportReliablePdu.h b/src/dis7/simulation_management_with_reliability/EventReportReliablePdu.h new file mode 100644 index 00000000..ed0a2d3d --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/EventReportReliablePdu.h @@ -0,0 +1,102 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.11: reports the occurance of a significatnt event to the +// simulation manager. Needs manual intervention to fix padding in variable +// datums. UNFINISHED. + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EventReportReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** Event type */ + uint16_t _eventType; + + /** padding */ + uint32_t _pad1; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + EventReportReliablePdu(); + virtual ~EventReportReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getEventType() const; + void setEventType(uint16_t pX); + + uint32_t getPad1() const; + void setPad1(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EventReportReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/RecordQueryReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/RecordQueryReliablePdu.cpp new file mode 100644 index 00000000..4cece548 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/RecordQueryReliablePdu.cpp @@ -0,0 +1,175 @@ +#include "dis7/RecordQueryReliablePdu.h" + +using namespace DIS; + +RecordQueryReliablePdu::RecordQueryReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requestID(0), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _eventType(0), + _time(0), + _numberOfRecords(0) { + setPduType(63); +} + +RecordQueryReliablePdu::~RecordQueryReliablePdu() { _recordIDs.clear(); } + +uint32_t RecordQueryReliablePdu::getRequestID() const { return _requestID; } + +void RecordQueryReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint8_t RecordQueryReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void RecordQueryReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t RecordQueryReliablePdu::getPad1() const { return _pad1; } + +void RecordQueryReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t RecordQueryReliablePdu::getPad2() const { return _pad2; } + +void RecordQueryReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint16_t RecordQueryReliablePdu::getEventType() const { + return _eventType; +} + +void RecordQueryReliablePdu::setEventType(uint16_t pX) { + _eventType = pX; +} + +uint32_t RecordQueryReliablePdu::getTime() const { return _time; } + +void RecordQueryReliablePdu::setTime(uint32_t pX) { _time = pX; } + +uint32_t RecordQueryReliablePdu::getNumberOfRecords() const { + return _recordIDs.size(); +} + +std::vector& RecordQueryReliablePdu::getRecordIDs() { + return _recordIDs; +} + +const std::vector& RecordQueryReliablePdu::getRecordIDs() const { + return _recordIDs; +} + +void RecordQueryReliablePdu::setRecordIDs( + const std::vector& pX) { + _recordIDs = pX; +} + +void RecordQueryReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requestID; + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _eventType; + dataStream << _time; + dataStream << (uint32_t)_recordIDs.size(); + + for (size_t idx = 0; idx < _recordIDs.size(); idx++) { + FourByteChunk x = _recordIDs[idx]; + x.marshal(dataStream); + } +} + +void RecordQueryReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requestID; + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _eventType; + dataStream >> _time; + dataStream >> _numberOfRecords; + + _recordIDs.clear(); + for (size_t idx = 0; idx < _numberOfRecords; idx++) { + FourByteChunk x; + x.unmarshal(dataStream); + _recordIDs.push_back(x); + } +} + +bool RecordQueryReliablePdu::operator==( + const RecordQueryReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_eventType == rhs._eventType)) ivarsEqual = false; + if (!(_time == rhs._time)) ivarsEqual = false; + + for (size_t idx = 0; idx < _recordIDs.size(); idx++) { + if (!(_recordIDs[idx] == rhs._recordIDs[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int RecordQueryReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 2; // _eventType + marshalSize = marshalSize + 4; // _time + marshalSize = marshalSize + 4; // _numberOfRecords + + for (uint64_t idx = 0; idx < _recordIDs.size(); idx++) { + FourByteChunk listElement = _recordIDs[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/RecordQueryReliablePdu.h b/src/dis7/simulation_management_with_reliability/RecordQueryReliablePdu.h new file mode 100644 index 00000000..5abc8134 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/RecordQueryReliablePdu.h @@ -0,0 +1,112 @@ +#pragma once + +#include + +#include "dis7/FourByteChunk.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.13: A request for one or more records of data from an entity. +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RecordQueryReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** request ID */ + uint32_t _requestID; + + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding. The spec is unclear and contradictory here. */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** event type */ + uint16_t _eventType; + + /** time */ + uint32_t _time; + + /** numberOfRecords */ + uint32_t _numberOfRecords; + + /** record IDs */ + std::vector _recordIDs; + + public: + RecordQueryReliablePdu(); + virtual ~RecordQueryReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint16_t getEventType() const; + void setEventType(uint16_t pX); + + uint32_t getTime() const; + void setTime(uint32_t pX); + + uint32_t getNumberOfRecords() const; + + std::vector& getRecordIDs(); + const std::vector& getRecordIDs() const; + void setRecordIDs(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RecordQueryReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/RemoveEntityReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/RemoveEntityReliablePdu.cpp new file mode 100644 index 00000000..352c2bd2 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/RemoveEntityReliablePdu.cpp @@ -0,0 +1,112 @@ +#include "dis7/RemoveEntityReliablePdu.h" + +using namespace DIS; + +RemoveEntityReliablePdu::RemoveEntityReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0) { + setPduType(52); +} + +RemoveEntityReliablePdu::~RemoveEntityReliablePdu() {} + +uint8_t RemoveEntityReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void RemoveEntityReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t RemoveEntityReliablePdu::getPad1() const { return _pad1; } + +void RemoveEntityReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t RemoveEntityReliablePdu::getPad2() const { return _pad2; } + +void RemoveEntityReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t RemoveEntityReliablePdu::getRequestID() const { + return _requestID; +} + +void RemoveEntityReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void RemoveEntityReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; +} + +void RemoveEntityReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; +} + +bool RemoveEntityReliablePdu::operator==( + const RemoveEntityReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int RemoveEntityReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/RemoveEntityReliablePdu.h b/src/dis7/simulation_management_with_reliability/RemoveEntityReliablePdu.h new file mode 100644 index 00000000..65750ccb --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/RemoveEntityReliablePdu.h @@ -0,0 +1,84 @@ +#pragma once + +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.2: Removal of an entity , reliable. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT RemoveEntityReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Request ID */ + uint32_t _requestID; + + public: + RemoveEntityReliablePdu(); + virtual ~RemoveEntityReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const RemoveEntityReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/SetDataReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/SetDataReliablePdu.cpp new file mode 100644 index 00000000..8de4d9d1 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/SetDataReliablePdu.cpp @@ -0,0 +1,201 @@ +#include "dis7/SetDataReliablePdu.h" + +using namespace DIS; + +SetDataReliablePdu::SetDataReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0), + _numberOfFixedDatumRecords(0), + _numberOfVariableDatumRecords(0) { + setPduType(59); +} + +SetDataReliablePdu::~SetDataReliablePdu() { + _fixedDatumRecords.clear(); + _variableDatumRecords.clear(); +} + +uint8_t SetDataReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void SetDataReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t SetDataReliablePdu::getPad1() const { return _pad1; } + +void SetDataReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t SetDataReliablePdu::getPad2() const { return _pad2; } + +void SetDataReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t SetDataReliablePdu::getRequestID() const { return _requestID; } + +void SetDataReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +uint32_t SetDataReliablePdu::getNumberOfFixedDatumRecords() const { + return _fixedDatumRecords.size(); +} + +uint32_t SetDataReliablePdu::getNumberOfVariableDatumRecords() const { + return _variableDatumRecords.size(); +} + +std::vector& SetDataReliablePdu::getFixedDatumRecords() { + return _fixedDatumRecords; +} + +const std::vector& SetDataReliablePdu::getFixedDatumRecords() + const { + return _fixedDatumRecords; +} + +void SetDataReliablePdu::setFixedDatumRecords( + const std::vector& pX) { + _fixedDatumRecords = pX; +} + +std::vector& SetDataReliablePdu::getVariableDatumRecords() { + return _variableDatumRecords; +} + +const std::vector& SetDataReliablePdu::getVariableDatumRecords() + const { + return _variableDatumRecords; +} + +void SetDataReliablePdu::setVariableDatumRecords( + const std::vector& pX) { + _variableDatumRecords = pX; +} + +void SetDataReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; + dataStream << (uint32_t)_fixedDatumRecords.size(); + dataStream << (uint32_t)_variableDatumRecords.size(); + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum x = _fixedDatumRecords[idx]; + x.marshal(dataStream); + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum x = _variableDatumRecords[idx]; + x.marshal(dataStream); + } +} + +void SetDataReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; + dataStream >> _numberOfFixedDatumRecords; + dataStream >> _numberOfVariableDatumRecords; + + _fixedDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfFixedDatumRecords; idx++) { + FixedDatum x; + x.unmarshal(dataStream); + _fixedDatumRecords.push_back(x); + } + + _variableDatumRecords.clear(); + for (size_t idx = 0; idx < _numberOfVariableDatumRecords; idx++) { + VariableDatum x; + x.unmarshal(dataStream); + _variableDatumRecords.push_back(x); + } +} + +bool SetDataReliablePdu::operator==(const SetDataReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + if (!(_fixedDatumRecords[idx] == rhs._fixedDatumRecords[idx])) + ivarsEqual = false; + } + + for (size_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + if (!(_variableDatumRecords[idx] == rhs._variableDatumRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int SetDataReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + marshalSize = marshalSize + 4; // _numberOfFixedDatumRecords + marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords + + for (uint64_t idx = 0; idx < _fixedDatumRecords.size(); idx++) { + FixedDatum listElement = _fixedDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + for (uint64_t idx = 0; idx < _variableDatumRecords.size(); idx++) { + VariableDatum listElement = _variableDatumRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/SetDataReliablePdu.h b/src/dis7/simulation_management_with_reliability/SetDataReliablePdu.h new file mode 100644 index 00000000..a5171e50 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/SetDataReliablePdu.h @@ -0,0 +1,114 @@ +#pragma once + +#include + +#include "dis7/FixedDatum.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/VariableDatum.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.9: initializing or chaning internal state information, +// reliable. Needs manual intervention to fix padding on variable datums. +// UNFINISHED + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SetDataReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Request ID */ + uint32_t _requestID; + + /** Fixed datum record count */ + uint32_t _numberOfFixedDatumRecords; + + /** variable datum record count */ + uint32_t _numberOfVariableDatumRecords; + + /** Fixed datum records */ + std::vector _fixedDatumRecords; + + /** Variable datum records */ + std::vector _variableDatumRecords; + + public: + SetDataReliablePdu(); + virtual ~SetDataReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + uint32_t getNumberOfFixedDatumRecords() const; + + uint32_t getNumberOfVariableDatumRecords() const; + + std::vector& getFixedDatumRecords(); + const std::vector& getFixedDatumRecords() const; + void setFixedDatumRecords(const std::vector& pX); + + std::vector& getVariableDatumRecords(); + const std::vector& getVariableDatumRecords() const; + void setVariableDatumRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const SetDataReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.cpp b/src/dis7/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.cpp new file mode 100644 index 00000000..3b223c1f --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.cpp @@ -0,0 +1,110 @@ +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" + +using namespace DIS; + +SimulationManagementWithReliabilityFamilyPdu:: + SimulationManagementWithReliabilityFamilyPdu() + : Pdu(), _originatingEntityID(), _receivingEntityID() { + setProtocolFamily(10); +} + +SimulationManagementWithReliabilityFamilyPdu:: + ~SimulationManagementWithReliabilityFamilyPdu() {} + +EntityID& +SimulationManagementWithReliabilityFamilyPdu::getOriginatingEntityID() { + return _originatingEntityID; +} + +const EntityID& +SimulationManagementWithReliabilityFamilyPdu::getOriginatingEntityID() const { + return _originatingEntityID; +} + +void SimulationManagementWithReliabilityFamilyPdu::setOriginatingEntityID( + const EntityID& pX) { + _originatingEntityID = pX; +} + +EntityID& SimulationManagementWithReliabilityFamilyPdu::getReceivingEntityID() { + return _receivingEntityID; +} + +const EntityID& +SimulationManagementWithReliabilityFamilyPdu::getReceivingEntityID() const { + return _receivingEntityID; +} + +void SimulationManagementWithReliabilityFamilyPdu::setReceivingEntityID( + const EntityID& pX) { + _receivingEntityID = pX; +} + +void SimulationManagementWithReliabilityFamilyPdu::marshal( + DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first + _originatingEntityID.marshal(dataStream); + _receivingEntityID.marshal(dataStream); +} + +void SimulationManagementWithReliabilityFamilyPdu::unmarshal( + DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first + _originatingEntityID.unmarshal(dataStream); + _receivingEntityID.unmarshal(dataStream); +} + +bool SimulationManagementWithReliabilityFamilyPdu::operator==( + const SimulationManagementWithReliabilityFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + if (!(_originatingEntityID == rhs._originatingEntityID)) ivarsEqual = false; + if (!(_receivingEntityID == rhs._receivingEntityID)) ivarsEqual = false; + + return ivarsEqual; +} + +int SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + marshalSize = + marshalSize + + _originatingEntityID.getMarshalledSize(); // _originatingEntityID + marshalSize = marshalSize + + _receivingEntityID.getMarshalledSize(); // _receivingEntityID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.h b/src/dis7/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.h new file mode 100644 index 00000000..b3f6548c --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/SimulationManagementWithReliabilityFamilyPdu.h @@ -0,0 +1,76 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12: Abstract superclass for reliable simulation management PDUs + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SimulationManagementWithReliabilityFamilyPdu + : public Pdu { + protected: + /** Object originatig the request */ + EntityID _originatingEntityID; + + /** Object with which this point object is associated */ + EntityID _receivingEntityID; + + public: + SimulationManagementWithReliabilityFamilyPdu(); + virtual ~SimulationManagementWithReliabilityFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getOriginatingEntityID(); + const EntityID& getOriginatingEntityID() const; + void setOriginatingEntityID(const EntityID& pX); + + EntityID& getReceivingEntityID(); + const EntityID& getReceivingEntityID() const; + void setReceivingEntityID(const EntityID& pX); + + virtual int getMarshalledSize() const; + + bool operator==( + const SimulationManagementWithReliabilityFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/StartResumeReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/StartResumeReliablePdu.cpp new file mode 100644 index 00000000..9e3de8c6 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/StartResumeReliablePdu.cpp @@ -0,0 +1,144 @@ +#include "dis7/StartResumeReliablePdu.h" + +using namespace DIS; + +StartResumeReliablePdu::StartResumeReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _realWorldTime(), + _simulationTime(), + _requiredReliabilityService(0), + _pad1(0), + _pad2(0), + _requestID(0) { + setPduType(53); +} + +StartResumeReliablePdu::~StartResumeReliablePdu() {} + +ClockTime& StartResumeReliablePdu::getRealWorldTime() { return _realWorldTime; } + +const ClockTime& StartResumeReliablePdu::getRealWorldTime() const { + return _realWorldTime; +} + +void StartResumeReliablePdu::setRealWorldTime(const ClockTime& pX) { + _realWorldTime = pX; +} + +ClockTime& StartResumeReliablePdu::getSimulationTime() { + return _simulationTime; +} + +const ClockTime& StartResumeReliablePdu::getSimulationTime() const { + return _simulationTime; +} + +void StartResumeReliablePdu::setSimulationTime(const ClockTime& pX) { + _simulationTime = pX; +} + +uint8_t StartResumeReliablePdu::getRequiredReliabilityService() const { + return _requiredReliabilityService; +} + +void StartResumeReliablePdu::setRequiredReliabilityService(uint8_t pX) { + _requiredReliabilityService = pX; +} + +uint16_t StartResumeReliablePdu::getPad1() const { return _pad1; } + +void StartResumeReliablePdu::setPad1(uint16_t pX) { _pad1 = pX; } + +uint8_t StartResumeReliablePdu::getPad2() const { return _pad2; } + +void StartResumeReliablePdu::setPad2(uint8_t pX) { _pad2 = pX; } + +uint32_t StartResumeReliablePdu::getRequestID() const { return _requestID; } + +void StartResumeReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void StartResumeReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _realWorldTime.marshal(dataStream); + _simulationTime.marshal(dataStream); + dataStream << _requiredReliabilityService; + dataStream << _pad1; + dataStream << _pad2; + dataStream << _requestID; +} + +void StartResumeReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _realWorldTime.unmarshal(dataStream); + _simulationTime.unmarshal(dataStream); + dataStream >> _requiredReliabilityService; + dataStream >> _pad1; + dataStream >> _pad2; + dataStream >> _requestID; +} + +bool StartResumeReliablePdu::operator==( + const StartResumeReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_realWorldTime == rhs._realWorldTime)) ivarsEqual = false; + if (!(_simulationTime == rhs._simulationTime)) ivarsEqual = false; + if (!(_requiredReliabilityService == rhs._requiredReliabilityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int StartResumeReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime + marshalSize = + marshalSize + _simulationTime.getMarshalledSize(); // _simulationTime + marshalSize = marshalSize + 1; // _requiredReliabilityService + marshalSize = marshalSize + 2; // _pad1 + marshalSize = marshalSize + 1; // _pad2 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/StartResumeReliablePdu.h b/src/dis7/simulation_management_with_reliability/StartResumeReliablePdu.h new file mode 100644 index 00000000..518e3e78 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/StartResumeReliablePdu.h @@ -0,0 +1,99 @@ +#pragma once + +#include "dis7/ClockTime.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.3: Start resume simulation, relaible. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT StartResumeReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** time in real world for this operation to happen */ + ClockTime _realWorldTime; + + /** time in simulation for the simulation to resume */ + ClockTime _simulationTime; + + /** level of reliability service used for this transaction */ + uint8_t _requiredReliabilityService; + + /** padding */ + uint16_t _pad1; + + /** padding */ + uint8_t _pad2; + + /** Request ID */ + uint32_t _requestID; + + public: + StartResumeReliablePdu(); + virtual ~StartResumeReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + ClockTime& getRealWorldTime(); + const ClockTime& getRealWorldTime() const; + void setRealWorldTime(const ClockTime& pX); + + ClockTime& getSimulationTime(); + const ClockTime& getSimulationTime() const; + void setSimulationTime(const ClockTime& pX); + + uint8_t getRequiredReliabilityService() const; + void setRequiredReliabilityService(uint8_t pX); + + uint16_t getPad1() const; + void setPad1(uint16_t pX); + + uint8_t getPad2() const; + void setPad2(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StartResumeReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/StopFreezeReliablePdu.cpp b/src/dis7/simulation_management_with_reliability/StopFreezeReliablePdu.cpp new file mode 100644 index 00000000..e7797f45 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/StopFreezeReliablePdu.cpp @@ -0,0 +1,138 @@ +#include "dis7/StopFreezeReliablePdu.h" + +using namespace DIS; + +StopFreezeReliablePdu::StopFreezeReliablePdu() + : SimulationManagementWithReliabilityFamilyPdu(), + _realWorldTime(), + _reason(0), + _frozenBehavior(0), + _requiredReliablityService(0), + _pad1(0), + _requestID(0) { + setPduType(54); +} + +StopFreezeReliablePdu::~StopFreezeReliablePdu() {} + +ClockTime& StopFreezeReliablePdu::getRealWorldTime() { return _realWorldTime; } + +const ClockTime& StopFreezeReliablePdu::getRealWorldTime() const { + return _realWorldTime; +} + +void StopFreezeReliablePdu::setRealWorldTime(const ClockTime& pX) { + _realWorldTime = pX; +} + +uint8_t StopFreezeReliablePdu::getReason() const { return _reason; } + +void StopFreezeReliablePdu::setReason(uint8_t pX) { _reason = pX; } + +uint8_t StopFreezeReliablePdu::getFrozenBehavior() const { + return _frozenBehavior; +} + +void StopFreezeReliablePdu::setFrozenBehavior(uint8_t pX) { + _frozenBehavior = pX; +} + +uint8_t StopFreezeReliablePdu::getRequiredReliablityService() const { + return _requiredReliablityService; +} + +void StopFreezeReliablePdu::setRequiredReliablityService(uint8_t pX) { + _requiredReliablityService = pX; +} + +uint8_t StopFreezeReliablePdu::getPad1() const { return _pad1; } + +void StopFreezeReliablePdu::setPad1(uint8_t pX) { _pad1 = pX; } + +uint32_t StopFreezeReliablePdu::getRequestID() const { return _requestID; } + +void StopFreezeReliablePdu::setRequestID(uint32_t pX) { _requestID = pX; } + +void StopFreezeReliablePdu::marshal(DataStream& dataStream) const { + SimulationManagementWithReliabilityFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _realWorldTime.marshal(dataStream); + dataStream << _reason; + dataStream << _frozenBehavior; + dataStream << _requiredReliablityService; + dataStream << _pad1; + dataStream << _requestID; +} + +void StopFreezeReliablePdu::unmarshal(DataStream& dataStream) { + SimulationManagementWithReliabilityFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _realWorldTime.unmarshal(dataStream); + dataStream >> _reason; + dataStream >> _frozenBehavior; + dataStream >> _requiredReliablityService; + dataStream >> _pad1; + dataStream >> _requestID; +} + +bool StopFreezeReliablePdu::operator==(const StopFreezeReliablePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SimulationManagementWithReliabilityFamilyPdu::operator==(rhs); + + if (!(_realWorldTime == rhs._realWorldTime)) ivarsEqual = false; + if (!(_reason == rhs._reason)) ivarsEqual = false; + if (!(_frozenBehavior == rhs._frozenBehavior)) ivarsEqual = false; + if (!(_requiredReliablityService == rhs._requiredReliablityService)) + ivarsEqual = false; + if (!(_pad1 == rhs._pad1)) ivarsEqual = false; + if (!(_requestID == rhs._requestID)) ivarsEqual = false; + + return ivarsEqual; +} + +int StopFreezeReliablePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + SimulationManagementWithReliabilityFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _realWorldTime.getMarshalledSize(); // _realWorldTime + marshalSize = marshalSize + 1; // _reason + marshalSize = marshalSize + 1; // _frozenBehavior + marshalSize = marshalSize + 1; // _requiredReliablityService + marshalSize = marshalSize + 1; // _pad1 + marshalSize = marshalSize + 4; // _requestID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/simulation_management_with_reliability/StopFreezeReliablePdu.h b/src/dis7/simulation_management_with_reliability/StopFreezeReliablePdu.h new file mode 100644 index 00000000..d60ddda1 --- /dev/null +++ b/src/dis7/simulation_management_with_reliability/StopFreezeReliablePdu.h @@ -0,0 +1,98 @@ +#pragma once + +#include "dis7/ClockTime.h" +#include "dis7/SimulationManagementWithReliabilityFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.12.4: Stop freeze simulation, relaible. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT StopFreezeReliablePdu + : public SimulationManagementWithReliabilityFamilyPdu { + protected: + /** time in real world for this operation to happen */ + ClockTime _realWorldTime; + + /** Reason for stopping/freezing simulation */ + uint8_t _reason; + + /** internal behvior of the simulation while frozen */ + uint8_t _frozenBehavior; + + /** reliablity level */ + uint8_t _requiredReliablityService; + + /** padding */ + uint8_t _pad1; + + /** Request ID */ + uint32_t _requestID; + + public: + StopFreezeReliablePdu(); + virtual ~StopFreezeReliablePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + ClockTime& getRealWorldTime(); + const ClockTime& getRealWorldTime() const; + void setRealWorldTime(const ClockTime& pX); + + uint8_t getReason() const; + void setReason(uint8_t pX); + + uint8_t getFrozenBehavior() const; + void setFrozenBehavior(uint8_t pX); + + uint8_t getRequiredReliablityService() const; + void setRequiredReliablityService(uint8_t pX); + + uint8_t getPad1() const; + void setPad1(uint8_t pX); + + uint32_t getRequestID() const; + void setRequestID(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StopFreezeReliablePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/ArealObjectStatePdu.cpp b/src/dis7/synthetic_environment/ArealObjectStatePdu.cpp new file mode 100644 index 00000000..6c6f4f59 --- /dev/null +++ b/src/dis7/synthetic_environment/ArealObjectStatePdu.cpp @@ -0,0 +1,252 @@ +#include "dis7/ArealObjectStatePdu.h" + +using namespace DIS; + +ArealObjectStatePdu::ArealObjectStatePdu() + : SyntheticEnvironmentFamilyPdu(), + _objectID(), + _referencedObjectID(), + _updateNumber(0), + _forceID(0), + _modifications(0), + _objectType(), + _specificObjectAppearance(0), + _generalObjectAppearance(0), + _numberOfPoints(0), + _requesterID(), + _receivingID() { + setPduType(45); +} + +ArealObjectStatePdu::~ArealObjectStatePdu() { _objectLocation.clear(); } + +EntityID& ArealObjectStatePdu::getObjectID() { return _objectID; } + +const EntityID& ArealObjectStatePdu::getObjectID() const { return _objectID; } + +void ArealObjectStatePdu::setObjectID(const EntityID& pX) { _objectID = pX; } + +EntityID& ArealObjectStatePdu::getReferencedObjectID() { + return _referencedObjectID; +} + +const EntityID& ArealObjectStatePdu::getReferencedObjectID() const { + return _referencedObjectID; +} + +void ArealObjectStatePdu::setReferencedObjectID(const EntityID& pX) { + _referencedObjectID = pX; +} + +uint16_t ArealObjectStatePdu::getUpdateNumber() const { + return _updateNumber; +} + +void ArealObjectStatePdu::setUpdateNumber(uint16_t pX) { + _updateNumber = pX; +} + +uint8_t ArealObjectStatePdu::getForceID() const { return _forceID; } + +void ArealObjectStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t ArealObjectStatePdu::getModifications() const { + return _modifications; +} + +void ArealObjectStatePdu::setModifications(uint8_t pX) { + _modifications = pX; +} + +EntityType& ArealObjectStatePdu::getObjectType() { return _objectType; } + +const EntityType& ArealObjectStatePdu::getObjectType() const { + return _objectType; +} + +void ArealObjectStatePdu::setObjectType(const EntityType& pX) { + _objectType = pX; +} + +uint32_t ArealObjectStatePdu::getSpecificObjectAppearance() const { + return _specificObjectAppearance; +} + +void ArealObjectStatePdu::setSpecificObjectAppearance(uint32_t pX) { + _specificObjectAppearance = pX; +} + +uint16_t ArealObjectStatePdu::getGeneralObjectAppearance() const { + return _generalObjectAppearance; +} + +void ArealObjectStatePdu::setGeneralObjectAppearance(uint16_t pX) { + _generalObjectAppearance = pX; +} + +uint16_t ArealObjectStatePdu::getNumberOfPoints() const { + return _objectLocation.size(); +} + +SimulationAddress& ArealObjectStatePdu::getRequesterID() { + return _requesterID; +} + +const SimulationAddress& ArealObjectStatePdu::getRequesterID() const { + return _requesterID; +} + +void ArealObjectStatePdu::setRequesterID(const SimulationAddress& pX) { + _requesterID = pX; +} + +SimulationAddress& ArealObjectStatePdu::getReceivingID() { + return _receivingID; +} + +const SimulationAddress& ArealObjectStatePdu::getReceivingID() const { + return _receivingID; +} + +void ArealObjectStatePdu::setReceivingID(const SimulationAddress& pX) { + _receivingID = pX; +} + +std::vector& ArealObjectStatePdu::getObjectLocation() { + return _objectLocation; +} + +const std::vector& ArealObjectStatePdu::getObjectLocation() + const { + return _objectLocation; +} + +void ArealObjectStatePdu::setObjectLocation( + const std::vector& pX) { + _objectLocation = pX; +} + +void ArealObjectStatePdu::marshal(DataStream& dataStream) const { + SyntheticEnvironmentFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _objectID.marshal(dataStream); + _referencedObjectID.marshal(dataStream); + dataStream << _updateNumber; + dataStream << _forceID; + dataStream << _modifications; + _objectType.marshal(dataStream); + dataStream << _specificObjectAppearance; + dataStream << _generalObjectAppearance; + dataStream << (uint16_t)_objectLocation.size(); + _requesterID.marshal(dataStream); + _receivingID.marshal(dataStream); + + for (size_t idx = 0; idx < _objectLocation.size(); idx++) { + Vector3Double x = _objectLocation[idx]; + x.marshal(dataStream); + } +} + +void ArealObjectStatePdu::unmarshal(DataStream& dataStream) { + SyntheticEnvironmentFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _objectID.unmarshal(dataStream); + _referencedObjectID.unmarshal(dataStream); + dataStream >> _updateNumber; + dataStream >> _forceID; + dataStream >> _modifications; + _objectType.unmarshal(dataStream); + dataStream >> _specificObjectAppearance; + dataStream >> _generalObjectAppearance; + dataStream >> _numberOfPoints; + _requesterID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + + _objectLocation.clear(); + for (size_t idx = 0; idx < _numberOfPoints; idx++) { + Vector3Double x; + x.unmarshal(dataStream); + _objectLocation.push_back(x); + } +} + +bool ArealObjectStatePdu::operator==(const ArealObjectStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); + + if (!(_objectID == rhs._objectID)) ivarsEqual = false; + if (!(_referencedObjectID == rhs._referencedObjectID)) ivarsEqual = false; + if (!(_updateNumber == rhs._updateNumber)) ivarsEqual = false; + if (!(_forceID == rhs._forceID)) ivarsEqual = false; + if (!(_modifications == rhs._modifications)) ivarsEqual = false; + if (!(_objectType == rhs._objectType)) ivarsEqual = false; + if (!(_specificObjectAppearance == rhs._specificObjectAppearance)) + ivarsEqual = false; + if (!(_generalObjectAppearance == rhs._generalObjectAppearance)) + ivarsEqual = false; + if (!(_requesterID == rhs._requesterID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + + for (size_t idx = 0; idx < _objectLocation.size(); idx++) { + if (!(_objectLocation[idx] == rhs._objectLocation[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int ArealObjectStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID + marshalSize = marshalSize + + _referencedObjectID.getMarshalledSize(); // _referencedObjectID + marshalSize = marshalSize + 2; // _updateNumber + marshalSize = marshalSize + 1; // _forceID + marshalSize = marshalSize + 1; // _modifications + marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType + marshalSize = marshalSize + 4; // _specificObjectAppearance + marshalSize = marshalSize + 2; // _generalObjectAppearance + marshalSize = marshalSize + 2; // _numberOfPoints + marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + + for (uint64_t idx = 0; idx < _objectLocation.size(); idx++) { + Vector3Double listElement = _objectLocation[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/ArealObjectStatePdu.h b/src/dis7/synthetic_environment/ArealObjectStatePdu.h new file mode 100644 index 00000000..f78d1643 --- /dev/null +++ b/src/dis7/synthetic_environment/ArealObjectStatePdu.h @@ -0,0 +1,145 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/EntityType.h" +#include "dis7/SimulationAddress.h" +#include "dis7/SyntheticEnvironmentFamilyPdu.h" +#include "dis7/Vector3Double.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Information about the addition/modification of an oobject that is +// geometrically anchored to the terrain with a set of three or more points that +// come to a closure. Section 7.10.6 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ArealObjectStatePdu + : public SyntheticEnvironmentFamilyPdu { + protected: + /** Object in synthetic environment */ + EntityID _objectID; + + /** Object with which this point object is associated */ + EntityID _referencedObjectID; + + /** unique update number of each state transition of an object */ + uint16_t _updateNumber; + + /** force ID */ + uint8_t _forceID; + + /** modifications enumeration */ + uint8_t _modifications; + + /** Object type */ + EntityType _objectType; + + /** Object appearance */ + uint32_t _specificObjectAppearance; + + /** Object appearance */ + uint16_t _generalObjectAppearance; + + /** Number of points */ + uint16_t _numberOfPoints; + + /** requesterID */ + SimulationAddress _requesterID; + + /** receiver ID */ + SimulationAddress _receivingID; + + /** location of object */ + std::vector _objectLocation; + + public: + ArealObjectStatePdu(); + virtual ~ArealObjectStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getObjectID(); + const EntityID& getObjectID() const; + void setObjectID(const EntityID& pX); + + EntityID& getReferencedObjectID(); + const EntityID& getReferencedObjectID() const; + void setReferencedObjectID(const EntityID& pX); + + uint16_t getUpdateNumber() const; + void setUpdateNumber(uint16_t pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getModifications() const; + void setModifications(uint8_t pX); + + EntityType& getObjectType(); + const EntityType& getObjectType() const; + void setObjectType(const EntityType& pX); + + uint32_t getSpecificObjectAppearance() const; + void setSpecificObjectAppearance(uint32_t pX); + + uint16_t getGeneralObjectAppearance() const; + void setGeneralObjectAppearance(uint16_t pX); + + uint16_t getNumberOfPoints() const; + + SimulationAddress& getRequesterID(); + const SimulationAddress& getRequesterID() const; + void setRequesterID(const SimulationAddress& pX); + + SimulationAddress& getReceivingID(); + const SimulationAddress& getReceivingID() const; + void setReceivingID(const SimulationAddress& pX); + + std::vector& getObjectLocation(); + const std::vector& getObjectLocation() const; + void setObjectLocation(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ArealObjectStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/CMakeLists.txt b/src/dis7/synthetic_environment/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/synthetic_environment/LinearObjectStatePdu.cpp b/src/dis7/synthetic_environment/LinearObjectStatePdu.cpp new file mode 100644 index 00000000..869d7582 --- /dev/null +++ b/src/dis7/synthetic_environment/LinearObjectStatePdu.cpp @@ -0,0 +1,216 @@ +#include "dis7/LinearObjectStatePdu.h" + +using namespace DIS; + +LinearObjectStatePdu::LinearObjectStatePdu() + : SyntheticEnvironmentFamilyPdu(), + _objectID(), + _referencedObjectID(), + _updateNumber(0), + _forceID(0), + _numberOfSegments(0), + _requesterID(), + _receivingID(), + _objectType() { + setPduType(44); +} + +LinearObjectStatePdu::~LinearObjectStatePdu() { + _linearSegmentParameters.clear(); +} + +EntityID& LinearObjectStatePdu::getObjectID() { return _objectID; } + +const EntityID& LinearObjectStatePdu::getObjectID() const { return _objectID; } + +void LinearObjectStatePdu::setObjectID(const EntityID& pX) { _objectID = pX; } + +EntityID& LinearObjectStatePdu::getReferencedObjectID() { + return _referencedObjectID; +} + +const EntityID& LinearObjectStatePdu::getReferencedObjectID() const { + return _referencedObjectID; +} + +void LinearObjectStatePdu::setReferencedObjectID(const EntityID& pX) { + _referencedObjectID = pX; +} + +uint16_t LinearObjectStatePdu::getUpdateNumber() const { + return _updateNumber; +} + +void LinearObjectStatePdu::setUpdateNumber(uint16_t pX) { + _updateNumber = pX; +} + +uint8_t LinearObjectStatePdu::getForceID() const { return _forceID; } + +void LinearObjectStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t LinearObjectStatePdu::getNumberOfSegments() const { + return _linearSegmentParameters.size(); +} + +SimulationAddress& LinearObjectStatePdu::getRequesterID() { + return _requesterID; +} + +const SimulationAddress& LinearObjectStatePdu::getRequesterID() const { + return _requesterID; +} + +void LinearObjectStatePdu::setRequesterID(const SimulationAddress& pX) { + _requesterID = pX; +} + +SimulationAddress& LinearObjectStatePdu::getReceivingID() { + return _receivingID; +} + +const SimulationAddress& LinearObjectStatePdu::getReceivingID() const { + return _receivingID; +} + +void LinearObjectStatePdu::setReceivingID(const SimulationAddress& pX) { + _receivingID = pX; +} + +ObjectType& LinearObjectStatePdu::getObjectType() { return _objectType; } + +const ObjectType& LinearObjectStatePdu::getObjectType() const { + return _objectType; +} + +void LinearObjectStatePdu::setObjectType(const ObjectType& pX) { + _objectType = pX; +} + +std::vector& +LinearObjectStatePdu::getLinearSegmentParameters() { + return _linearSegmentParameters; +} + +const std::vector& +LinearObjectStatePdu::getLinearSegmentParameters() const { + return _linearSegmentParameters; +} + +void LinearObjectStatePdu::setLinearSegmentParameters( + const std::vector& pX) { + _linearSegmentParameters = pX; +} + +void LinearObjectStatePdu::marshal(DataStream& dataStream) const { + SyntheticEnvironmentFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _objectID.marshal(dataStream); + _referencedObjectID.marshal(dataStream); + dataStream << _updateNumber; + dataStream << _forceID; + dataStream << (uint8_t)_linearSegmentParameters.size(); + _requesterID.marshal(dataStream); + _receivingID.marshal(dataStream); + _objectType.marshal(dataStream); + + for (size_t idx = 0; idx < _linearSegmentParameters.size(); idx++) { + LinearSegmentParameter x = _linearSegmentParameters[idx]; + x.marshal(dataStream); + } +} + +void LinearObjectStatePdu::unmarshal(DataStream& dataStream) { + SyntheticEnvironmentFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _objectID.unmarshal(dataStream); + _referencedObjectID.unmarshal(dataStream); + dataStream >> _updateNumber; + dataStream >> _forceID; + dataStream >> _numberOfSegments; + _requesterID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + _objectType.unmarshal(dataStream); + + _linearSegmentParameters.clear(); + for (size_t idx = 0; idx < _numberOfSegments; idx++) { + LinearSegmentParameter x; + x.unmarshal(dataStream); + _linearSegmentParameters.push_back(x); + } +} + +bool LinearObjectStatePdu::operator==(const LinearObjectStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); + + if (!(_objectID == rhs._objectID)) ivarsEqual = false; + if (!(_referencedObjectID == rhs._referencedObjectID)) ivarsEqual = false; + if (!(_updateNumber == rhs._updateNumber)) ivarsEqual = false; + if (!(_forceID == rhs._forceID)) ivarsEqual = false; + if (!(_requesterID == rhs._requesterID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_objectType == rhs._objectType)) ivarsEqual = false; + + for (size_t idx = 0; idx < _linearSegmentParameters.size(); idx++) { + if (!(_linearSegmentParameters[idx] == rhs._linearSegmentParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int LinearObjectStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID + marshalSize = marshalSize + + _referencedObjectID.getMarshalledSize(); // _referencedObjectID + marshalSize = marshalSize + 2; // _updateNumber + marshalSize = marshalSize + 1; // _forceID + marshalSize = marshalSize + 1; // _numberOfSegments + marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType + + for (uint64_t idx = 0; idx < _linearSegmentParameters.size(); + idx++) { + LinearSegmentParameter listElement = _linearSegmentParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/LinearObjectStatePdu.h b/src/dis7/synthetic_environment/LinearObjectStatePdu.h new file mode 100644 index 00000000..66939c4b --- /dev/null +++ b/src/dis7/synthetic_environment/LinearObjectStatePdu.h @@ -0,0 +1,128 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/LinearSegmentParameter.h" +#include "dis7/ObjectType.h" +#include "dis7/SimulationAddress.h" +#include "dis7/SyntheticEnvironmentFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// : Information abut the addition or modification of a synthecic enviroment +// object that is anchored to the terrain with a single point and has size +// or orientation. Section 7.10.5 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT LinearObjectStatePdu + : public SyntheticEnvironmentFamilyPdu { + protected: + /** Object in synthetic environment */ + EntityID _objectID; + + /** Object with which this point object is associated */ + EntityID _referencedObjectID; + + /** unique update number of each state transition of an object */ + uint16_t _updateNumber; + + /** force ID */ + uint8_t _forceID; + + /** number of linear segment parameters */ + uint8_t _numberOfSegments; + + /** requesterID */ + SimulationAddress _requesterID; + + /** receiver ID */ + SimulationAddress _receivingID; + + /** Object type */ + ObjectType _objectType; + + /** Linear segment parameters */ + std::vector _linearSegmentParameters; + + public: + LinearObjectStatePdu(); + virtual ~LinearObjectStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getObjectID(); + const EntityID& getObjectID() const; + void setObjectID(const EntityID& pX); + + EntityID& getReferencedObjectID(); + const EntityID& getReferencedObjectID() const; + void setReferencedObjectID(const EntityID& pX); + + uint16_t getUpdateNumber() const; + void setUpdateNumber(uint16_t pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getNumberOfSegments() const; + + SimulationAddress& getRequesterID(); + const SimulationAddress& getRequesterID() const; + void setRequesterID(const SimulationAddress& pX); + + SimulationAddress& getReceivingID(); + const SimulationAddress& getReceivingID() const; + void setReceivingID(const SimulationAddress& pX); + + ObjectType& getObjectType(); + const ObjectType& getObjectType() const; + void setObjectType(const ObjectType& pX); + + std::vector& getLinearSegmentParameters(); + const std::vector& getLinearSegmentParameters() const; + void setLinearSegmentParameters( + const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LinearObjectStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/LinearSegmentParameter.cpp b/src/dis7/synthetic_environment/LinearSegmentParameter.cpp new file mode 100644 index 00000000..b2277735 --- /dev/null +++ b/src/dis7/synthetic_environment/LinearSegmentParameter.cpp @@ -0,0 +1,200 @@ +#include "dis7/LinearSegmentParameter.h" + +using namespace DIS; + +LinearSegmentParameter::LinearSegmentParameter() + : _segmentNumber(0), + _segmentModification(0), + _generalSegmentAppearance(0), + _specificSegmentAppearance(0), + _segmentLocation(), + _segmentOrientation(), + _segmentLength(0), + _segmentWidth(0), + _segmentHeight(0), + _segmentDepth(0) {} + +LinearSegmentParameter::~LinearSegmentParameter() {} + +uint8_t LinearSegmentParameter::getSegmentNumber() const { + return _segmentNumber; +} + +void LinearSegmentParameter::setSegmentNumber(uint8_t pX) { + _segmentNumber = pX; +} + +uint8_t LinearSegmentParameter::getSegmentModification() const { + return _segmentModification; +} + +void LinearSegmentParameter::setSegmentModification(uint8_t pX) { + _segmentModification = pX; +} + +uint16_t LinearSegmentParameter::getGeneralSegmentAppearance() const { + return _generalSegmentAppearance; +} + +void LinearSegmentParameter::setGeneralSegmentAppearance(uint16_t pX) { + _generalSegmentAppearance = pX; +} + +uint16_t LinearSegmentParameter::getSpecificSegmentAppearance() const { + return _specificSegmentAppearance; +} + +void LinearSegmentParameter::setSpecificSegmentAppearance(uint16_t pX) { + _specificSegmentAppearance = pX; +} + +Vector3Double& LinearSegmentParameter::getSegmentLocation() { + return _segmentLocation; +} + +const Vector3Double& LinearSegmentParameter::getSegmentLocation() const { + return _segmentLocation; +} + +void LinearSegmentParameter::setSegmentLocation(const Vector3Double& pX) { + _segmentLocation = pX; +} + +EulerAngles& LinearSegmentParameter::getSegmentOrientation() { + return _segmentOrientation; +} + +const EulerAngles& LinearSegmentParameter::getSegmentOrientation() const { + return _segmentOrientation; +} + +void LinearSegmentParameter::setSegmentOrientation(const EulerAngles& pX) { + _segmentOrientation = pX; +} + +uint16_t LinearSegmentParameter::getSegmentLength() const { + return _segmentLength; +} + +void LinearSegmentParameter::setSegmentLength(uint16_t pX) { + _segmentLength = pX; +} + +uint16_t LinearSegmentParameter::getSegmentWidth() const { + return _segmentWidth; +} + +void LinearSegmentParameter::setSegmentWidth(uint16_t pX) { + _segmentWidth = pX; +} + +uint16_t LinearSegmentParameter::getSegmentHeight() const { + return _segmentHeight; +} + +void LinearSegmentParameter::setSegmentHeight(uint16_t pX) { + _segmentHeight = pX; +} + +uint16_t LinearSegmentParameter::getSegmentDepth() const { + return _segmentDepth; +} + +void LinearSegmentParameter::setSegmentDepth(uint16_t pX) { + _segmentDepth = pX; +} + +void LinearSegmentParameter::marshal(DataStream& dataStream) const { + dataStream << _segmentNumber; + dataStream << _segmentModification; + dataStream << _generalSegmentAppearance; + dataStream << _specificSegmentAppearance; + _segmentLocation.marshal(dataStream); + _segmentOrientation.marshal(dataStream); + dataStream << _segmentLength; + dataStream << _segmentWidth; + dataStream << _segmentHeight; + dataStream << _segmentDepth; +} + +void LinearSegmentParameter::unmarshal(DataStream& dataStream) { + dataStream >> _segmentNumber; + dataStream >> _segmentModification; + dataStream >> _generalSegmentAppearance; + dataStream >> _specificSegmentAppearance; + _segmentLocation.unmarshal(dataStream); + _segmentOrientation.unmarshal(dataStream); + dataStream >> _segmentLength; + dataStream >> _segmentWidth; + dataStream >> _segmentHeight; + dataStream >> _segmentDepth; +} + +bool LinearSegmentParameter::operator==( + const LinearSegmentParameter& rhs) const { + bool ivarsEqual = true; + + if (!(_segmentNumber == rhs._segmentNumber)) ivarsEqual = false; + if (!(_segmentModification == rhs._segmentModification)) ivarsEqual = false; + if (!(_generalSegmentAppearance == rhs._generalSegmentAppearance)) + ivarsEqual = false; + if (!(_specificSegmentAppearance == rhs._specificSegmentAppearance)) + ivarsEqual = false; + if (!(_segmentLocation == rhs._segmentLocation)) ivarsEqual = false; + if (!(_segmentOrientation == rhs._segmentOrientation)) ivarsEqual = false; + if (!(_segmentLength == rhs._segmentLength)) ivarsEqual = false; + if (!(_segmentWidth == rhs._segmentWidth)) ivarsEqual = false; + if (!(_segmentHeight == rhs._segmentHeight)) ivarsEqual = false; + if (!(_segmentDepth == rhs._segmentDepth)) ivarsEqual = false; + + return ivarsEqual; +} + +int LinearSegmentParameter::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _segmentNumber + marshalSize = marshalSize + 1; // _segmentModification + marshalSize = marshalSize + 2; // _generalSegmentAppearance + marshalSize = marshalSize + 2; // _specificSegmentAppearance + marshalSize = + marshalSize + _segmentLocation.getMarshalledSize(); // _segmentLocation + marshalSize = marshalSize + + _segmentOrientation.getMarshalledSize(); // _segmentOrientation + marshalSize = marshalSize + 2; // _segmentLength + marshalSize = marshalSize + 2; // _segmentWidth + marshalSize = marshalSize + 2; // _segmentHeight + marshalSize = marshalSize + 2; // _segmentDepth + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/LinearSegmentParameter.h b/src/dis7/synthetic_environment/LinearSegmentParameter.h new file mode 100644 index 00000000..ce12e48a --- /dev/null +++ b/src/dis7/synthetic_environment/LinearSegmentParameter.h @@ -0,0 +1,135 @@ +#pragma once + +#include "dis7/EulerAngles.h" +#include "dis7/Vector3Double.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The specification of an individual segment of a linear segment synthetic +// environment object in a Linear Object State PDU Section 6.2.53 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT LinearSegmentParameter { + protected: + /** the individual segment of the linear segment */ + uint8_t _segmentNumber; + + /** whether a modification has been made to the point object’s location or + * orientation */ + uint8_t _segmentModification; + + /** general dynamic appearance attributes of the segment. This record shall be + * defined as a 16-bit record of enumerations. The values defined for this + * record are included in Section 12 of SISO-REF-010. */ + uint16_t _generalSegmentAppearance; + + /** This field shall specify specific dynamic appearance attributes of the + * segment. This record shall be defined as a 32-bit record of enumerations. + */ + uint16_t _specificSegmentAppearance; + + /** This field shall specify the location of the linear segment in the + * simulated world and shall be represented by a World Coordinates record */ + Vector3Double _segmentLocation; + + /** orientation of the linear segment about the segment location and shall be + * represented by a Euler Angles record */ + EulerAngles _segmentOrientation; + + /** length of the linear segment, in meters, extending in the positive X + * direction */ + uint16_t _segmentLength; + + /** The total width of the linear segment, in meters, shall be specified by a + * 16-bit uint32_teger. One-half of the width shall extend in the positive + * Y direction, and one-half of the width shall extend in the negative Y + * direction. */ + uint16_t _segmentWidth; + + /** The height of the linear segment, in meters, above ground shall be + * specified by a 16-bit uint32_teger. */ + uint16_t _segmentHeight; + + /** The depth of the linear segment, in meters, below ground level */ + uint16_t _segmentDepth; + + public: + LinearSegmentParameter(); + virtual ~LinearSegmentParameter(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getSegmentNumber() const; + void setSegmentNumber(uint8_t pX); + + uint8_t getSegmentModification() const; + void setSegmentModification(uint8_t pX); + + uint16_t getGeneralSegmentAppearance() const; + void setGeneralSegmentAppearance(uint16_t pX); + + uint16_t getSpecificSegmentAppearance() const; + void setSpecificSegmentAppearance(uint16_t pX); + + Vector3Double& getSegmentLocation(); + const Vector3Double& getSegmentLocation() const; + void setSegmentLocation(const Vector3Double& pX); + + EulerAngles& getSegmentOrientation(); + const EulerAngles& getSegmentOrientation() const; + void setSegmentOrientation(const EulerAngles& pX); + + uint16_t getSegmentLength() const; + void setSegmentLength(uint16_t pX); + + uint16_t getSegmentWidth() const; + void setSegmentWidth(uint16_t pX); + + uint16_t getSegmentHeight() const; + void setSegmentHeight(uint16_t pX); + + uint16_t getSegmentDepth() const; + void setSegmentDepth(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const LinearSegmentParameter& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/ObjectType.cpp b/src/dis7/synthetic_environment/ObjectType.cpp new file mode 100644 index 00000000..6e336030 --- /dev/null +++ b/src/dis7/synthetic_environment/ObjectType.cpp @@ -0,0 +1,90 @@ +#include "dis7/ObjectType.h" + +using namespace DIS; + +ObjectType::ObjectType() + : _domain(0), _objectKind(0), _category(0), _subcategory(0) {} + +ObjectType::~ObjectType() {} + +uint8_t ObjectType::getDomain() const { return _domain; } + +void ObjectType::setDomain(uint8_t pX) { _domain = pX; } + +uint8_t ObjectType::getObjectKind() const { return _objectKind; } + +void ObjectType::setObjectKind(uint8_t pX) { _objectKind = pX; } + +uint8_t ObjectType::getCategory() const { return _category; } + +void ObjectType::setCategory(uint8_t pX) { _category = pX; } + +uint8_t ObjectType::getSubcategory() const { return _subcategory; } + +void ObjectType::setSubcategory(uint8_t pX) { _subcategory = pX; } + +void ObjectType::marshal(DataStream& dataStream) const { + dataStream << _domain; + dataStream << _objectKind; + dataStream << _category; + dataStream << _subcategory; +} + +void ObjectType::unmarshal(DataStream& dataStream) { + dataStream >> _domain; + dataStream >> _objectKind; + dataStream >> _category; + dataStream >> _subcategory; +} + +bool ObjectType::operator==(const ObjectType& rhs) const { + bool ivarsEqual = true; + + if (!(_domain == rhs._domain)) ivarsEqual = false; + if (!(_objectKind == rhs._objectKind)) ivarsEqual = false; + if (!(_category == rhs._category)) ivarsEqual = false; + if (!(_subcategory == rhs._subcategory)) ivarsEqual = false; + + return ivarsEqual; +} + +int ObjectType::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 1; // _domain + marshalSize = marshalSize + 1; // _objectKind + marshalSize = marshalSize + 1; // _category + marshalSize = marshalSize + 1; // _subcategory + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/ObjectType.h b/src/dis7/synthetic_environment/ObjectType.h new file mode 100644 index 00000000..4991c583 --- /dev/null +++ b/src/dis7/synthetic_environment/ObjectType.h @@ -0,0 +1,82 @@ +#pragma once + +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The unique designation of an environmental object. Section 6.2.64 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT ObjectType { + protected: + /** Domain of entity (air, surface, subsurface, space, etc) */ + uint8_t _domain; + + /** country to which the design of the entity is attributed */ + uint8_t _objectKind; + + /** category of entity */ + uint8_t _category; + + /** subcategory of entity */ + uint8_t _subcategory; + + public: + ObjectType(); + virtual ~ObjectType(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint8_t getDomain() const; + void setDomain(uint8_t pX); + + uint8_t getObjectKind() const; + void setObjectKind(uint8_t pX); + + uint8_t getCategory() const; + void setCategory(uint8_t pX); + + uint8_t getSubcategory() const; + void setSubcategory(uint8_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const ObjectType& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/PointObjectStatePdu.cpp b/src/dis7/synthetic_environment/PointObjectStatePdu.cpp new file mode 100644 index 00000000..deeedee7 --- /dev/null +++ b/src/dis7/synthetic_environment/PointObjectStatePdu.cpp @@ -0,0 +1,238 @@ +#include "dis7/PointObjectStatePdu.h" + +using namespace DIS; + +PointObjectStatePdu::PointObjectStatePdu() + : SyntheticEnvironmentFamilyPdu(), + _objectID(), + _referencedObjectID(), + _updateNumber(0), + _forceID(0), + _modifications(0), + _objectType(), + _objectLocation(), + _objectOrientation(), + _objectAppearance(0.0), + _requesterID(), + _receivingID(), + _pad2(0) { + setPduType(43); +} + +PointObjectStatePdu::~PointObjectStatePdu() {} + +EntityID& PointObjectStatePdu::getObjectID() { return _objectID; } + +const EntityID& PointObjectStatePdu::getObjectID() const { return _objectID; } + +void PointObjectStatePdu::setObjectID(const EntityID& pX) { _objectID = pX; } + +EntityID& PointObjectStatePdu::getReferencedObjectID() { + return _referencedObjectID; +} + +const EntityID& PointObjectStatePdu::getReferencedObjectID() const { + return _referencedObjectID; +} + +void PointObjectStatePdu::setReferencedObjectID(const EntityID& pX) { + _referencedObjectID = pX; +} + +uint16_t PointObjectStatePdu::getUpdateNumber() const { + return _updateNumber; +} + +void PointObjectStatePdu::setUpdateNumber(uint16_t pX) { + _updateNumber = pX; +} + +uint8_t PointObjectStatePdu::getForceID() const { return _forceID; } + +void PointObjectStatePdu::setForceID(uint8_t pX) { _forceID = pX; } + +uint8_t PointObjectStatePdu::getModifications() const { + return _modifications; +} + +void PointObjectStatePdu::setModifications(uint8_t pX) { + _modifications = pX; +} + +ObjectType& PointObjectStatePdu::getObjectType() { return _objectType; } + +const ObjectType& PointObjectStatePdu::getObjectType() const { + return _objectType; +} + +void PointObjectStatePdu::setObjectType(const ObjectType& pX) { + _objectType = pX; +} + +Vector3Double& PointObjectStatePdu::getObjectLocation() { + return _objectLocation; +} + +const Vector3Double& PointObjectStatePdu::getObjectLocation() const { + return _objectLocation; +} + +void PointObjectStatePdu::setObjectLocation(const Vector3Double& pX) { + _objectLocation = pX; +} + +EulerAngles& PointObjectStatePdu::getObjectOrientation() { + return _objectOrientation; +} + +const EulerAngles& PointObjectStatePdu::getObjectOrientation() const { + return _objectOrientation; +} + +void PointObjectStatePdu::setObjectOrientation(const EulerAngles& pX) { + _objectOrientation = pX; +} + +double PointObjectStatePdu::getObjectAppearance() const { + return _objectAppearance; +} + +void PointObjectStatePdu::setObjectAppearance(double pX) { + _objectAppearance = pX; +} + +SimulationAddress& PointObjectStatePdu::getRequesterID() { + return _requesterID; +} + +const SimulationAddress& PointObjectStatePdu::getRequesterID() const { + return _requesterID; +} + +void PointObjectStatePdu::setRequesterID(const SimulationAddress& pX) { + _requesterID = pX; +} + +SimulationAddress& PointObjectStatePdu::getReceivingID() { + return _receivingID; +} + +const SimulationAddress& PointObjectStatePdu::getReceivingID() const { + return _receivingID; +} + +void PointObjectStatePdu::setReceivingID(const SimulationAddress& pX) { + _receivingID = pX; +} + +uint32_t PointObjectStatePdu::getPad2() const { return _pad2; } + +void PointObjectStatePdu::setPad2(uint32_t pX) { _pad2 = pX; } + +void PointObjectStatePdu::marshal(DataStream& dataStream) const { + SyntheticEnvironmentFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _objectID.marshal(dataStream); + _referencedObjectID.marshal(dataStream); + dataStream << _updateNumber; + dataStream << _forceID; + dataStream << _modifications; + _objectType.marshal(dataStream); + _objectLocation.marshal(dataStream); + _objectOrientation.marshal(dataStream); + dataStream << _objectAppearance; + _requesterID.marshal(dataStream); + _receivingID.marshal(dataStream); + dataStream << _pad2; +} + +void PointObjectStatePdu::unmarshal(DataStream& dataStream) { + SyntheticEnvironmentFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _objectID.unmarshal(dataStream); + _referencedObjectID.unmarshal(dataStream); + dataStream >> _updateNumber; + dataStream >> _forceID; + dataStream >> _modifications; + _objectType.unmarshal(dataStream); + _objectLocation.unmarshal(dataStream); + _objectOrientation.unmarshal(dataStream); + dataStream >> _objectAppearance; + _requesterID.unmarshal(dataStream); + _receivingID.unmarshal(dataStream); + dataStream >> _pad2; +} + +bool PointObjectStatePdu::operator==(const PointObjectStatePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = SyntheticEnvironmentFamilyPdu::operator==(rhs); + + if (!(_objectID == rhs._objectID)) ivarsEqual = false; + if (!(_referencedObjectID == rhs._referencedObjectID)) ivarsEqual = false; + if (!(_updateNumber == rhs._updateNumber)) ivarsEqual = false; + if (!(_forceID == rhs._forceID)) ivarsEqual = false; + if (!(_modifications == rhs._modifications)) ivarsEqual = false; + if (!(_objectType == rhs._objectType)) ivarsEqual = false; + if (!(_objectLocation == rhs._objectLocation)) ivarsEqual = false; + if (!(_objectOrientation == rhs._objectOrientation)) ivarsEqual = false; + if (!(_objectAppearance == rhs._objectAppearance)) ivarsEqual = false; + if (!(_requesterID == rhs._requesterID)) ivarsEqual = false; + if (!(_receivingID == rhs._receivingID)) ivarsEqual = false; + if (!(_pad2 == rhs._pad2)) ivarsEqual = false; + + return ivarsEqual; +} + +int PointObjectStatePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = SyntheticEnvironmentFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + _objectID.getMarshalledSize(); // _objectID + marshalSize = marshalSize + + _referencedObjectID.getMarshalledSize(); // _referencedObjectID + marshalSize = marshalSize + 2; // _updateNumber + marshalSize = marshalSize + 1; // _forceID + marshalSize = marshalSize + 1; // _modifications + marshalSize = marshalSize + _objectType.getMarshalledSize(); // _objectType + marshalSize = + marshalSize + _objectLocation.getMarshalledSize(); // _objectLocation + marshalSize = marshalSize + + _objectOrientation.getMarshalledSize(); // _objectOrientation + marshalSize = marshalSize + 8; // _objectAppearance + marshalSize = marshalSize + _requesterID.getMarshalledSize(); // _requesterID + marshalSize = marshalSize + _receivingID.getMarshalledSize(); // _receivingID + marshalSize = marshalSize + 4; // _pad2 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/PointObjectStatePdu.h b/src/dis7/synthetic_environment/PointObjectStatePdu.h new file mode 100644 index 00000000..7f5a96cc --- /dev/null +++ b/src/dis7/synthetic_environment/PointObjectStatePdu.h @@ -0,0 +1,146 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/EulerAngles.h" +#include "dis7/ObjectType.h" +#include "dis7/SimulationAddress.h" +#include "dis7/SyntheticEnvironmentFamilyPdu.h" +#include "dis7/Vector3Double.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// : Inormation abut the addition or modification of a synthecic enviroment +// object that is anchored to the terrain with a single point. Section 7.10.4 +// COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT PointObjectStatePdu + : public SyntheticEnvironmentFamilyPdu { + protected: + /** Object in synthetic environment */ + EntityID _objectID; + + /** Object with which this point object is associated */ + EntityID _referencedObjectID; + + /** unique update number of each state transition of an object */ + uint16_t _updateNumber; + + /** force ID */ + uint8_t _forceID; + + /** modifications */ + uint8_t _modifications; + + /** Object type */ + ObjectType _objectType; + + /** Object location */ + Vector3Double _objectLocation; + + /** Object orientation */ + EulerAngles _objectOrientation; + + /** Object apperance */ + double _objectAppearance; + + /** requesterID */ + SimulationAddress _requesterID; + + /** receiver ID */ + SimulationAddress _receivingID; + + /** padding */ + uint32_t _pad2; + + public: + PointObjectStatePdu(); + virtual ~PointObjectStatePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getObjectID(); + const EntityID& getObjectID() const; + void setObjectID(const EntityID& pX); + + EntityID& getReferencedObjectID(); + const EntityID& getReferencedObjectID() const; + void setReferencedObjectID(const EntityID& pX); + + uint16_t getUpdateNumber() const; + void setUpdateNumber(uint16_t pX); + + uint8_t getForceID() const; + void setForceID(uint8_t pX); + + uint8_t getModifications() const; + void setModifications(uint8_t pX); + + ObjectType& getObjectType(); + const ObjectType& getObjectType() const; + void setObjectType(const ObjectType& pX); + + Vector3Double& getObjectLocation(); + const Vector3Double& getObjectLocation() const; + void setObjectLocation(const Vector3Double& pX); + + EulerAngles& getObjectOrientation(); + const EulerAngles& getObjectOrientation() const; + void setObjectOrientation(const EulerAngles& pX); + + double getObjectAppearance() const; + void setObjectAppearance(double pX); + + SimulationAddress& getRequesterID(); + const SimulationAddress& getRequesterID() const; + void setRequesterID(const SimulationAddress& pX); + + SimulationAddress& getReceivingID(); + const SimulationAddress& getReceivingID() const; + void setReceivingID(const SimulationAddress& pX); + + uint32_t getPad2() const; + void setPad2(uint32_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const PointObjectStatePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/SyntheticEnvironmentFamilyPdu.cpp b/src/dis7/synthetic_environment/SyntheticEnvironmentFamilyPdu.cpp new file mode 100644 index 00000000..2378f631 --- /dev/null +++ b/src/dis7/synthetic_environment/SyntheticEnvironmentFamilyPdu.cpp @@ -0,0 +1,64 @@ +#include "dis7/SyntheticEnvironmentFamilyPdu.h" + +using namespace DIS; + +SyntheticEnvironmentFamilyPdu::SyntheticEnvironmentFamilyPdu() : Pdu() { + setProtocolFamily(9); +} + +SyntheticEnvironmentFamilyPdu::~SyntheticEnvironmentFamilyPdu() {} + +void SyntheticEnvironmentFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first +} + +void SyntheticEnvironmentFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first +} + +bool SyntheticEnvironmentFamilyPdu::operator==( + const SyntheticEnvironmentFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + return ivarsEqual; +} + +int SyntheticEnvironmentFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/synthetic_environment/SyntheticEnvironmentFamilyPdu.h b/src/dis7/synthetic_environment/SyntheticEnvironmentFamilyPdu.h new file mode 100644 index 00000000..91d767a4 --- /dev/null +++ b/src/dis7/synthetic_environment/SyntheticEnvironmentFamilyPdu.h @@ -0,0 +1,59 @@ +#pragma once + +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Section 5.3.11: Abstract superclass for synthetic environment PDUs + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT SyntheticEnvironmentFamilyPdu : public Pdu { + protected: + public: + SyntheticEnvironmentFamilyPdu(); + virtual ~SyntheticEnvironmentFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + virtual int getMarshalledSize() const; + + bool operator==(const SyntheticEnvironmentFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/utils/DataStream.cpp b/src/dis7/utils/DataStream.cpp index 3cf24912..f8c590d5 100644 --- a/src/dis7/utils/DataStream.cpp +++ b/src/dis7/utils/DataStream.cpp @@ -1,284 +1,225 @@ -#include +#include // for debug output -#include // for debug output +#include using namespace DIS; DataStream::DataStream(Endian stream) - : _buffer() - , _read_pos(0) - , _write_pos(0) - , _stream_endian(stream) - , _machine_endian(LITTLE) -{ - long one(1); - char e = (reinterpret_cast( &one ))[0]; - - if( e == (char)1 ) - { - _machine_endian = LITTLE; - } - else - { - _machine_endian = BIG; - } + : _buffer(), + _read_pos(0), + _write_pos(0), + _stream_endian(stream), + _machine_endian(LITTLE) { + long one(1); + char e = (reinterpret_cast(&one))[0]; + + if (e == (char)1) { + _machine_endian = LITTLE; + } else { + _machine_endian = BIG; + } } DataStream::DataStream(const char* buffer, size_t length, Endian stream) - : _buffer() - , _read_pos(0) - , _write_pos(0) - , _stream_endian(stream) - , _machine_endian(LITTLE) -{ - long one(1); - char e = (reinterpret_cast( &one ))[0]; - - if( e == (char)1 ) - { - _machine_endian = LITTLE; - } - else - { - _machine_endian = BIG; - } - - SetStream( buffer, length, stream ); -} -DataStream::~DataStream() -{ + : _buffer(), + _read_pos(0), + _write_pos(0), + _stream_endian(stream), + _machine_endian(LITTLE) { + long one(1); + char e = (reinterpret_cast(&one))[0]; + + if (e == (char)1) { + _machine_endian = LITTLE; + } else { + _machine_endian = BIG; + } + + SetStream(buffer, length, stream); } +DataStream::~DataStream() {} -//const DataStream::BufferType& DataStream::GetBuffer() const +// const DataStream::BufferType& DataStream::GetBuffer() const //{ -// return _buffer; -//} +// return _buffer; +// } -Endian DataStream::GetStreamEndian() const -{ - return _stream_endian; -} +Endian DataStream::GetStreamEndian() const { return _stream_endian; } -Endian DataStream::GetMachineEndian() const -{ - return _machine_endian; -} +Endian DataStream::GetMachineEndian() const { return _machine_endian; } -size_t DataStream::GetWritePos() const -{ - return _write_pos; -} +size_t DataStream::GetWritePos() const { return _write_pos; } -size_t DataStream::GetReadPos() const -{ - return _read_pos; -} +size_t DataStream::GetReadPos() const { return _read_pos; } -size_t DataStream::size() const -{ - return _buffer.size(); -} +size_t DataStream::size() const { return _buffer.size(); } -void DataStream::clear() -{ - _write_pos = 0; - _read_pos = 0; - _buffer.clear(); +void DataStream::clear() { + _write_pos = 0; + _read_pos = 0; + _buffer.clear(); } -bool DataStream::empty() const -{ - return _buffer.empty(); -} +bool DataStream::empty() const { return _buffer.empty(); } -const char& DataStream::operator [](unsigned int offset) const -{ - return _buffer[_read_pos+offset]; +const char& DataStream::operator[](uint32_t offset) const { + return _buffer[_read_pos + offset]; } // currently copies the source data. -void DataStream::SetStream(const char* buffer, size_t length, Endian stream) -{ - // reassign the endian - _stream_endian = stream; - - _write_pos = length; - _read_pos = 0; - - // resize the array - if( _buffer.size() < length ) - { - _buffer.resize( length ); - } - - // take ownership of the data - // copy the data, expensive! - for(unsigned int i=0; i>(char& c) -{ - ReadAlgorithm( c ); - return *this; +DataStream& DataStream::operator>>(char& c) { + ReadAlgorithm(c); + return *this; } -DataStream& DataStream::operator >>(unsigned char& c) -{ - ReadAlgorithm( c ); - return *this; +DataStream& DataStream::operator>>(uint8_t& c) { + ReadAlgorithm(c); + return *this; } -DataStream& DataStream::operator >>(float& f) -{ - ReadAlgorithm( f ); - return *this; +DataStream& DataStream::operator>>(float& f) { + ReadAlgorithm(f); + return *this; } -DataStream& DataStream::operator >>(double& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(double& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(int& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(int& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(unsigned int& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(uint32_t& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(long long& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(int64_t& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(unsigned long long& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(uint64_t& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(unsigned short& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(uint16_t& d) { + ReadAlgorithm(d); + return *this; } -DataStream& DataStream::operator >>(short& d) -{ - ReadAlgorithm( d ); - return *this; +DataStream& DataStream::operator>>(int16_t& d) { + ReadAlgorithm(d); + return *this; } diff --git a/src/dis7/utils/DataStream.h b/src/dis7/utils/DataStream.h index 99c78bf3..42737cba 100644 --- a/src/dis7/utils/DataStream.h +++ b/src/dis7/utils/DataStream.h @@ -6,148 +6,142 @@ #define _dcl_dis_data_stream_h_ // the class member, DataStream::BufferType is causing warnign 4251. -// disable it until a proper fix is found, as instructed from the enlightening article: -// http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html +// disable it until a proper fix is found, as instructed from the enlightening +// article: http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html #if _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4251 ) +#pragma warning(push) +#pragma warning(disable : 4251) #endif -#include // for typedef, member -#include // for typedef, member -#include // for enum -#include // for library symbols -#include // for size_t and NULL definition -#include // for memcpy - -namespace DIS -{ - /// a class to support managing a network buffer. - /// the clients are responsible for managing the char buffer memory. - /// this class explicitly defines operators for expected types. - class OPENDIS7_EXPORT DataStream - { - public: - /// Setup the internal buffer's Endian type. - /// @param stream the Endian type to use for the internal buffer, - /// which will be used for network socket writes. - DataStream(Endian stream); - - /// Setup the internal buffer. - /// @param buffer the data to copy and manage. - /// @param length the number of bytes in the buffer. - /// @param stream the Endian type to use for the internal buffer, - DataStream(const char* buffer, size_t length, Endian stream); - ~DataStream(); - - /// a method for reading the stored buffer data. - /// @param offset the index distance with respect to the current read point. - const char& operator [](unsigned int offset) const; - - /// take ownership of the data buffer. - void SetStream(const char* buffer, size_t length, Endian order); - - // write operations - DataStream& operator <<(bool c); - DataStream& operator <<(char c); - DataStream& operator <<(unsigned char c); - DataStream& operator <<(float c); - DataStream& operator <<(double c); - DataStream& operator <<(int c); - DataStream& operator <<(unsigned int c); - DataStream& operator <<(long long c); - DataStream& operator <<(unsigned long long c); - DataStream& operator <<(unsigned short c); - DataStream& operator <<(short c); - - // read operations - DataStream& operator >>(bool& c); - DataStream& operator >>(char& c); - DataStream& operator >>(unsigned char& c); - DataStream& operator >>(float& c); - DataStream& operator >>(double& c); - DataStream& operator >>(int& c); - DataStream& operator >>(unsigned int& c); - DataStream& operator >>(long long& c); - DataStream& operator >>(unsigned long long& c); - DataStream& operator >>(unsigned short& c); - DataStream& operator >>(short& c); - - Endian GetStreamEndian() const; - Endian GetMachineEndian() const; - - size_t GetWritePos() const; - size_t GetReadPos() const; - - size_t size() const; - - void clear(); - - bool empty() const; - - private: - template - void IncrementPointer(IterT& iter) - { - iter += sizeof(T); - } - - template - void DecrementPointer(IterT& iter) - { - iter -= sizeof(T); - } - - /// this algorithm should only be used for primitive types, - /// because the class size takes into account the virtual function table. - template - void WriteAlgorithm(T t) - { - char* ch = reinterpret_cast( &t ); - DoFlip( ch , sizeof(T) ); - DoWrite( ch , sizeof(T) ); - IncrementPointer( _write_pos ); - } - - /// this algorithm should only be used for primitive types, - /// because the class size takes into account the virtual function table. - template - void ReadAlgorithm(T& t) - { - char ch[sizeof(T)]; - DoRead( ch , sizeof(T) ); - DoFlip( ch , sizeof(T) ); - memcpy(&t, ch, sizeof(t)); - IncrementPointer( _read_pos ); - } - - /// will flip the buffer if the buffer endian is different than the machine's. - void DoFlip(char* buf, size_t bufsize); - - void DoWrite(const char* buf, size_t bufsize); - - void DoRead(char* ch, size_t bufsize); - - - typedef std::vector BufferType; - //const BufferType& GetBuffer() const; - - BufferType _buffer; - - /// the location of the read/write. - size_t _read_pos; - size_t _write_pos; - - /// the requirement for the managed buffer - Endian _stream_endian; - - /// the native endian type - Endian _machine_endian; - }; -} +#include // for size_t and NULL definition +#include // for memcpy +#include // for typedef, member +#include // for typedef, member + +#include // for library symbols +#include // for enum + +namespace DIS { +/// a class to support managing a network buffer. +/// the clients are responsible for managing the char buffer memory. +/// this class explicitly defines operators for expected types. +class OPENDIS7_EXPORT DataStream { + public: + /// Setup the internal buffer's Endian type. + /// @param stream the Endian type to use for the internal buffer, + /// which will be used for network socket writes. + DataStream(Endian stream); + + /// Setup the internal buffer. + /// @param buffer the data to copy and manage. + /// @param length the number of bytes in the buffer. + /// @param stream the Endian type to use for the internal buffer, + DataStream(const char* buffer, size_t length, Endian stream); + ~DataStream(); + + /// a method for reading the stored buffer data. + /// @param offset the index distance with respect to the current read point. + const char& operator[](uint32_t offset) const; + + /// take ownership of the data buffer. + void SetStream(const char* buffer, size_t length, Endian order); + + // write operations + DataStream& operator<<(bool c); + DataStream& operator<<(char c); + DataStream& operator<<(uint8_t c); + DataStream& operator<<(float c); + DataStream& operator<<(double c); + DataStream& operator<<(int c); + DataStream& operator<<(uint32_t c); + DataStream& operator<<(int64_t c); + DataStream& operator<<(uint64_t c); + DataStream& operator<<(uint16_t c); + DataStream& operator<<(int16_t c); + + // read operations + DataStream& operator>>(bool& c); + DataStream& operator>>(char& c); + DataStream& operator>>(uint8_t& c); + DataStream& operator>>(float& c); + DataStream& operator>>(double& c); + DataStream& operator>>(int& c); + DataStream& operator>>(uint32_t& c); + DataStream& operator>>(int64_t& c); + DataStream& operator>>(uint64_t& c); + DataStream& operator>>(uint16_t& c); + DataStream& operator>>(int16_t& c); + + Endian GetStreamEndian() const; + Endian GetMachineEndian() const; + + size_t GetWritePos() const; + size_t GetReadPos() const; + + size_t size() const; + + void clear(); + + bool empty() const; + + private: + template + void IncrementPointer(IterT& iter) { + iter += sizeof(T); + } + + template + void DecrementPointer(IterT& iter) { + iter -= sizeof(T); + } + + /// this algorithm should only be used for primitive types, + /// because the class size takes into account the virtual function table. + template + void WriteAlgorithm(T t) { + char* ch = reinterpret_cast(&t); + DoFlip(ch, sizeof(T)); + DoWrite(ch, sizeof(T)); + IncrementPointer(_write_pos); + } + + /// this algorithm should only be used for primitive types, + /// because the class size takes into account the virtual function table. + template + void ReadAlgorithm(T& t) { + char ch[sizeof(T)]; + DoRead(ch, sizeof(T)); + DoFlip(ch, sizeof(T)); + memcpy(&t, ch, sizeof(t)); + IncrementPointer(_read_pos); + } + + /// will flip the buffer if the buffer endian is different than the machine's. + void DoFlip(char* buf, size_t bufsize); + + void DoWrite(const char* buf, size_t bufsize); + + void DoRead(char* ch, size_t bufsize); + + typedef std::vector BufferType; + // const BufferType& GetBuffer() const; + + BufferType _buffer; + + /// the location of the read/write. + size_t _read_pos; + size_t _write_pos; + + /// the requirement for the managed buffer + Endian _stream_endian; + + /// the native endian type + Endian _machine_endian; +}; +} // namespace DIS #if _MSC_VER -#pragma warning( pop ) +#pragma warning(pop) #endif #endif // _dcl_dis_data_stream_h_ diff --git a/src/dis7/utils/Endian.h b/src/dis7/utils/Endian.h index 56d990ce..037f5d80 100644 --- a/src/dis7/utils/Endian.h +++ b/src/dis7/utils/Endian.h @@ -1,16 +1,14 @@ #ifndef _dcl_dis_endian_h_ #define _dcl_dis_endian_h_ -#include // for library symbols +#include // for library symbols -namespace DIS -{ - /// the order of bytes that are on the left - enum OPENDIS7_EXPORT Endian - { - LITTLE=1, - BIG=0, - }; -} +namespace DIS { +/// the order of bytes that are on the left +enum OPENDIS7_EXPORT Endian { + LITTLE = 1, + BIG = 0, +}; +} // namespace DIS -#endif // _dcl_dis_endian_h_ +#endif // _dcl_dis_endian_h_ diff --git a/src/dis7/warfare/CMakeLists.txt b/src/dis7/warfare/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/dis7/warfare/DetonationPdu.cpp b/src/dis7/warfare/DetonationPdu.cpp new file mode 100644 index 00000000..4be2b818 --- /dev/null +++ b/src/dis7/warfare/DetonationPdu.cpp @@ -0,0 +1,227 @@ +#include "dis7/DetonationPdu.h" + +using namespace DIS; + +DetonationPdu::DetonationPdu() + : WarfareFamilyPdu(), + _explodingEntityID(), + _eventID(), + _velocity(), + _locationInWorldCoordinates(), + _descriptor(), + _locationOfEntityCoordinates(), + _detonationResult(0), + _numberOfVariableParameters(0), + _pad(0) { + setPduType(3); +} + +DetonationPdu::~DetonationPdu() { _variableParameters.clear(); } + +EntityID& DetonationPdu::getExplodingEntityID() { return _explodingEntityID; } + +const EntityID& DetonationPdu::getExplodingEntityID() const { + return _explodingEntityID; +} + +void DetonationPdu::setExplodingEntityID(const EntityID& pX) { + _explodingEntityID = pX; +} + +EventIdentifier& DetonationPdu::getEventID() { return _eventID; } + +const EventIdentifier& DetonationPdu::getEventID() const { return _eventID; } + +void DetonationPdu::setEventID(const EventIdentifier& pX) { _eventID = pX; } + +Vector3Float& DetonationPdu::getVelocity() { return _velocity; } + +const Vector3Float& DetonationPdu::getVelocity() const { return _velocity; } + +void DetonationPdu::setVelocity(const Vector3Float& pX) { _velocity = pX; } + +Vector3Double& DetonationPdu::getLocationInWorldCoordinates() { + return _locationInWorldCoordinates; +} + +const Vector3Double& DetonationPdu::getLocationInWorldCoordinates() const { + return _locationInWorldCoordinates; +} + +void DetonationPdu::setLocationInWorldCoordinates(const Vector3Double& pX) { + _locationInWorldCoordinates = pX; +} + +MunitionDescriptor& DetonationPdu::getDescriptor() { return _descriptor; } + +const MunitionDescriptor& DetonationPdu::getDescriptor() const { + return _descriptor; +} + +void DetonationPdu::setDescriptor(const MunitionDescriptor& pX) { + _descriptor = pX; +} + +Vector3Float& DetonationPdu::getLocationOfEntityCoordinates() { + return _locationOfEntityCoordinates; +} + +const Vector3Float& DetonationPdu::getLocationOfEntityCoordinates() const { + return _locationOfEntityCoordinates; +} + +void DetonationPdu::setLocationOfEntityCoordinates(const Vector3Float& pX) { + _locationOfEntityCoordinates = pX; +} + +uint8_t DetonationPdu::getDetonationResult() const { + return _detonationResult; +} + +void DetonationPdu::setDetonationResult(uint8_t pX) { + _detonationResult = pX; +} + +uint8_t DetonationPdu::getNumberOfVariableParameters() const { + return _variableParameters.size(); +} + +uint16_t DetonationPdu::getPad() const { return _pad; } + +void DetonationPdu::setPad(uint16_t pX) { _pad = pX; } + +std::vector& DetonationPdu::getVariableParameters() { + return _variableParameters; +} + +const std::vector& DetonationPdu::getVariableParameters() + const { + return _variableParameters; +} + +void DetonationPdu::setVariableParameters( + const std::vector& pX) { + _variableParameters = pX; +} + +void DetonationPdu::marshal(DataStream& dataStream) const { + WarfareFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _explodingEntityID.marshal(dataStream); + _eventID.marshal(dataStream); + _velocity.marshal(dataStream); + _locationInWorldCoordinates.marshal(dataStream); + _descriptor.marshal(dataStream); + _locationOfEntityCoordinates.marshal(dataStream); + dataStream << _detonationResult; + dataStream << (uint8_t)_variableParameters.size(); + dataStream << _pad; + + for (size_t idx = 0; idx < _variableParameters.size(); idx++) { + VariableParameter x = _variableParameters[idx]; + x.marshal(dataStream); + } +} + +void DetonationPdu::unmarshal(DataStream& dataStream) { + WarfareFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _explodingEntityID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + _velocity.unmarshal(dataStream); + _locationInWorldCoordinates.unmarshal(dataStream); + _descriptor.unmarshal(dataStream); + _locationOfEntityCoordinates.unmarshal(dataStream); + dataStream >> _detonationResult; + dataStream >> _numberOfVariableParameters; + dataStream >> _pad; + + _variableParameters.clear(); + for (size_t idx = 0; idx < _numberOfVariableParameters; idx++) { + VariableParameter x; + x.unmarshal(dataStream); + _variableParameters.push_back(x); + } +} + +bool DetonationPdu::operator==(const DetonationPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = WarfareFamilyPdu::operator==(rhs); + + if (!(_explodingEntityID == rhs._explodingEntityID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_velocity == rhs._velocity)) ivarsEqual = false; + if (!(_locationInWorldCoordinates == rhs._locationInWorldCoordinates)) + ivarsEqual = false; + if (!(_descriptor == rhs._descriptor)) ivarsEqual = false; + if (!(_locationOfEntityCoordinates == rhs._locationOfEntityCoordinates)) + ivarsEqual = false; + if (!(_detonationResult == rhs._detonationResult)) ivarsEqual = false; + if (!(_pad == rhs._pad)) ivarsEqual = false; + + for (size_t idx = 0; idx < _variableParameters.size(); idx++) { + if (!(_variableParameters[idx] == rhs._variableParameters[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int DetonationPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = WarfareFamilyPdu::getMarshalledSize(); + marshalSize = marshalSize + + _explodingEntityID.getMarshalledSize(); // _explodingEntityID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity + marshalSize = + marshalSize + _locationInWorldCoordinates + .getMarshalledSize(); // _locationInWorldCoordinates + marshalSize = marshalSize + _descriptor.getMarshalledSize(); // _descriptor + marshalSize = + marshalSize + _locationOfEntityCoordinates + .getMarshalledSize(); // _locationOfEntityCoordinates + marshalSize = marshalSize + 1; // _detonationResult + marshalSize = marshalSize + 1; // _numberOfVariableParameters + marshalSize = marshalSize + 2; // _pad + + for (uint64_t idx = 0; idx < _variableParameters.size(); idx++) { + VariableParameter listElement = _variableParameters[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/DetonationPdu.h b/src/dis7/warfare/DetonationPdu.h new file mode 100644 index 00000000..6bda223a --- /dev/null +++ b/src/dis7/warfare/DetonationPdu.h @@ -0,0 +1,138 @@ +#pragma once + +#include + +#include "dis7/EntityID.h" +#include "dis7/EventIdentifier.h" +#include "dis7/MunitionDescriptor.h" +#include "dis7/VariableParameter.h" +#include "dis7/Vector3Double.h" +#include "dis7/Vector3Float.h" +#include "dis7/WarfareFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Detonation or impact of munitions, as well as, non-munition explosions, the +// burst or initial bloom of chaff, and the ignition of a flare shall be +// indicated. Section 7.3.3 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DetonationPdu : public WarfareFamilyPdu { + protected: + /** ID of the expendable entity, Section 7.3.3 */ + EntityID _explodingEntityID; + + /** ID of event, Section 7.3.3 */ + EventIdentifier _eventID; + + /** velocity of the munition immediately before detonation/impact, + * Section 7.3.3 */ + Vector3Float _velocity; + + /** location of the munition detonation, the expendable detonation, + * Section 7.3.3 */ + Vector3Double _locationInWorldCoordinates; + + /** Describes the detonation represented, Section 7.3.3 */ + MunitionDescriptor _descriptor; + + /** Velocity of the ammunition, Section 7.3.3 */ + Vector3Float _locationOfEntityCoordinates; + + /** result of the detonation, Section 7.3.3 */ + uint8_t _detonationResult; + + /** How many articulation parameters we have, Section 7.3.3 */ + uint8_t _numberOfVariableParameters; + + /** padding */ + uint16_t _pad; + + /** specify the parameter values for each Variable Parameter record, + * Section 7.3.3 */ + std::vector _variableParameters; + + public: + DetonationPdu(); + virtual ~DetonationPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getExplodingEntityID(); + const EntityID& getExplodingEntityID() const; + void setExplodingEntityID(const EntityID& pX); + + EventIdentifier& getEventID(); + const EventIdentifier& getEventID() const; + void setEventID(const EventIdentifier& pX); + + Vector3Float& getVelocity(); + const Vector3Float& getVelocity() const; + void setVelocity(const Vector3Float& pX); + + Vector3Double& getLocationInWorldCoordinates(); + const Vector3Double& getLocationInWorldCoordinates() const; + void setLocationInWorldCoordinates(const Vector3Double& pX); + + MunitionDescriptor& getDescriptor(); + const MunitionDescriptor& getDescriptor() const; + void setDescriptor(const MunitionDescriptor& pX); + + Vector3Float& getLocationOfEntityCoordinates(); + const Vector3Float& getLocationOfEntityCoordinates() const; + void setLocationOfEntityCoordinates(const Vector3Float& pX); + + uint8_t getDetonationResult() const; + void setDetonationResult(uint8_t pX); + + uint8_t getNumberOfVariableParameters() const; + + uint16_t getPad() const; + void setPad(uint16_t pX); + + std::vector& getVariableParameters(); + const std::vector& getVariableParameters() const; + void setVariableParameters(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DetonationPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/DirectedEnergyDamage.cpp b/src/dis7/warfare/DirectedEnergyDamage.cpp new file mode 100644 index 00000000..f4e176d0 --- /dev/null +++ b/src/dis7/warfare/DirectedEnergyDamage.cpp @@ -0,0 +1,206 @@ +#include "dis7/DirectedEnergyDamage.h" + +using namespace DIS; + +DirectedEnergyDamage::DirectedEnergyDamage() + : _recordType(4500), + _recordLength(40), + _padding(0), + _damageLocation(), + _damageDiameter(0.0), + _temperature(-273.15), + _componentIdentification(0), + _componentDamageStatus(0), + _componentVisualDamageStatus(0), + _componentVisualSmokeColor(0), + _fireEventID(), + _padding2(0) {} + +DirectedEnergyDamage::~DirectedEnergyDamage() {} + +uint32_t DirectedEnergyDamage::getRecordType() const { return _recordType; } + +void DirectedEnergyDamage::setRecordType(uint32_t pX) { _recordType = pX; } + +uint16_t DirectedEnergyDamage::getRecordLength() const { + return _recordLength; +} + +void DirectedEnergyDamage::setRecordLength(uint16_t pX) { + _recordLength = pX; +} + +uint16_t DirectedEnergyDamage::getPadding() const { return _padding; } + +void DirectedEnergyDamage::setPadding(uint16_t pX) { _padding = pX; } + +Vector3Float& DirectedEnergyDamage::getDamageLocation() { + return _damageLocation; +} + +const Vector3Float& DirectedEnergyDamage::getDamageLocation() const { + return _damageLocation; +} + +void DirectedEnergyDamage::setDamageLocation(const Vector3Float& pX) { + _damageLocation = pX; +} + +float DirectedEnergyDamage::getDamageDiameter() const { + return _damageDiameter; +} + +void DirectedEnergyDamage::setDamageDiameter(float pX) { _damageDiameter = pX; } + +float DirectedEnergyDamage::getTemperature() const { return _temperature; } + +void DirectedEnergyDamage::setTemperature(float pX) { _temperature = pX; } + +uint8_t DirectedEnergyDamage::getComponentIdentification() const { + return _componentIdentification; +} + +void DirectedEnergyDamage::setComponentIdentification(uint8_t pX) { + _componentIdentification = pX; +} + +uint8_t DirectedEnergyDamage::getComponentDamageStatus() const { + return _componentDamageStatus; +} + +void DirectedEnergyDamage::setComponentDamageStatus(uint8_t pX) { + _componentDamageStatus = pX; +} + +uint8_t DirectedEnergyDamage::getComponentVisualDamageStatus() const { + return _componentVisualDamageStatus; +} + +void DirectedEnergyDamage::setComponentVisualDamageStatus(uint8_t pX) { + _componentVisualDamageStatus = pX; +} + +uint8_t DirectedEnergyDamage::getComponentVisualSmokeColor() const { + return _componentVisualSmokeColor; +} + +void DirectedEnergyDamage::setComponentVisualSmokeColor(uint8_t pX) { + _componentVisualSmokeColor = pX; +} + +EventIdentifier& DirectedEnergyDamage::getFireEventID() { return _fireEventID; } + +const EventIdentifier& DirectedEnergyDamage::getFireEventID() const { + return _fireEventID; +} + +void DirectedEnergyDamage::setFireEventID(const EventIdentifier& pX) { + _fireEventID = pX; +} + +uint16_t DirectedEnergyDamage::getPadding2() const { return _padding2; } + +void DirectedEnergyDamage::setPadding2(uint16_t pX) { _padding2 = pX; } + +void DirectedEnergyDamage::marshal(DataStream& dataStream) const { + dataStream << _recordType; + dataStream << _recordLength; + dataStream << _padding; + _damageLocation.marshal(dataStream); + dataStream << _damageDiameter; + dataStream << _temperature; + dataStream << _componentIdentification; + dataStream << _componentDamageStatus; + dataStream << _componentVisualDamageStatus; + dataStream << _componentVisualSmokeColor; + _fireEventID.marshal(dataStream); + dataStream << _padding2; +} + +void DirectedEnergyDamage::unmarshal(DataStream& dataStream) { + dataStream >> _recordType; + dataStream >> _recordLength; + dataStream >> _padding; + _damageLocation.unmarshal(dataStream); + dataStream >> _damageDiameter; + dataStream >> _temperature; + dataStream >> _componentIdentification; + dataStream >> _componentDamageStatus; + dataStream >> _componentVisualDamageStatus; + dataStream >> _componentVisualSmokeColor; + _fireEventID.unmarshal(dataStream); + dataStream >> _padding2; +} + +bool DirectedEnergyDamage::operator==(const DirectedEnergyDamage& rhs) const { + bool ivarsEqual = true; + + if (!(_recordType == rhs._recordType)) ivarsEqual = false; + if (!(_recordLength == rhs._recordLength)) ivarsEqual = false; + if (!(_padding == rhs._padding)) ivarsEqual = false; + if (!(_damageLocation == rhs._damageLocation)) ivarsEqual = false; + if (!(_damageDiameter == rhs._damageDiameter)) ivarsEqual = false; + if (!(_temperature == rhs._temperature)) ivarsEqual = false; + if (!(_componentIdentification == rhs._componentIdentification)) + ivarsEqual = false; + if (!(_componentDamageStatus == rhs._componentDamageStatus)) + ivarsEqual = false; + if (!(_componentVisualDamageStatus == rhs._componentVisualDamageStatus)) + ivarsEqual = false; + if (!(_componentVisualSmokeColor == rhs._componentVisualSmokeColor)) + ivarsEqual = false; + if (!(_fireEventID == rhs._fireEventID)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + return ivarsEqual; +} + +int DirectedEnergyDamage::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 4; // _recordType + marshalSize = marshalSize + 2; // _recordLength + marshalSize = marshalSize + 2; // _padding + marshalSize = + marshalSize + _damageLocation.getMarshalledSize(); // _damageLocation + marshalSize = marshalSize + 4; // _damageDiameter + marshalSize = marshalSize + 4; // _temperature + marshalSize = marshalSize + 1; // _componentIdentification + marshalSize = marshalSize + 1; // _componentDamageStatus + marshalSize = marshalSize + 1; // _componentVisualDamageStatus + marshalSize = marshalSize + 1; // _componentVisualSmokeColor + marshalSize = marshalSize + _fireEventID.getMarshalledSize(); // _fireEventID + marshalSize = marshalSize + 2; // _padding2 + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/DirectedEnergyDamage.h b/src/dis7/warfare/DirectedEnergyDamage.h new file mode 100644 index 00000000..fe031efe --- /dev/null +++ b/src/dis7/warfare/DirectedEnergyDamage.h @@ -0,0 +1,138 @@ +#pragma once + +#include "dis7/EventIdentifier.h" +#include "dis7/Vector3Float.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Damage sustained by an entity due to directed energy. Location of the damage +// based on a relative x,y,z location from the center of the entity. +// Section 6.2.17.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DirectedEnergyDamage { + protected: + /** DE Record Type. */ + uint32_t _recordType; + + /** DE Record Length (bytes). */ + uint16_t _recordLength; + + /** padding. */ + uint16_t _padding; + + /** location of damage, relative to center of entity */ + Vector3Float _damageLocation; + + /** Size of damaged area, in meters. */ + float _damageDiameter; + + /** average temp of the damaged area, in degrees celsius. If firing entitty + * does not model this, use a value of -273.15 */ + float _temperature; + + /** enumeration */ + uint8_t _componentIdentification; + + /** enumeration */ + uint8_t _componentDamageStatus; + + /** enumeration */ + uint8_t _componentVisualDamageStatus; + + /** enumeration */ + uint8_t _componentVisualSmokeColor; + + /** For any component damage resulting this field shall be set to the fire + * event ID from that PDU. */ + EventIdentifier _fireEventID; + + /** padding */ + uint16_t _padding2; + + public: + DirectedEnergyDamage(); + virtual ~DirectedEnergyDamage(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint32_t getRecordType() const; + void setRecordType(uint32_t pX); + + uint16_t getRecordLength() const; + void setRecordLength(uint16_t pX); + + uint16_t getPadding() const; + void setPadding(uint16_t pX); + + Vector3Float& getDamageLocation(); + const Vector3Float& getDamageLocation() const; + void setDamageLocation(const Vector3Float& pX); + + float getDamageDiameter() const; + void setDamageDiameter(float pX); + + float getTemperature() const; + void setTemperature(float pX); + + uint8_t getComponentIdentification() const; + void setComponentIdentification(uint8_t pX); + + uint8_t getComponentDamageStatus() const; + void setComponentDamageStatus(uint8_t pX); + + uint8_t getComponentVisualDamageStatus() const; + void setComponentVisualDamageStatus(uint8_t pX); + + uint8_t getComponentVisualSmokeColor() const; + void setComponentVisualSmokeColor(uint8_t pX); + + EventIdentifier& getFireEventID(); + const EventIdentifier& getFireEventID() const; + void setFireEventID(const EventIdentifier& pX); + + uint16_t getPadding2() const; + void setPadding2(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DirectedEnergyDamage& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/DirectedEnergyFirePdu.cpp b/src/dis7/warfare/DirectedEnergyFirePdu.cpp new file mode 100644 index 00000000..3fa0892a --- /dev/null +++ b/src/dis7/warfare/DirectedEnergyFirePdu.cpp @@ -0,0 +1,280 @@ +#include "dis7/DirectedEnergyFirePdu.h" + +using namespace DIS; + +DirectedEnergyFirePdu::DirectedEnergyFirePdu() + : WarfareFamilyPdu(), + _munitionType(), + _shotStartTime(), + _commulativeShotTime(0.0), + _ApertureEmitterLocation(), + _apertureDiameter(0.0), + _wavelength(0.0), + _peakIrradiance(0.0), + _pulseRepetitionFrequency(0.0), + _pulseWidth(0), + _flags(0), + _pulseShape(0), + _padding1(0), + _padding2(0), + _padding3(0), + _numberOfDERecords(0) { + setPduType(68); +} + +DirectedEnergyFirePdu::~DirectedEnergyFirePdu() { _dERecords.clear(); } + +EntityType& DirectedEnergyFirePdu::getMunitionType() { return _munitionType; } + +const EntityType& DirectedEnergyFirePdu::getMunitionType() const { + return _munitionType; +} + +void DirectedEnergyFirePdu::setMunitionType(const EntityType& pX) { + _munitionType = pX; +} + +ClockTime& DirectedEnergyFirePdu::getShotStartTime() { return _shotStartTime; } + +const ClockTime& DirectedEnergyFirePdu::getShotStartTime() const { + return _shotStartTime; +} + +void DirectedEnergyFirePdu::setShotStartTime(const ClockTime& pX) { + _shotStartTime = pX; +} + +float DirectedEnergyFirePdu::getCommulativeShotTime() const { + return _commulativeShotTime; +} + +void DirectedEnergyFirePdu::setCommulativeShotTime(float pX) { + _commulativeShotTime = pX; +} + +Vector3Float& DirectedEnergyFirePdu::getApertureEmitterLocation() { + return _ApertureEmitterLocation; +} + +const Vector3Float& DirectedEnergyFirePdu::getApertureEmitterLocation() const { + return _ApertureEmitterLocation; +} + +void DirectedEnergyFirePdu::setApertureEmitterLocation(const Vector3Float& pX) { + _ApertureEmitterLocation = pX; +} + +float DirectedEnergyFirePdu::getApertureDiameter() const { + return _apertureDiameter; +} + +void DirectedEnergyFirePdu::setApertureDiameter(float pX) { + _apertureDiameter = pX; +} + +float DirectedEnergyFirePdu::getWavelength() const { return _wavelength; } + +void DirectedEnergyFirePdu::setWavelength(float pX) { _wavelength = pX; } + +float DirectedEnergyFirePdu::getPeakIrradiance() const { + return _peakIrradiance; +} + +void DirectedEnergyFirePdu::setPeakIrradiance(float pX) { + _peakIrradiance = pX; +} + +float DirectedEnergyFirePdu::getPulseRepetitionFrequency() const { + return _pulseRepetitionFrequency; +} + +void DirectedEnergyFirePdu::setPulseRepetitionFrequency(float pX) { + _pulseRepetitionFrequency = pX; +} + +int DirectedEnergyFirePdu::getPulseWidth() const { return _pulseWidth; } + +void DirectedEnergyFirePdu::setPulseWidth(int pX) { _pulseWidth = pX; } + +int DirectedEnergyFirePdu::getFlags() const { return _flags; } + +void DirectedEnergyFirePdu::setFlags(int pX) { _flags = pX; } + +char DirectedEnergyFirePdu::getPulseShape() const { return _pulseShape; } + +void DirectedEnergyFirePdu::setPulseShape(char pX) { _pulseShape = pX; } + +uint8_t DirectedEnergyFirePdu::getPadding1() const { return _padding1; } + +void DirectedEnergyFirePdu::setPadding1(uint8_t pX) { _padding1 = pX; } + +uint32_t DirectedEnergyFirePdu::getPadding2() const { return _padding2; } + +void DirectedEnergyFirePdu::setPadding2(uint32_t pX) { _padding2 = pX; } + +uint16_t DirectedEnergyFirePdu::getPadding3() const { return _padding3; } + +void DirectedEnergyFirePdu::setPadding3(uint16_t pX) { _padding3 = pX; } + +uint16_t DirectedEnergyFirePdu::getNumberOfDERecords() const { + return _dERecords.size(); +} + +std::vector& +DirectedEnergyFirePdu::getDERecords() { + return _dERecords; +} + +const std::vector& +DirectedEnergyFirePdu::getDERecords() const { + return _dERecords; +} + +void DirectedEnergyFirePdu::setDERecords( + const std::vector& pX) { + _dERecords = pX; +} + +void DirectedEnergyFirePdu::marshal(DataStream& dataStream) const { + WarfareFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _munitionType.marshal(dataStream); + _shotStartTime.marshal(dataStream); + dataStream << _commulativeShotTime; + _ApertureEmitterLocation.marshal(dataStream); + dataStream << _apertureDiameter; + dataStream << _wavelength; + dataStream << _peakIrradiance; + dataStream << _pulseRepetitionFrequency; + dataStream << _pulseWidth; + dataStream << _flags; + dataStream << _pulseShape; + dataStream << _padding1; + dataStream << _padding2; + dataStream << _padding3; + dataStream << (uint16_t)_dERecords.size(); + + for (size_t idx = 0; idx < _dERecords.size(); idx++) { + StandardVariableSpecification x = _dERecords[idx]; + x.marshal(dataStream); + } +} + +void DirectedEnergyFirePdu::unmarshal(DataStream& dataStream) { + WarfareFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _munitionType.unmarshal(dataStream); + _shotStartTime.unmarshal(dataStream); + dataStream >> _commulativeShotTime; + _ApertureEmitterLocation.unmarshal(dataStream); + dataStream >> _apertureDiameter; + dataStream >> _wavelength; + dataStream >> _peakIrradiance; + dataStream >> _pulseRepetitionFrequency; + dataStream >> _pulseWidth; + dataStream >> _flags; + dataStream >> _pulseShape; + dataStream >> _padding1; + dataStream >> _padding2; + dataStream >> _padding3; + dataStream >> _numberOfDERecords; + + _dERecords.clear(); + for (size_t idx = 0; idx < _numberOfDERecords; idx++) { + StandardVariableSpecification x; + x.unmarshal(dataStream); + _dERecords.push_back(x); + } +} + +bool DirectedEnergyFirePdu::operator==(const DirectedEnergyFirePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = WarfareFamilyPdu::operator==(rhs); + + if (!(_munitionType == rhs._munitionType)) ivarsEqual = false; + if (!(_shotStartTime == rhs._shotStartTime)) ivarsEqual = false; + if (!(_commulativeShotTime == rhs._commulativeShotTime)) ivarsEqual = false; + if (!(_ApertureEmitterLocation == rhs._ApertureEmitterLocation)) + ivarsEqual = false; + if (!(_apertureDiameter == rhs._apertureDiameter)) ivarsEqual = false; + if (!(_wavelength == rhs._wavelength)) ivarsEqual = false; + if (!(_peakIrradiance == rhs._peakIrradiance)) ivarsEqual = false; + if (!(_pulseRepetitionFrequency == rhs._pulseRepetitionFrequency)) + ivarsEqual = false; + if (!(_pulseWidth == rhs._pulseWidth)) ivarsEqual = false; + if (!(_flags == rhs._flags)) ivarsEqual = false; + if (!(_pulseShape == rhs._pulseShape)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + if (!(_padding3 == rhs._padding3)) ivarsEqual = false; + + for (size_t idx = 0; idx < _dERecords.size(); idx++) { + if (!(_dERecords[idx] == rhs._dERecords[idx])) ivarsEqual = false; + } + + return ivarsEqual; +} + +int DirectedEnergyFirePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = WarfareFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _munitionType.getMarshalledSize(); // _munitionType + marshalSize = + marshalSize + _shotStartTime.getMarshalledSize(); // _shotStartTime + marshalSize = marshalSize + 4; // _commulativeShotTime + marshalSize = + marshalSize + + _ApertureEmitterLocation.getMarshalledSize(); // _ApertureEmitterLocation + marshalSize = marshalSize + 4; // _apertureDiameter + marshalSize = marshalSize + 4; // _wavelength + marshalSize = marshalSize + 4; // _peakIrradiance + marshalSize = marshalSize + 4; // _pulseRepetitionFrequency + marshalSize = marshalSize + 4; // _pulseWidth + marshalSize = marshalSize + 4; // _flags + marshalSize = marshalSize + 1; // _pulseShape + marshalSize = marshalSize + 1; // _padding1 + marshalSize = marshalSize + 4; // _padding2 + marshalSize = marshalSize + 2; // _padding3 + marshalSize = marshalSize + 2; // _numberOfDERecords + + for (uint64_t idx = 0; idx < _dERecords.size(); idx++) { + StandardVariableSpecification listElement = _dERecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/DirectedEnergyFirePdu.h b/src/dis7/warfare/DirectedEnergyFirePdu.h new file mode 100644 index 00000000..95682e7a --- /dev/null +++ b/src/dis7/warfare/DirectedEnergyFirePdu.h @@ -0,0 +1,177 @@ +#pragma once + +#include + +#include "dis7/ClockTime.h" +#include "dis7/EntityType.h" +#include "dis7/StandardVariableSpecification.h" +#include "dis7/Vector3Float.h" +#include "dis7/WarfareFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Firing of a directed energy weapon shall be communicated by issuing a +// Directed Energy Fire PDU Section 7.3.4 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT DirectedEnergyFirePdu : public WarfareFamilyPdu { + protected: + /** Field shall identify the munition type enumeration for the DE weapon beam, + * Section 7.3.4 */ + EntityType _munitionType; + + /** Field shall indicate the simulation time at start of the shot, + * Section 7.3.4 */ + ClockTime _shotStartTime; + + /** Field shall indicate the current cumulative duration of the shot, + * Section 7.3.4 */ + float _commulativeShotTime; + + /** Field shall identify the location of the DE weapon aperture/emitter, + * Section 7.3.4 */ + Vector3Float _ApertureEmitterLocation; + + /** Field shall identify the beam diameter at the aperture/emitter, + * Section 7.3.4 */ + float _apertureDiameter; + + /** Field shall identify the emissions wavelength in units of meters, + * Section 7.3.4 */ + float _wavelength; + + /** Field shall identify the current peak irradiance of emissions in units of + * Watts per square meter, Section 7.3.4 */ + float _peakIrradiance; + + /** field shall identify the current pulse repetition frequency in units of + * cycles per second (Hertz), Section 7.3.4 */ + float _pulseRepetitionFrequency; + + /** field shall identify the pulse width emissions in units of seconds, + * Section 7.3.4 */ + int _pulseWidth; + + /** 16bit Boolean field shall contain various flags to indicate status + * information needed to process a DE, Section 7.3.4 */ + int _flags; + + /** Field shall identify the pulse shape and shall be represented as an 8-bit + * enumeration, Section 7.3.4 */ + char _pulseShape; + + /** padding, Section 7.3.4 */ + uint8_t _padding1; + + /** padding, Section 7.3.4 */ + uint32_t _padding2; + + /** padding, Section 7.3.4 */ + uint16_t _padding3; + + /** Field shall specify the number of DE records, Section 7.3.4 */ + uint16_t _numberOfDERecords; + + /** Fields shall contain one or more DE records, records shall conform to the + * variable record format (Section6.2.82), Section 7.3.4 */ + std::vector _dERecords; + + public: + DirectedEnergyFirePdu(); + virtual ~DirectedEnergyFirePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getMunitionType(); + const EntityType& getMunitionType() const; + void setMunitionType(const EntityType& pX); + + ClockTime& getShotStartTime(); + const ClockTime& getShotStartTime() const; + void setShotStartTime(const ClockTime& pX); + + float getCommulativeShotTime() const; + void setCommulativeShotTime(float pX); + + Vector3Float& getApertureEmitterLocation(); + const Vector3Float& getApertureEmitterLocation() const; + void setApertureEmitterLocation(const Vector3Float& pX); + + float getApertureDiameter() const; + void setApertureDiameter(float pX); + + float getWavelength() const; + void setWavelength(float pX); + + float getPeakIrradiance() const; + void setPeakIrradiance(float pX); + + float getPulseRepetitionFrequency() const; + void setPulseRepetitionFrequency(float pX); + + int getPulseWidth() const; + void setPulseWidth(int pX); + + int getFlags() const; + void setFlags(int pX); + + char getPulseShape() const; + void setPulseShape(char pX); + + uint8_t getPadding1() const; + void setPadding1(uint8_t pX); + + uint32_t getPadding2() const; + void setPadding2(uint32_t pX); + + uint16_t getPadding3() const; + void setPadding3(uint16_t pX); + + uint16_t getNumberOfDERecords() const; + + std::vector& getDERecords(); + const std::vector& getDERecords() const; + void setDERecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const DirectedEnergyFirePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/EntityDamageStatusPdu.cpp b/src/dis7/warfare/EntityDamageStatusPdu.cpp new file mode 100644 index 00000000..f43ea081 --- /dev/null +++ b/src/dis7/warfare/EntityDamageStatusPdu.cpp @@ -0,0 +1,152 @@ +#include "dis7/EntityDamageStatusPdu.h" + +using namespace DIS; + +EntityDamageStatusPdu::EntityDamageStatusPdu() + : WarfareFamilyPdu(), + _damagedEntityID(), + _padding1(0), + _padding2(0), + _numberOfDamageDescription(0) { + setPduType(69); +} + +EntityDamageStatusPdu::~EntityDamageStatusPdu() { + _damageDescriptionRecords.clear(); +} + +EntityID& EntityDamageStatusPdu::getDamagedEntityID() { + return _damagedEntityID; +} + +const EntityID& EntityDamageStatusPdu::getDamagedEntityID() const { + return _damagedEntityID; +} + +void EntityDamageStatusPdu::setDamagedEntityID(const EntityID& pX) { + _damagedEntityID = pX; +} + +uint16_t EntityDamageStatusPdu::getPadding1() const { return _padding1; } + +void EntityDamageStatusPdu::setPadding1(uint16_t pX) { _padding1 = pX; } + +uint16_t EntityDamageStatusPdu::getPadding2() const { return _padding2; } + +void EntityDamageStatusPdu::setPadding2(uint16_t pX) { _padding2 = pX; } + +uint16_t EntityDamageStatusPdu::getNumberOfDamageDescription() const { + return _damageDescriptionRecords.size(); +} + +std::vector& +EntityDamageStatusPdu::getDamageDescriptionRecords() { + return _damageDescriptionRecords; +} + +const std::vector& +EntityDamageStatusPdu::getDamageDescriptionRecords() const { + return _damageDescriptionRecords; +} + +void EntityDamageStatusPdu::setDamageDescriptionRecords( + const std::vector& pX) { + _damageDescriptionRecords = pX; +} + +void EntityDamageStatusPdu::marshal(DataStream& dataStream) const { + WarfareFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _damagedEntityID.marshal(dataStream); + dataStream << _padding1; + dataStream << _padding2; + dataStream << (uint16_t)_damageDescriptionRecords.size(); + + for (size_t idx = 0; idx < _damageDescriptionRecords.size(); idx++) { + DirectedEnergyDamage x = _damageDescriptionRecords[idx]; + x.marshal(dataStream); + } +} + +void EntityDamageStatusPdu::unmarshal(DataStream& dataStream) { + WarfareFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _damagedEntityID.unmarshal(dataStream); + dataStream >> _padding1; + dataStream >> _padding2; + dataStream >> _numberOfDamageDescription; + + _damageDescriptionRecords.clear(); + for (size_t idx = 0; idx < _numberOfDamageDescription; idx++) { + DirectedEnergyDamage x; + x.unmarshal(dataStream); + _damageDescriptionRecords.push_back(x); + } +} + +bool EntityDamageStatusPdu::operator==(const EntityDamageStatusPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = WarfareFamilyPdu::operator==(rhs); + + if (!(_damagedEntityID == rhs._damagedEntityID)) ivarsEqual = false; + if (!(_padding1 == rhs._padding1)) ivarsEqual = false; + if (!(_padding2 == rhs._padding2)) ivarsEqual = false; + + for (size_t idx = 0; idx < _damageDescriptionRecords.size(); idx++) { + if (!(_damageDescriptionRecords[idx] == rhs._damageDescriptionRecords[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int EntityDamageStatusPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = WarfareFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + _damagedEntityID.getMarshalledSize(); // _damagedEntityID + marshalSize = marshalSize + 2; // _padding1 + marshalSize = marshalSize + 2; // _padding2 + marshalSize = marshalSize + 2; // _numberOfDamageDescription + + for (uint64_t idx = 0; idx < _damageDescriptionRecords.size(); + idx++) { + DirectedEnergyDamage listElement = _damageDescriptionRecords[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/EntityDamageStatusPdu.h b/src/dis7/warfare/EntityDamageStatusPdu.h new file mode 100644 index 00000000..97b442a3 --- /dev/null +++ b/src/dis7/warfare/EntityDamageStatusPdu.h @@ -0,0 +1,98 @@ +#pragma once + +#include + +#include "dis7/DirectedEnergyDamage.h" +#include "dis7/EntityID.h" +#include "dis7/WarfareFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// shall be used to communicate detailed damage information sustained by an +// entity regardless of the source of the damage Section 7.3.5 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT EntityDamageStatusPdu : public WarfareFamilyPdu { + protected: + /** Field shall identify the damaged entity (see 6.2.28), Section 7.3.4 + * COMPLETE */ + EntityID _damagedEntityID; + + /** Padding. */ + uint16_t _padding1; + + /** Padding. */ + uint16_t _padding2; + + /** field shall specify the number of Damage Description records, + * Section 7.3.5 */ + uint16_t _numberOfDamageDescription; + + /** Fields shall contain one or more Damage Description records (see 6.2.17) + * and may contain other Standard Variable records, Section 7.3.5 */ + std::vector _damageDescriptionRecords; + + public: + EntityDamageStatusPdu(); + virtual ~EntityDamageStatusPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getDamagedEntityID(); + const EntityID& getDamagedEntityID() const; + void setDamagedEntityID(const EntityID& pX); + + uint16_t getPadding1() const; + void setPadding1(uint16_t pX); + + uint16_t getPadding2() const; + void setPadding2(uint16_t pX); + + uint16_t getNumberOfDamageDescription() const; + + std::vector& getDamageDescriptionRecords(); + const std::vector& getDamageDescriptionRecords() const; + void setDamageDescriptionRecords(const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const EntityDamageStatusPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/FirePdu.cpp b/src/dis7/warfare/FirePdu.cpp new file mode 100644 index 00000000..abfbe736 --- /dev/null +++ b/src/dis7/warfare/FirePdu.cpp @@ -0,0 +1,155 @@ +#include "dis7/FirePdu.h" + +using namespace DIS; + +FirePdu::FirePdu() + : WarfareFamilyPdu(), + _munitionExpendibleID(), + _eventID(), + _fireMissionIndex(0), + _locationInWorldCoordinates(), + _descriptor(), + _velocity(), + _range(0.0) { + setPduType(2); +} + +FirePdu::~FirePdu() {} + +EntityID& FirePdu::getMunitionExpendibleID() { return _munitionExpendibleID; } + +const EntityID& FirePdu::getMunitionExpendibleID() const { + return _munitionExpendibleID; +} + +void FirePdu::setMunitionExpendibleID(const EntityID& pX) { + _munitionExpendibleID = pX; +} + +EventIdentifier& FirePdu::getEventID() { return _eventID; } + +const EventIdentifier& FirePdu::getEventID() const { return _eventID; } + +void FirePdu::setEventID(const EventIdentifier& pX) { _eventID = pX; } + +uint32_t FirePdu::getFireMissionIndex() const { return _fireMissionIndex; } + +void FirePdu::setFireMissionIndex(uint32_t pX) { _fireMissionIndex = pX; } + +Vector3Double& FirePdu::getLocationInWorldCoordinates() { + return _locationInWorldCoordinates; +} + +const Vector3Double& FirePdu::getLocationInWorldCoordinates() const { + return _locationInWorldCoordinates; +} + +void FirePdu::setLocationInWorldCoordinates(const Vector3Double& pX) { + _locationInWorldCoordinates = pX; +} + +MunitionDescriptor& FirePdu::getDescriptor() { return _descriptor; } + +const MunitionDescriptor& FirePdu::getDescriptor() const { return _descriptor; } + +void FirePdu::setDescriptor(const MunitionDescriptor& pX) { _descriptor = pX; } + +Vector3Float& FirePdu::getVelocity() { return _velocity; } + +const Vector3Float& FirePdu::getVelocity() const { return _velocity; } + +void FirePdu::setVelocity(const Vector3Float& pX) { _velocity = pX; } + +float FirePdu::getRange() const { return _range; } + +void FirePdu::setRange(float pX) { _range = pX; } + +void FirePdu::marshal(DataStream& dataStream) const { + WarfareFamilyPdu::marshal( + dataStream); // Marshal information in superclass first + _munitionExpendibleID.marshal(dataStream); + _eventID.marshal(dataStream); + dataStream << _fireMissionIndex; + _locationInWorldCoordinates.marshal(dataStream); + _descriptor.marshal(dataStream); + _velocity.marshal(dataStream); + dataStream << _range; +} + +void FirePdu::unmarshal(DataStream& dataStream) { + WarfareFamilyPdu::unmarshal( + dataStream); // unmarshal information in superclass first + _munitionExpendibleID.unmarshal(dataStream); + _eventID.unmarshal(dataStream); + dataStream >> _fireMissionIndex; + _locationInWorldCoordinates.unmarshal(dataStream); + _descriptor.unmarshal(dataStream); + _velocity.unmarshal(dataStream); + dataStream >> _range; +} + +bool FirePdu::operator==(const FirePdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = WarfareFamilyPdu::operator==(rhs); + + if (!(_munitionExpendibleID == rhs._munitionExpendibleID)) ivarsEqual = false; + if (!(_eventID == rhs._eventID)) ivarsEqual = false; + if (!(_fireMissionIndex == rhs._fireMissionIndex)) ivarsEqual = false; + if (!(_locationInWorldCoordinates == rhs._locationInWorldCoordinates)) + ivarsEqual = false; + if (!(_descriptor == rhs._descriptor)) ivarsEqual = false; + if (!(_velocity == rhs._velocity)) ivarsEqual = false; + if (!(_range == rhs._range)) ivarsEqual = false; + + return ivarsEqual; +} + +int FirePdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = WarfareFamilyPdu::getMarshalledSize(); + marshalSize = + marshalSize + + _munitionExpendibleID.getMarshalledSize(); // _munitionExpendibleID + marshalSize = marshalSize + _eventID.getMarshalledSize(); // _eventID + marshalSize = marshalSize + 4; // _fireMissionIndex + marshalSize = + marshalSize + _locationInWorldCoordinates + .getMarshalledSize(); // _locationInWorldCoordinates + marshalSize = marshalSize + _descriptor.getMarshalledSize(); // _descriptor + marshalSize = marshalSize + _velocity.getMarshalledSize(); // _velocity + marshalSize = marshalSize + 4; // _range + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/FirePdu.h b/src/dis7/warfare/FirePdu.h new file mode 100644 index 00000000..055de7c4 --- /dev/null +++ b/src/dis7/warfare/FirePdu.h @@ -0,0 +1,130 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/EventIdentifier.h" +#include "dis7/MunitionDescriptor.h" +#include "dis7/Vector3Double.h" +#include "dis7/Vector3Float.h" +#include "dis7/WarfareFamilyPdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// The firing of a weapon or expendable shall be communicated by issuing a Fire +// PDU. Sectioin 7.3.2. COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT FirePdu : public WarfareFamilyPdu { + protected: + /** This field shall specify the entity identification of the fired munition + * or expendable. This field shall be represented by an Entity Identifier + * record (see 6.2.28). */ + EntityID _munitionExpendibleID; + + /** This field shall contain an identification generated by the firing entity + * to associate related firing and detonation events. This field shall be + * represented by an Event Identifier record (see 6.2.34). */ + EventIdentifier _eventID; + + /** This field shall identify the fire mission (see 5.4.3.3). This field shall + * be representedby a 32-bit uint32_teger. */ + uint32_t _fireMissionIndex; + + /** This field shall specify the location, in world coordinates, from which + * the munition was launched, and shall be represented by a World Coordinates + * record (see 6.2.97). */ + Vector3Double _locationInWorldCoordinates; + + /** This field shall describe the firing or launch of a munition or expendable + * represented by one of the following types of Descriptor records: Munition + * Descriptor (6.2.20.2) or Expendable Descriptor (6.2.20.4). */ + MunitionDescriptor _descriptor; + + /** This field shall specify the velocity of the fired munition at the point + * when the issuing simulation application intends the externally visible + * effects of the launch (e.g. exhaust plume or muzzle blast) to first become + * apparent. The velocity shall be represented in world coordinates. This + * field shall be represented by a Linear Velocity Vector record [see 6.2.95 + * item c)]. */ + Vector3Float _velocity; + + /** This field shall specify the range that an entity’s fire control system + * has assumed in computing the fire control solution. This field shall be + * represented by a 32-bit floating point number in meters. For systems where + * range is unknown or unavailable, this field shall contain a value of zero. + */ + float _range; + + public: + FirePdu(); + virtual ~FirePdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getMunitionExpendibleID(); + const EntityID& getMunitionExpendibleID() const; + void setMunitionExpendibleID(const EntityID& pX); + + EventIdentifier& getEventID(); + const EventIdentifier& getEventID() const; + void setEventID(const EventIdentifier& pX); + + uint32_t getFireMissionIndex() const; + void setFireMissionIndex(uint32_t pX); + + Vector3Double& getLocationInWorldCoordinates(); + const Vector3Double& getLocationInWorldCoordinates() const; + void setLocationInWorldCoordinates(const Vector3Double& pX); + + MunitionDescriptor& getDescriptor(); + const MunitionDescriptor& getDescriptor() const; + void setDescriptor(const MunitionDescriptor& pX); + + Vector3Float& getVelocity(); + const Vector3Float& getVelocity() const; + void setVelocity(const Vector3Float& pX); + + float getRange() const; + void setRange(float pX); + + virtual int getMarshalledSize() const; + + bool operator==(const FirePdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/MunitionDescriptor.cpp b/src/dis7/warfare/MunitionDescriptor.cpp new file mode 100644 index 00000000..2ed5c9d0 --- /dev/null +++ b/src/dis7/warfare/MunitionDescriptor.cpp @@ -0,0 +1,105 @@ +#include "dis7/MunitionDescriptor.h" + +using namespace DIS; + +MunitionDescriptor::MunitionDescriptor() + : _munitionType(), _warhead(0), _fuse(0), _quantity(0), _rate(0) {} + +MunitionDescriptor::~MunitionDescriptor() {} + +EntityType& MunitionDescriptor::getMunitionType() { return _munitionType; } + +const EntityType& MunitionDescriptor::getMunitionType() const { + return _munitionType; +} + +void MunitionDescriptor::setMunitionType(const EntityType& pX) { + _munitionType = pX; +} + +uint16_t MunitionDescriptor::getWarhead() const { return _warhead; } + +void MunitionDescriptor::setWarhead(uint16_t pX) { _warhead = pX; } + +uint16_t MunitionDescriptor::getFuse() const { return _fuse; } + +void MunitionDescriptor::setFuse(uint16_t pX) { _fuse = pX; } + +uint16_t MunitionDescriptor::getQuantity() const { return _quantity; } + +void MunitionDescriptor::setQuantity(uint16_t pX) { _quantity = pX; } + +uint16_t MunitionDescriptor::getRate() const { return _rate; } + +void MunitionDescriptor::setRate(uint16_t pX) { _rate = pX; } + +void MunitionDescriptor::marshal(DataStream& dataStream) const { + _munitionType.marshal(dataStream); + dataStream << _warhead; + dataStream << _fuse; + dataStream << _quantity; + dataStream << _rate; +} + +void MunitionDescriptor::unmarshal(DataStream& dataStream) { + _munitionType.unmarshal(dataStream); + dataStream >> _warhead; + dataStream >> _fuse; + dataStream >> _quantity; + dataStream >> _rate; +} + +bool MunitionDescriptor::operator==(const MunitionDescriptor& rhs) const { + bool ivarsEqual = true; + + if (!(_munitionType == rhs._munitionType)) ivarsEqual = false; + if (!(_warhead == rhs._warhead)) ivarsEqual = false; + if (!(_fuse == rhs._fuse)) ivarsEqual = false; + if (!(_quantity == rhs._quantity)) ivarsEqual = false; + if (!(_rate == rhs._rate)) ivarsEqual = false; + + return ivarsEqual; +} + +int MunitionDescriptor::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = + marshalSize + _munitionType.getMarshalledSize(); // _munitionType + marshalSize = marshalSize + 2; // _warhead + marshalSize = marshalSize + 2; // _fuse + marshalSize = marshalSize + 2; // _quantity + marshalSize = marshalSize + 2; // _rate + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/MunitionDescriptor.h b/src/dis7/warfare/MunitionDescriptor.h new file mode 100644 index 00000000..853db6f2 --- /dev/null +++ b/src/dis7/warfare/MunitionDescriptor.h @@ -0,0 +1,90 @@ +#pragma once + +#include "dis7/EntityType.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Represents the firing or detonation of a munition. Section 6.2.20.2 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT MunitionDescriptor { + protected: + /** What munition was used in the burst */ + EntityType _munitionType; + + /** type of warhead */ + uint16_t _warhead; + + /** type of fuse used */ + uint16_t _fuse; + + /** how many of the munition were fired */ + uint16_t _quantity; + + /** rate at which the munition was fired */ + uint16_t _rate; + + public: + MunitionDescriptor(); + virtual ~MunitionDescriptor(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityType& getMunitionType(); + const EntityType& getMunitionType() const; + void setMunitionType(const EntityType& pX); + + uint16_t getWarhead() const; + void setWarhead(uint16_t pX); + + uint16_t getFuse() const; + void setFuse(uint16_t pX); + + uint16_t getQuantity() const; + void setQuantity(uint16_t pX); + + uint16_t getRate() const; + void setRate(uint16_t pX); + + virtual int getMarshalledSize() const; + + bool operator==(const MunitionDescriptor& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/StandardVariableSpecification.cpp b/src/dis7/warfare/StandardVariableSpecification.cpp new file mode 100644 index 00000000..0fd1b346 --- /dev/null +++ b/src/dis7/warfare/StandardVariableSpecification.cpp @@ -0,0 +1,106 @@ +#include "dis7/StandardVariableSpecification.h" + +using namespace DIS; + +StandardVariableSpecification::StandardVariableSpecification() + : _numberOfStandardVariableRecords(0) {} + +StandardVariableSpecification::~StandardVariableSpecification() { + _standardVariables.clear(); +} + +uint16_t +StandardVariableSpecification::getNumberOfStandardVariableRecords() const { + return _standardVariables.size(); +} + +std::vector& +StandardVariableSpecification::getStandardVariables() { + return _standardVariables; +} + +const std::vector& +StandardVariableSpecification::getStandardVariables() const { + return _standardVariables; +} + +void StandardVariableSpecification::setStandardVariables( + const std::vector& pX) { + _standardVariables = pX; +} + +void StandardVariableSpecification::marshal(DataStream& dataStream) const { + dataStream << (uint16_t)_standardVariables.size(); + + for (size_t idx = 0; idx < _standardVariables.size(); idx++) { + SimulationManagementPduHeader x = _standardVariables[idx]; + x.marshal(dataStream); + } +} + +void StandardVariableSpecification::unmarshal(DataStream& dataStream) { + dataStream >> _numberOfStandardVariableRecords; + + _standardVariables.clear(); + for (size_t idx = 0; idx < _numberOfStandardVariableRecords; idx++) { + SimulationManagementPduHeader x; + x.unmarshal(dataStream); + _standardVariables.push_back(x); + } +} + +bool StandardVariableSpecification::operator==( + const StandardVariableSpecification& rhs) const { + bool ivarsEqual = true; + + for (size_t idx = 0; idx < _standardVariables.size(); idx++) { + if (!(_standardVariables[idx] == rhs._standardVariables[idx])) + ivarsEqual = false; + } + + return ivarsEqual; +} + +int StandardVariableSpecification::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = marshalSize + 2; // _numberOfStandardVariableRecords + + for (uint64_t idx = 0; idx < _standardVariables.size(); idx++) { + SimulationManagementPduHeader listElement = _standardVariables[idx]; + marshalSize = marshalSize + listElement.getMarshalledSize(); + } + + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/StandardVariableSpecification.h b/src/dis7/warfare/StandardVariableSpecification.h new file mode 100644 index 00000000..352b903b --- /dev/null +++ b/src/dis7/warfare/StandardVariableSpecification.h @@ -0,0 +1,78 @@ +#pragma once + +#include + +#include "dis7/SimulationManagementPduHeader.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// Does not work, and causes failure in anything it is embedded in. +// Section 6.2.82 + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT StandardVariableSpecification { + protected: + /** Number of static variable records */ + uint16_t _numberOfStandardVariableRecords; + + /** variable length list of standard variables, The class type and length here + * are WRONG and will cause the incorrect serialization of any class in whihc + * it is embedded. */ + std::vector _standardVariables; + + public: + StandardVariableSpecification(); + virtual ~StandardVariableSpecification(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + uint16_t getNumberOfStandardVariableRecords() const; + + std::vector& getStandardVariables(); + const std::vector& getStandardVariables() + const; + void setStandardVariables( + const std::vector& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const StandardVariableSpecification& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/WarfareFamilyPdu.cpp b/src/dis7/warfare/WarfareFamilyPdu.cpp new file mode 100644 index 00000000..145adbc2 --- /dev/null +++ b/src/dis7/warfare/WarfareFamilyPdu.cpp @@ -0,0 +1,95 @@ +#include "dis7/WarfareFamilyPdu.h" + +using namespace DIS; + +WarfareFamilyPdu::WarfareFamilyPdu() + : Pdu(), _firingEntityID(), _targetEntityID() { + setProtocolFamily(2); +} + +WarfareFamilyPdu::~WarfareFamilyPdu() {} + +EntityID& WarfareFamilyPdu::getFiringEntityID() { return _firingEntityID; } + +const EntityID& WarfareFamilyPdu::getFiringEntityID() const { + return _firingEntityID; +} + +void WarfareFamilyPdu::setFiringEntityID(const EntityID& pX) { + _firingEntityID = pX; +} + +EntityID& WarfareFamilyPdu::getTargetEntityID() { return _targetEntityID; } + +const EntityID& WarfareFamilyPdu::getTargetEntityID() const { + return _targetEntityID; +} + +void WarfareFamilyPdu::setTargetEntityID(const EntityID& pX) { + _targetEntityID = pX; +} + +void WarfareFamilyPdu::marshal(DataStream& dataStream) const { + Pdu::marshal(dataStream); // Marshal information in superclass first + _firingEntityID.marshal(dataStream); + _targetEntityID.marshal(dataStream); +} + +void WarfareFamilyPdu::unmarshal(DataStream& dataStream) { + Pdu::unmarshal(dataStream); // unmarshal information in superclass first + _firingEntityID.unmarshal(dataStream); + _targetEntityID.unmarshal(dataStream); +} + +bool WarfareFamilyPdu::operator==(const WarfareFamilyPdu& rhs) const { + bool ivarsEqual = true; + + ivarsEqual = Pdu::operator==(rhs); + + if (!(_firingEntityID == rhs._firingEntityID)) ivarsEqual = false; + if (!(_targetEntityID == rhs._targetEntityID)) ivarsEqual = false; + + return ivarsEqual; +} + +int WarfareFamilyPdu::getMarshalledSize() const { + int marshalSize = 0; + + marshalSize = Pdu::getMarshalledSize(); + marshalSize = + marshalSize + _firingEntityID.getMarshalledSize(); // _firingEntityID + marshalSize = + marshalSize + _targetEntityID.getMarshalledSize(); // _targetEntityID + return marshalSize; +} + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. diff --git a/src/dis7/warfare/WarfareFamilyPdu.h b/src/dis7/warfare/WarfareFamilyPdu.h new file mode 100644 index 00000000..33f9cf30 --- /dev/null +++ b/src/dis7/warfare/WarfareFamilyPdu.h @@ -0,0 +1,75 @@ +#pragma once + +#include "dis7/EntityID.h" +#include "dis7/Pdu.h" +#include "dis7/opendis7_export.h" +#include "dis7/utils/DataStream.h" + +namespace DIS { +// abstract superclass for fire and detonation pdus that have shared +// information. Section 7.3 COMPLETE + +// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All +// rights reserved. +// +// @author DMcG, jkg + +class OPENDIS7_EXPORT WarfareFamilyPdu : public Pdu { + protected: + /** ID of the entity that shot */ + EntityID _firingEntityID; + + /** ID of the entity that is being shot at */ + EntityID _targetEntityID; + + public: + WarfareFamilyPdu(); + virtual ~WarfareFamilyPdu(); + + virtual void marshal(DataStream& dataStream) const; + virtual void unmarshal(DataStream& dataStream); + + EntityID& getFiringEntityID(); + const EntityID& getFiringEntityID() const; + void setFiringEntityID(const EntityID& pX); + + EntityID& getTargetEntityID(); + const EntityID& getTargetEntityID() const; + void setTargetEntityID(const EntityID& pX); + + virtual int getMarshalledSize() const; + + bool operator==(const WarfareFamilyPdu& rhs) const; +}; +} // namespace DIS + +// Copyright (c) 1995-2009 held by the author(s). All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the names of the Naval Postgraduate School (NPS) +// Modeling Virtual Environments and Simulation (MOVES) Institute +// (http://www.nps.edu and http://www.MovesInstitute.org) +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE.