Remove old changelog
[KDIS.git] / include / KDIS / PDU / Live_Entity / Appearance_PDU.hpp
bloba103394e2c484516e82aff96e6e4340fc0cf8b44
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: Appearance_PDU
32 DIS: (6) 1278.1a - 1998
33 created: 04/07/2010
34 author: Karl Jones
36 purpose: The Appearance PDU communicates information about the appearance
37 of an Live Entity. This includes state information that is
38 necessary for the receiving simulation applications to represent
39 the issuing entity's appearance in the simulation application's
40 own simulation.
42 size: 136 bits / 17 octets - Min size
43 *********************************************************************/
45 #pragma once
47 #include "KDIS/DataTypes/EntityAppearance.hpp"
48 #include "KDIS/DataTypes/EntityCapabilities.hpp"
49 #include "KDIS/DataTypes/EntityMarking.hpp"
50 #include "KDIS/DataTypes/EntityType.hpp"
51 #include "KDIS/PDU/Live_Entity/LE_Header.hpp"
53 namespace KDIS {
54 namespace PDU {
56 class KDIS_EXPORT Appearance_PDU : public LE_Header {
57 protected:
58 union {
59 struct {
60 KUINT8 m_ui8ForceId : 1;
61 KUINT8 m_ui8Typ : 1;
62 KUINT8 m_ui8AltTyp : 1;
63 KUINT8 m_ui8Mark : 1;
64 KUINT8 m_ui8Cap : 1;
65 KUINT8 m_ui8Vis : 1;
66 KUINT8 m_ui8IR : 1;
67 KUINT8 m_ui8Flag2 : 1;
69 KUINT8 m_ui8Flag;
70 } m_AppearanceFlag1Union;
72 union {
73 struct {
74 KUINT8 m_ui8EM : 1;
75 KUINT8 m_ui8Audio : 1;
76 KUINT8 m_ui8Unused : 5;
77 KUINT8 m_ui8Reserved : 1;
79 KUINT8 m_ui8Flag;
80 } m_AppearanceFlag2Union;
82 KUINT8 m_ui8ForceID;
84 KDIS::DATA_TYPE::EntityType m_EntityType;
86 KDIS::DATA_TYPE::EntityType m_AltEntityType;
88 KDIS::DATA_TYPE::EntityMarking m_EntityMarking;
90 KDIS::DATA_TYPE::EntityCapabilities m_EntityCapabilities;
92 KDIS::DATA_TYPE::EntityAppearance m_VisApp;
94 KDIS::DATA_TYPE::EntityAppearance m_IRApp;
96 KDIS::DATA_TYPE::EntityAppearance m_EMApp;
98 KDIS::DATA_TYPE::EntityAppearance m_AudApp;
100 public:
101 static const KUINT16 APPEARANCE_PDU_SIZE =
102 17; // Min size, not including optional fields
104 Appearance_PDU();
106 Appearance_PDU(KDataStream& stream);
108 Appearance_PDU(const Header& H, KDataStream& stream);
110 Appearance_PDU(const KDIS::DATA_TYPE::LE_EntityIdentifier& ID);
112 virtual ~Appearance_PDU();
114 //************************************
115 // FullName: KDIS::PDU::Appearance_PDU::SetForceIDFlag
116 // KDIS::PDU::Appearance_PDU::GetForceIDFlag
117 // KDIS::PDU::Appearance_PDU::SetEntityTypeFlag
118 // KDIS::PDU::Appearance_PDU::GetEntityTypeFlag
119 // KDIS::PDU::Appearance_PDU::SetAlternateEntityTypeFlag
120 // KDIS::PDU::Appearance_PDU::GetAlternateEntityTypeFlag
121 // KDIS::PDU::Appearance_PDU::SetEntityMarkingFlag
122 // KDIS::PDU::Appearance_PDU::GetEntityMarkingFlag
123 // KDIS::PDU::Appearance_PDU::SetCapabilitiesFlag
124 // KDIS::PDU::Appearance_PDU::GetCapabilitiesFlag
125 // KDIS::PDU::Appearance_PDU::SetAppearanceVisualFlag
126 // KDIS::PDU::Appearance_PDU::GetAppearanceVisualFlag
127 // KDIS::PDU::Appearance_PDU::SetAppearanceIRFlag
128 // KDIS::PDU::Appearance_PDU::GetAppearanceIRFlag
129 // KDIS::PDU::Appearance_PDU::SetFlag2Flag
130 // KDIS::PDU::Appearance_PDU::GetFlag2Flag
131 // KDIS::PDU::Appearance_PDU::SetAppearanceEMFlag
132 // KDIS::PDU::Appearance_PDU::GetAppearanceEMFlag
133 // KDIS::PDU::Appearance_PDU::SetAppearanceAudioFlag
134 // KDIS::PDU::Appearance_PDU::GetAppearanceAudioFlag
135 // Description: Identifies optional data fields that are being transmitted
136 // with
137 // this PDU.
138 // Note setting Appearance EM flag and Appearance Audio flag
139 // will automatically set Flag2 flag.
140 // Parameter: KBOOL F
141 //************************************
142 void SetForceIDFlag(KBOOL F);
143 KBOOL GetForceIDFlag() const;
144 void SetEntityTypeFlag(KBOOL F);
145 KBOOL GetEntityTypeFlag() const;
146 void SetAlternateEntityTypeFlag(KBOOL F);
147 KBOOL GetAlternateEntityTypeFlag() const;
148 void SetEntityMarkingFlag(KBOOL F);
149 KBOOL GetEntityMarkingFlag() const;
150 void SetCapabilitiesFlag(KBOOL F);
151 KBOOL GetCapabilitiesFlag() const;
152 void SetAppearanceVisualFlag(KBOOL F);
153 KBOOL GetAppearanceVisualFlag() const;
154 void SetAppearanceIRFlag(KBOOL F);
155 KBOOL GetAppearanceIRFlag() const;
156 void SetFlag2Flag(KBOOL F);
157 KBOOL GetFlag2Flag() const;
158 void SetAppearanceEMFlag(KBOOL F);
159 KBOOL GetAppearanceEMFlag() const;
160 void SetAppearanceAudioFlag(KBOOL F);
161 KBOOL GetAppearanceAudioFlag() const;
163 //************************************
164 // FullName: KDIS::PDU::Appearance_PDU::SetForceID
165 // KDIS::PDU::Appearance_PDU::GetForceID
166 // Description: Optional field. Force ID. Enumerated value representing the
167 // force the entity belongs to,
168 // such as friendly, opposing or neutral.
169 // Note: Setting this value will also cause the relevant flag to
170 // be set to true.
171 // Parameter: ForceID ID
172 //************************************
173 void SetForceID(KDIS::DATA_TYPE::ENUMS::ForceID ID);
174 KDIS::DATA_TYPE::ENUMS::ForceID GetForceID() const;
176 //************************************
177 // FullName: KDIS::PDU::Appearance_PDU::SetEntityType
178 // KDIS::PDU::Appearance_PDU::GetEntityType
179 // Description: Optional field. Entity Type. Consists of 7 values used to
180 // represent
181 // the type of entity. Please see DIS Enums document found on
182 // the SISO website for a full list of enumerations available.
183 // Note: Setting this value will also cause the relevant flag to
184 // be set to true.
185 // Parameter: const EntityType & Type
186 //************************************
187 void SetEntityType(const KDIS::DATA_TYPE::EntityType& Type);
188 const KDIS::DATA_TYPE::EntityType& GetEntityType() const;
189 KDIS::DATA_TYPE::EntityType& GetEntityType();
191 //************************************
192 // FullName: KDIS::PDU::Appearance_PDU::SetAltEntityType
193 // KDIS::PDU::Appearance_PDU::GetAltEntityType
194 // Description: Optional field. This identifies the entity type to be
195 // displayed by members of forces
196 // other than that of the issuing entity.
197 // I.E This could be used to represent an entity in disguise.
198 // Note: Setting this value will also cause the relevant flag to
199 // be set to true.
200 // Parameter: const EntityType & Type
201 //************************************
202 void SetAltEntityType(const KDIS::DATA_TYPE::EntityType& Type);
203 const KDIS::DATA_TYPE::EntityType& GetAltEntityType() const;
204 KDIS::DATA_TYPE::EntityType& GetAltEntityType();
206 //************************************
207 // FullName: KDIS::PDU::Appearance_PDU::SetEntityMarking
208 // KDIS::PDU::Appearance_PDU::GetEntityMarking
209 // Description: Optional field. Entity Marking. This can be the entities
210 // name,Army Markings or Chevrons.
211 // Note: Setting this value will also cause the relevant flag to
212 // be set to true.
213 // Parameter: const EntityMarking & EM
214 //************************************
215 void SetEntityMarking(const KDIS::DATA_TYPE::EntityMarking& EM);
216 const KDIS::DATA_TYPE::EntityMarking& GetEntityMarking() const;
217 KDIS::DATA_TYPE::EntityMarking& GetEntityMarking();
219 //************************************
220 // FullName: KDIS::PDU::Appearance_PDU::SetEntityCapabilities
221 // KDIS::PDU::Appearance_PDU::GetEntityCapabilities
222 // Description: Optional field. Entity Capabilities. Such as has fuel/ammo
223 // supply etc.
224 // Note: Setting this value will also cause the relevant flag to
225 // be set to true.
226 // Parameter: const EntityCapabilities & EC
227 //************************************
228 void SetEntityCapabilities(const KDIS::DATA_TYPE::EntityCapabilities& EC);
229 const KDIS::DATA_TYPE::EntityCapabilities& GetEntityCapabilities() const;
230 KDIS::DATA_TYPE::EntityCapabilities& GetEntityCapabilities();
232 //************************************
233 // FullName: KDIS::PDU::Appearance_PDU::SetAppearanceVisual
234 // KDIS::PDU::Appearance_PDU::GetAppearanceVisual
235 // Description: Optional field. Specifies the dynamic changes to the entity's
236 // visual appearance attributes.
237 // Note: Setting this value will also cause the relevant flag to
238 // be set to true.
239 // Parameter: const EntityAppearance & V
240 //************************************
241 void SetAppearanceVisual(const KDIS::DATA_TYPE::EntityAppearance& V);
242 const KDIS::DATA_TYPE::EntityAppearance& GetAppearanceVisual() const;
243 KDIS::DATA_TYPE::EntityAppearance& GetAppearanceVisual();
245 //************************************
246 // FullName: KDIS::PDU::Appearance_PDU::SetAppearanceIR
247 // KDIS::PDU::Appearance_PDU::GetAppearanceIR
248 // Description: Optional field. Specifies the dynamic changes to the entity's
249 // infrared appearance attributes.
250 // Note: Setting this value will also cause the relevant flag to
251 // be set to true.
252 // Parameter: const EntityAppearance & IR
253 //************************************
254 void SetAppearanceIR(const KDIS::DATA_TYPE::EntityAppearance& IR);
255 const KDIS::DATA_TYPE::EntityAppearance& GetAppearanceIR() const;
256 KDIS::DATA_TYPE::EntityAppearance& GetAppearanceIR();
258 //************************************
259 // FullName: KDIS::PDU::Appearance_PDU::SetAppearanceEM
260 // KDIS::PDU::Appearance_PDU::GetAppearanceEM
261 // Description: Optional field. Specifies the dynamic changes to the entity's
262 // electromagnetic appearance attributes.
263 // Note: Setting this value will also cause the relevant flags to
264 // be set to true.
265 // Parameter: const EntityAppearance & EM
266 //************************************
267 void SetAppearanceEM(const KDIS::DATA_TYPE::EntityAppearance& EM);
268 const KDIS::DATA_TYPE::EntityAppearance& GetAppearanceEM() const;
269 KDIS::DATA_TYPE::EntityAppearance& GetAppearanceEM();
271 //************************************
272 // FullName: KDIS::PDU::Appearance_PDU::SetAppearanceAudio
273 // KDIS::PDU::Appearance_PDU::GetAppearanceAudio
274 // Description: Optional field. Specifies the dynamic changes to the entity's
275 // acoustic appearance attributes.
276 // Note: Setting this value will also cause the relevant flags to
277 // be set to true.
278 // Parameter: const EntityAppearance & A
279 //************************************
280 void SetAppearanceAudio(const KDIS::DATA_TYPE::EntityAppearance& A);
281 const KDIS::DATA_TYPE::EntityAppearance& GetAppearanceAudio() const;
282 KDIS::DATA_TYPE::EntityAppearance& GetAppearanceAudio();
284 //************************************
285 // FullName: KDIS::PDU::Appearance_PDU::GetAsString
286 // Description: Returns a string representation of the PDU
287 //************************************
288 virtual KString GetAsString() const;
290 //************************************
291 // FullName: KDIS::PDU::Appearance_PDU::Decode
292 // Description: Convert From Network Data.
293 // Parameter: KDataStream & stream
294 // Parameter: bool ignoreHeader = false - Decode the header from the stream?
295 //************************************
296 virtual void Decode(KDataStream& stream, bool ignoreHeader = false);
298 //************************************
299 // FullName: KDIS::PDU::Appearance_PDU::Encode
300 // Description: Convert To Network Data.
301 // Parameter: KDataStream & stream
302 //************************************
303 virtual KDataStream Encode() const;
304 virtual void Encode(KDataStream& stream) const;
306 KBOOL operator==(const Appearance_PDU& Value) const;
307 KBOOL operator!=(const Appearance_PDU& Value) const;
310 } // END namespace PDU
311 } // END namespace KDIS