chore(include): changed include files from .h to .hpp
[KDIS.git] / include / KDIS / PDU / Synthetic_Environment / Areal_Object_State_PDU.hpp
blob3c9b50a8b5c38196219a85a93f009bfbbf84352f
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 1. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
31 class: Areal_Object_State_PDU
32 DIS: (6) 1278.1a - 1998
33 created: 17/03/2010
34 author: Karl Jones
36 purpose: An object that is geometrically anchored to the terrain
37 with a set of three or more points that come to a closure.
39 size: 384 bits / 48 octets - Min size.
40 *********************************************************************/
42 #pragma once
44 #include "./Object_State_Header.h"
45 #include "./../../DataTypes/ObjectType.h"
46 #include "./../../DataTypes/SimulationIdentifier.h"
47 #include "./../../DataTypes/ArealObjectAppearance.h"
48 #include "./../../DataTypes/WorldCoordinates.h"
49 #include <vector>
51 namespace KDIS {
52 namespace PDU {
54 class KDIS_EXPORT Areal_Object_State_PDU : public Object_State_Header
56 protected:
58 union
60 struct
62 KUINT8 m_ui8LocBit : 1;
63 KUINT8 m_ui8Unused : 7;
66 KUINT8 m_ui8Modifications;
67 } m_ModificationUnion;
69 KDIS::DATA_TYPE::ObjectType m_ObjTyp;
71 KDIS::DATA_TYPE::ArealObjectAppearance m_Apperance;
73 KUINT16 m_ui16NumPoints;
75 KDIS::DATA_TYPE::SimulationIdentifier m_ReqID;
77 KDIS::DATA_TYPE::SimulationIdentifier m_RecvID;
79 std::vector<KDIS::DATA_TYPE::WorldCoordinates> m_vPoints;
81 public:
83 static const KUINT16 AREAL_OBJECT_STATE_PDU_SIZE = 48;
85 Areal_Object_State_PDU();
87 Areal_Object_State_PDU( KDataStream & stream ) ;
89 Areal_Object_State_PDU( const Header & H, KDataStream & stream ) ;
91 Areal_Object_State_PDU( KUINT8 Modification, const KDIS::DATA_TYPE::ObjectType & T, const KDIS::DATA_TYPE::ArealObjectAppearance & A,
92 const KDIS::DATA_TYPE::SimulationIdentifier & RequestorID, const KDIS::DATA_TYPE::SimulationIdentifier & ReceivingID );
94 Areal_Object_State_PDU( KUINT8 Modification, const KDIS::DATA_TYPE::ObjectType & T, const KDIS::DATA_TYPE::ArealObjectAppearance & A,
95 const KDIS::DATA_TYPE::SimulationIdentifier & RequestorID, const KDIS::DATA_TYPE::SimulationIdentifier & ReceivingID,
96 const std::vector<KDIS::DATA_TYPE::WorldCoordinates> & Points );
98 virtual ~Areal_Object_State_PDU();
100 //************************************
101 // FullName: KDIS::PDU::Areal_Object_State_PDU::SetModification
102 // KDIS::PDU::Areal_Object_State_PDU::GetModification
103 // KDIS::PDU::Areal_Object_State_PDU::SetModificationLocation
104 // KDIS::PDU::Areal_Object_State_PDU::IsModificationLocation
105 // Description: Identifies whether a modification has been made to the point object’s location .
106 // Modification is represented by a single 8 bit unsigned int, where
107 // bit 0 is the location modified flag.
108 // A value of 1(true) indicates the field has been changed.
109 // All values are set to false(0) by default.
110 // Parameter: KUINT8 M, KBOOL M = true
111 //************************************
112 void SetModification( KUINT8 M );
113 KUINT8 GetModification() const;
114 void SetModificationLocation( KBOOL M = true );
115 KBOOL IsModificationLocation() const;
117 //************************************
118 // FullName: KDIS::PDU::Areal_Object_State_PDU::SetObjectType
119 // KDIS::PDU::Areal_Object_State_PDU::GetObjectType
120 // Description: The type of object. Represented as DIS enumeration(domain, kind, Category and sub category).
121 // Parameter: const ObjectType & O
122 //************************************
123 void SetObjectType( const KDIS::DATA_TYPE::ObjectType & O );
124 const KDIS::DATA_TYPE::ObjectType & GetObjectType() const;
125 KDIS::DATA_TYPE::ObjectType & GetObjectType();
127 //************************************
128 // FullName: KDIS::PDU::Areal_Object_State_PDU::SetObjectAppearance
129 // KDIS::PDU::Areal_Object_State_PDU::GetObjectAppearance
130 // Description: Specifies the dynamic changes to an object’s appearance attributes.
131 // Parameter: const ArealObjectAppearance & A
132 //************************************
133 void SetObjectAppearance( const KDIS::DATA_TYPE::ArealObjectAppearance & A );
134 const KDIS::DATA_TYPE::ArealObjectAppearance & GetObjectAppearance() const;
135 KDIS::DATA_TYPE::ArealObjectAppearance & GetObjectAppearance();
137 //************************************
138 // FullName: KDIS::PDU::Areal_Object_State_PDU::GetNumberOfPoints
139 // Description: The total number of points making up the areal object.
140 //************************************
141 KUINT16 GetNumberOfPoints() const;
143 //************************************
144 // FullName: KDIS::PDU::Areal_Object_State_PDU::SetRequestorSimulationID
145 // KDIS::PDU::Areal_Object_State_PDU::GetRequestorSimulationID
146 // Description: The simulation application sending the PDU.
147 // Parameter: const SimulationIdentifier & ID
148 //************************************
149 void SetRequestorSimulationID( const KDIS::DATA_TYPE::SimulationIdentifier & ID );
150 const KDIS::DATA_TYPE::SimulationIdentifier & GetRequestorSimulationID() const;
151 KDIS::DATA_TYPE::SimulationIdentifier & GetRequestorSimulationID();
153 //************************************
154 // FullName: KDIS::PDU::Areal_Object_State_PDU::SetReceivingSimulationID
155 // KDIS::PDU::Areal_Object_State_PDU::GetReceivingSimulationID
156 // Description: The simulation application that is to receive the PDU.
157 // Parameter: const SimulationIdentifier & ID
158 //************************************
159 void SetReceivingSimulationID( const KDIS::DATA_TYPE::SimulationIdentifier & ID );
160 const KDIS::DATA_TYPE::SimulationIdentifier & GetReceivingSimulationID() const;
161 KDIS::DATA_TYPE::SimulationIdentifier & GetReceivingSimulationID();
163 //************************************
164 // FullName: KDIS::PDU::Areal_Object_State_PDU::AddPoint
165 // KDIS::PDU::Areal_Object_State_PDU::SetPoints
166 // KDIS::PDU::Areal_Object_State_PDU::GetPoints
167 // Description: Specifies the points that make up the object’s physical location.
168 // Parameter: const WorldCoordinates & P, const vector<WorldCoordinates> & P, void
169 //************************************
170 void AddPoint( const KDIS::DATA_TYPE::WorldCoordinates & P );
171 void SetPoints( const std::vector<KDIS::DATA_TYPE::WorldCoordinates> & P );
172 const std::vector<KDIS::DATA_TYPE::WorldCoordinates> & GetPoints() const;
174 //************************************
175 // FullName: KDIS::PDU::Areal_Object_State_PDU::GetAsString
176 // Description: Returns a string representation of the PDU.
177 //************************************
178 virtual KString GetAsString() const;
180 //************************************
181 // FullName: KDIS::PDU::Areal_Object_State_PDU::Decode
182 // Description: Convert From Network Data.
183 // Parameter: KDataStream & stream
184 // Parameter: bool ignoreHeader = false - Decode the header from the stream?
185 //************************************
186 virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) ;
188 //************************************
189 // FullName: KDIS::PDU::Areal_Object_State_PDU::Encode
190 // Description: Convert To Network Data.
191 // Parameter: KDataStream & stream
192 //************************************
193 virtual KDataStream Encode() const;
194 virtual void Encode( KDataStream & stream ) const;
196 KBOOL operator == ( const Areal_Object_State_PDU & Value ) const;
197 KBOOL operator != ( const Areal_Object_State_PDU & Value ) const;
200 } // END namespace PDU
201 } // END namespace KDIS