KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Appearance_PDU.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
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.
13 
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.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: Appearance_PDU
32  DIS: (6) 1278.1a - 1998
33  created: 04/07/2010
34  author: Karl Jones
35 
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 own simulation.
40 
41  size: 136 bits / 17 octets - Min size
42 *********************************************************************/
43 
44 #pragma once
45 
46 #include "./LE_Header.h"
47 #include "./../../DataTypes/EntityType.h"
48 #include "./../../DataTypes/EntityMarking.h"
49 #include "./../../DataTypes/EntityCapabilities.h"
50 #include "./../../DataTypes/EntityAppearance.h"
51 
52 namespace KDIS {
53 namespace PDU {
54 
56 {
57 protected:
58 
59  union
60  {
61  struct
62  {
63  KUINT8 m_ui8ForceId : 1;
64  KUINT8 m_ui8Typ : 1;
65  KUINT8 m_ui8AltTyp : 1;
66  KUINT8 m_ui8Mark : 1;
67  KUINT8 m_ui8Cap : 1;
68  KUINT8 m_ui8Vis : 1;
69  KUINT8 m_ui8IR : 1;
70  KUINT8 m_ui8Flag2 : 1;
71  };
73  } m_AppearanceFlag1Union;
74 
75  union
76  {
77  struct
78  {
79  KUINT8 m_ui8EM : 1;
80  KUINT8 m_ui8Audio : 1;
81  KUINT8 m_ui8Unused : 5;
82  KUINT8 m_ui8Reserved : 1;
83  };
84  KUINT8 m_ui8Flag;
85  } m_AppearanceFlag2Union;
86 
88 
90 
92 
94 
96 
98 
100 
102 
104 
105 public:
106 
107  static const KUINT16 APPEARANCE_PDU_SIZE = 17; // Min size, not including optional fields
108 
109  Appearance_PDU();
110 
111  Appearance_PDU( KDataStream & stream ) throw( KException );
112 
113  Appearance_PDU( const Header & H, KDataStream & stream ) throw( KException );
114 
116 
117  virtual ~Appearance_PDU();
118 
119  //************************************
120  // FullName: KDIS::PDU::Appearance_PDU::SetForceIDFlag
121  // KDIS::PDU::Appearance_PDU::GetForceIDFlag
122  // KDIS::PDU::Appearance_PDU::SetEntityTypeFlag
123  // KDIS::PDU::Appearance_PDU::GetEntityTypeFlag
124  // KDIS::PDU::Appearance_PDU::SetAlternateEntityTypeFlag
125  // KDIS::PDU::Appearance_PDU::GetAlternateEntityTypeFlag
126  // KDIS::PDU::Appearance_PDU::SetEntityMarkingFlag
127  // KDIS::PDU::Appearance_PDU::GetEntityMarkingFlag
128  // KDIS::PDU::Appearance_PDU::SetCapabilitiesFlag
129  // KDIS::PDU::Appearance_PDU::GetCapabilitiesFlag
130  // KDIS::PDU::Appearance_PDU::SetAppearanceVisualFlag
131  // KDIS::PDU::Appearance_PDU::GetAppearanceVisualFlag
132  // KDIS::PDU::Appearance_PDU::SetAppearanceIRFlag
133  // KDIS::PDU::Appearance_PDU::GetAppearanceIRFlag
134  // KDIS::PDU::Appearance_PDU::SetFlag2Flag
135  // KDIS::PDU::Appearance_PDU::GetFlag2Flag
136  // KDIS::PDU::Appearance_PDU::SetAppearanceEMFlag
137  // KDIS::PDU::Appearance_PDU::GetAppearanceEMFlag
138  // KDIS::PDU::Appearance_PDU::SetAppearanceAudioFlag
139  // KDIS::PDU::Appearance_PDU::GetAppearanceAudioFlag
140  //!Description: Identifies optional data fields that are being transmitted with
141  //! this PDU.
142  //! Note setting Appearance EM flag and Appearance Audio flag
143  //! will automatically set Flag2 flag.
144  // Parameter: KBOOL F
145  //************************************
146  void SetForceIDFlag( KBOOL F );
147  KBOOL GetForceIDFlag() const;
148  void SetEntityTypeFlag( KBOOL F );
149  KBOOL GetEntityTypeFlag() const;
150  void SetAlternateEntityTypeFlag( KBOOL F );
151  KBOOL GetAlternateEntityTypeFlag() const;
152  void SetEntityMarkingFlag( KBOOL F );
153  KBOOL GetEntityMarkingFlag() const;
154  void SetCapabilitiesFlag( KBOOL F );
155  KBOOL GetCapabilitiesFlag() const;
156  void SetAppearanceVisualFlag( KBOOL F );
157  KBOOL GetAppearanceVisualFlag() const;
158  void SetAppearanceIRFlag( KBOOL F );
159  KBOOL GetAppearanceIRFlag() const;
160  void SetFlag2Flag( KBOOL F );
161  KBOOL GetFlag2Flag() const;
162  void SetAppearanceEMFlag( KBOOL F );
163  KBOOL GetAppearanceEMFlag() const;
164  void SetAppearanceAudioFlag( KBOOL F );
165  KBOOL GetAppearanceAudioFlag()const;
166 
167  //************************************
168  // FullName: KDIS::PDU::Appearance_PDU::SetForceID
169  // KDIS::PDU::Appearance_PDU::GetForceID
170  //!Description: Optional field. Force ID. Enumerated value representing the force the entity belongs to,
171  //! such as friendly, opposing or neutral.
172  //! Note: Setting this value will also cause the relevant flag to be set to true.
173  // Parameter: ForceID ID
174  //************************************
175  void SetForceID( KDIS::DATA_TYPE::ENUMS::ForceID ID );
176  KDIS::DATA_TYPE::ENUMS::ForceID GetForceID() const;
177 
178  //************************************
179  // FullName: KDIS::PDU::Appearance_PDU::SetEntityType
180  // KDIS::PDU::Appearance_PDU::GetEntityType
181  //!Description: Optional field. Entity Type. Consists of 7 values used to represent
182  //! the type of entity. Please see DIS Enums document found on
183  //! the SISO website for a full list of enumerations available.
184  //! Note: Setting this value will also cause the relevant flag to 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();
190 
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 displayed by members of forces
195  //! other than that of the issuing entity.
196  //! I.E This could be used to represent an entity in disguise.
197  //! Note: Setting this value will also cause the relevant flag to be set to true.
198  // Parameter: const EntityType & Type
199  //************************************
200  void SetAltEntityType( const KDIS::DATA_TYPE::EntityType & Type );
201  const KDIS::DATA_TYPE::EntityType & GetAltEntityType() const;
202  KDIS::DATA_TYPE::EntityType & GetAltEntityType();
203 
204  //************************************
205  // FullName: KDIS::PDU::Appearance_PDU::SetEntityMarking
206  // KDIS::PDU::Appearance_PDU::GetEntityMarking
207  //!Description: Optional field. Entity Marking. This can be the entities name,Army Markings or Chevrons.
208  //! Note: Setting this value will also cause the relevant flag to be set to true.
209  // Parameter: const EntityMarking & EM
210  //************************************
211  void SetEntityMarking( const KDIS::DATA_TYPE::EntityMarking & EM );
212  const KDIS::DATA_TYPE::EntityMarking & GetEntityMarking() const;
213  KDIS::DATA_TYPE::EntityMarking & GetEntityMarking();
214 
215  //************************************
216  // FullName: KDIS::PDU::Appearance_PDU::SetEntityCapabilities
217  // KDIS::PDU::Appearance_PDU::GetEntityCapabilities
218  //!Description: Optional field. Entity Capabilities. Such as has fuel/ammo supply etc.
219  //! Note: Setting this value will also cause the relevant flag to be set to true.
220  // Parameter: const EntityCapabilities & EC
221  //************************************
222  void SetEntityCapabilities( const KDIS::DATA_TYPE::EntityCapabilities & EC );
223  const KDIS::DATA_TYPE::EntityCapabilities & GetEntityCapabilities() const;
224  KDIS::DATA_TYPE::EntityCapabilities & GetEntityCapabilities();
225 
226  //************************************
227  // FullName: KDIS::PDU::Appearance_PDU::SetAppearanceVisual
228  // KDIS::PDU::Appearance_PDU::GetAppearanceVisual
229  //!Description: Optional field. Specifies the dynamic changes to the entity�s visual appearance attributes.
230  //! Note: Setting this value will also cause the relevant flag to be set to true.
231  // Parameter: const EntityAppearance & V
232  //************************************
233  void SetAppearanceVisual( const KDIS::DATA_TYPE::EntityAppearance & V );
234  const KDIS::DATA_TYPE::EntityAppearance & GetAppearanceVisual() const;
235  KDIS::DATA_TYPE::EntityAppearance & GetAppearanceVisual();
236 
237  //************************************
238  // FullName: KDIS::PDU::Appearance_PDU::SetAppearanceIR
239  // KDIS::PDU::Appearance_PDU::GetAppearanceIR
240  //!Description: Optional field. Specifies the dynamic changes to the entity�s infrared appearance attributes.
241  //! Note: Setting this value will also cause the relevant flag to be set to true.
242  // Parameter: const EntityAppearance & IR
243  //************************************
244  void SetAppearanceIR( const KDIS::DATA_TYPE::EntityAppearance & IR );
245  const KDIS::DATA_TYPE::EntityAppearance & GetAppearanceIR() const;
246  KDIS::DATA_TYPE::EntityAppearance & GetAppearanceIR();
247 
248  //************************************
249  // FullName: KDIS::PDU::Appearance_PDU::SetAppearanceEM
250  // KDIS::PDU::Appearance_PDU::GetAppearanceEM
251  //!Description: Optional field. Specifies the dynamic changes to the entity�s electromagnetic appearance attributes.
252  //! Note: Setting this value will also cause the relevant flags to be set to true.
253  // Parameter: const EntityAppearance & EM
254  //************************************
255  void SetAppearanceEM( const KDIS::DATA_TYPE::EntityAppearance & EM );
256  const KDIS::DATA_TYPE::EntityAppearance & GetAppearanceEM() const;
257  KDIS::DATA_TYPE::EntityAppearance & GetAppearanceEM();
258 
259  //************************************
260  // FullName: KDIS::PDU::Appearance_PDU::SetAppearanceAudio
261  // KDIS::PDU::Appearance_PDU::GetAppearanceAudio
262  //!Description: Optional field. Specifies the dynamic changes to the entity�s acoustic appearance attributes.
263  //! Note: Setting this value will also cause the relevant flags to be set to true.
264  // Parameter: const EntityAppearance & A
265  //************************************
266  void SetAppearanceAudio( const KDIS::DATA_TYPE::EntityAppearance & A );
267  const KDIS::DATA_TYPE::EntityAppearance & GetAppearanceAudio() const;
268  KDIS::DATA_TYPE::EntityAppearance & GetAppearanceAudio();
269 
270  //************************************
271  // FullName: KDIS::PDU::Appearance_PDU::GetAsString
272  //!Description: Returns a string representation of the PDU
273  //************************************
274  virtual KString GetAsString() const;
275 
276  //************************************
277  // FullName: KDIS::PDU::Appearance_PDU::Decode
278  //!Description: Convert From Network Data.
279  // Parameter: KDataStream & stream
280  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
281  //************************************
282  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
283 
284  //************************************
285  // FullName: KDIS::PDU::Appearance_PDU::Encode
286  //!Description: Convert To Network Data.
287  // Parameter: KDataStream & stream
288  //************************************
289  virtual KDataStream Encode() const;
290  virtual void Encode( KDataStream & stream ) const;
291 
292  KBOOL operator == ( const Appearance_PDU & Value ) const;
293  KBOOL operator != ( const Appearance_PDU & Value ) const;
294 };
295 
296 } // END namespace PDU
297 } // END namespace KDIS
Definition: EntityType.h:46
KDIS::DATA_TYPE::EntityType m_AltEntityType
Definition: Appearance_PDU.h:91
KUINT8 m_ui8ForceID
Definition: Appearance_PDU.h:87
Definition: EntityCapabilities.h:46
unsigned short int KUINT16
Definition: KDefines.h:101
KDIS::DATA_TYPE::EntityAppearance m_AudApp
Definition: Appearance_PDU.h:103
KDIS::DATA_TYPE::EntityCapabilities m_EntityCapabilities
Definition: Appearance_PDU.h:95
KDIS::DATA_TYPE::EntityType m_EntityType
Definition: Appearance_PDU.h:89
KDIS::DATA_TYPE::EntityAppearance m_EMApp
Definition: Appearance_PDU.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
KDIS::DATA_TYPE::EntityMarking m_EntityMarking
Definition: Appearance_PDU.h:93
Definition: EntityAppearance.h:58
Definition: Appearance_PDU.h:55
bool KBOOL
Definition: KDefines.h:119
KDIS::DATA_TYPE::EntityAppearance m_VisApp
Definition: Appearance_PDU.h:97
std::string KString
Definition: KDefines.h:116
KUINT8 m_ui8Flag
Definition: Appearance_PDU.h:72
ForceID
Definition: EnumEntityInfoInteraction.h:886
Definition: Header7.h:142
Definition: LE_Header.h:49
unsigned char KUINT8
Definition: KDefines.h:99
Definition: EntityMarking.h:48
#define KDIS_EXPORT
Definition: KDefines.h:82
KDIS::DATA_TYPE::EntityAppearance m_IRApp
Definition: Appearance_PDU.h:99
Definition: LE_EntityIdentifier.h:48