KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EntityAppearance.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: EntityAppearance
32  created: 22/09/2008 - Updated July 2012
33  author: Karl Jones
34 
35  purpose: Represents an entity appearance using bit fields.
36  This class has had a significant upgrade, I have removed general
37  and specific appearance types. Each type now has a single appearance type.
38  size: 32 Bits / 4 Octet
39 *********************************************************************/
40 
41 #pragma once
42 
49 #include "./LifeFormAppearance.h"
53 #include "./EntityType.h"
54 
55 namespace KDIS {
56 namespace DATA_TYPE {
57 
59 {
60 protected:
61 
62  union
63  {
75  } m_AppearanceUnion;
76 
77 public:
78 
79  static const KUINT16 ENTITY_APPEARANCE_SIZE = 4;
80 
82 
83  EntityAppearance( KDataStream & stream ) throw( KException );
84 
86 
88 
90 
92 
94 
96 
98 
100 
102 
104 
105  virtual ~EntityAppearance();
106 
107  //************************************
108  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetData
109  // KDIS::DATA_TYPE::EntityAppearance::GetData
110  //!Description: This is the raw appearance field. Each bit is interpreted differently depending
111  //! on the appearance type.
112  //! You will likely never need to touch this value unless something is missing from
113  //! one of my appearance types or you are using a field in a none standard way.
114  // Parameter: KUINT32 D
115  //************************************
116  void SetData( KUINT32 D );
117  KUINT32 GetData() const;
118 
119  //************************************
120  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
121  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceAsLandPlatform
122  //!Description: Get/Set the appearance data as a land platform.
123  // Parameter: const LandPlatformAppearance & A
124  //************************************
125  void SetAppearance( const LandPlatformAppearance & A );
126  const LandPlatformAppearance & GetAppearanceAsLandPlatform() const;
127  LandPlatformAppearance & GetAppearanceAsLandPlatform();
128 
129  //************************************
130  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
131  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceAsAirPlatform
132  //!Description: Get/Set the appearance data as a air platform.
133  // Parameter: const AirPlatformAppearance & A
134  //************************************
135  void SetAppearance( const AirPlatformAppearance & A );
136  const AirPlatformAppearance & GetAppearanceAsAirPlatform() const;
137  AirPlatformAppearance & GetAppearanceAsAirPlatform();
138 
139  //************************************
140  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
141  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceAsSurfacePlatform
142  //!Description: Get/Set the appearance data as a surface platform.
143  // Parameter: const SurfacePlatformAppearance & A
144  //************************************
145  void SetAppearance( const SurfacePlatformAppearance & A );
146  const SurfacePlatformAppearance & GetAppearanceAsSurfacePlatform() const;
147  SurfacePlatformAppearance & GetAppearanceAsSurfacePlatform();
148 
149  //************************************
150  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
151  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceAsSubsurfacePlatform
152  //!Description: Get/Set the appearance data as subsurface platform.
153  // Parameter: const SubSurfacePlatformAppearance & A
154  //************************************
155  void SetAppearance( const SubSurfacePlatformAppearance & A );
156  const SubSurfacePlatformAppearance & GetAppearanceAsSubsurfacePlatform() const;
157  SubSurfacePlatformAppearance & GetAppearanceAsSubsurfacePlatform();
158 
159  //************************************
160  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
161  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceAsSpacePlatform
162  //!Description: Get/Set the appearance data as space platform.
163  // Parameter: const SpacePlatformAppearance & A
164  //************************************
165  void SetAppearance( const SpacePlatformAppearance & A );
166  const SpacePlatformAppearance & GetAppearanceAsSpacePlatform() const;
167  SpacePlatformAppearance & GetAppearanceAsSpacePlatform();
168 
169  //************************************
170  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
171  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceAsGuidedMuntions
172  //!Description: Get/Set the appearance data as guided muntions.
173  // Parameter: const GuidedMunitionsAppearance & A
174  //************************************
175  void SetAppearance( const GuidedMunitionsAppearance & A );
176  const GuidedMunitionsAppearance & GetAppearanceAsGuidedMuntions() const;
177  GuidedMunitionsAppearance & GetAppearanceAsGuidedMuntions();
178 
179  //************************************
180  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
181  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceAsLifeForm
182  //!Description: Get/Set the appearance data as life form.
183  // Parameter: const LifeFormAppearance & A
184  //************************************
185  void SetAppearance( const LifeFormAppearance & A );
186  const LifeFormAppearance & GetAppearanceAsLifeForm() const;
187  LifeFormAppearance & GetAppearanceAsLifeForm();
188 
189  //************************************
190  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
191  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceEnvironmentals
192  //!Description: Get/Set the appearance data as environmentals.
193  // Parameter: const EnvironmentalsAppearance & A
194  //************************************
195  void SetAppearance( const EnvironmentalsAppearance & A );
196  const EnvironmentalsAppearance & GetAppearanceEnvironmentals() const;
197  EnvironmentalsAppearance & GetAppearanceEnvironmentals();
198 
199  //************************************
200  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
201  // KDIS::DATA_TYPE::EntityAppearance::GetAppearanceCultural
202  //!Description: Get/Set the appearance data as cultural feature.
203  // Parameter: const CulturalFeatureAppearance & A
204  //************************************
205  void SetAppearance( const CulturalFeatureAppearance & A );
206  const CulturalFeatureAppearance & GetAppearanceCultural() const;
207  CulturalFeatureAppearance & GetAppearanceCultural();
208 
209  //************************************
210  // FullName: KDIS::DATA_TYPE::EntityAppearance::SetAppearance
211  // KDIS::DATA_TYPE::EntityAppearance::GetSensorEmitter
212  //!Description: Get/Set the appearance data as a Sensor/Emitter.
213  // Parameter: const SensorEmitterAppearance & A
214  //************************************
215  void SetAppearance( const SensorEmitterAppearance & A );
216  const SensorEmitterAppearance & GetSensorEmitter() const;
217  SensorEmitterAppearance & GetSensorEmitter();
218 
219  //************************************
220  // FullName: KDIS::DATA_TYPE::EntityAppearance::GetAsString
221  //!Description: Returns a string representation of the appearance.
222  //! This verson just returns the data as an integer.
223  // Parameter: const EntityType & EntType
224  //************************************
225  virtual KString GetAsString() const;
226 
227  //************************************
228  // FullName: KDIS::DATA_TYPE::EntityAppearance::GetAsString
229  //!Description: Returns a string representation of the appearance based on type.
230  // Parameter: const EntityType & EntType
231  //************************************
232  KString GetAsString( const EntityType & EntType ) const;
233 
234  //************************************
235  // FullName: KDIS::DATA_TYPE::EntityAppearance::Decode
236  //!Description: Convert From Network Data.
237  // Parameter: KDataStream & stream
238  //************************************
239  virtual void Decode( KDataStream & stream ) throw( KException );
240 
241  //************************************
242  // FullName: KDIS::DATA_TYPE::EntityAppearance::Encode
243  //!Description: Convert To Network Data.
244  // Parameter: KDataStream & stream
245  //************************************
246  virtual KDataStream Encode() const;
247  virtual void Encode( KDataStream & stream ) const;
248 
249  KBOOL operator == ( const EntityAppearance & Value ) const;
250  KBOOL operator != ( const EntityAppearance & Value ) const;
251 };
252 
253 } // END namespace DATA_TYPES
254 } // END namespace KDIS
KUINT32 m_ui326Data
Definition: EntityAppearance.h:74
unsigned int KUINT32
Definition: KDefines.h:103
Definition: EntityType.h:46
Definition: CulturalFeatureAppearance.h:53
GuidedMunitionsAppearance m_GuidedMunitionsApp
Definition: EntityAppearance.h:69
Definition: EnvironmentalsAppearance.h:53
AirPlatformAppearance m_AirApp
Definition: EntityAppearance.h:65
unsigned short int KUINT16
Definition: KDefines.h:101
EnvironmentalsAppearance m_EnviroApp
Definition: EntityAppearance.h:71
SubSurfacePlatformAppearance m_SubSurfaceApp
Definition: EntityAppearance.h:67
Definition: SurfacePlatformAppearance.h:53
Definition: LandPlatformAppearance.h:53
Definition: SensorEmitterAppearance.h:53
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
Definition: EntityAppearance.h:58
bool KBOOL
Definition: KDefines.h:119
Definition: AirPlatformAppearance.h:53
Definition: SpacePlatformAppearance.h:53
std::string KString
Definition: KDefines.h:116
CulturalFeatureAppearance m_CultFeatApp
Definition: EntityAppearance.h:72
Definition: SubSurfacePlatformAppearance.h:53
SensorEmitterAppearance m_SensEmitApp
Definition: EntityAppearance.h:73
SpacePlatformAppearance m_SpaceApp
Definition: EntityAppearance.h:68
SurfacePlatformAppearance m_SurfaceApp
Definition: EntityAppearance.h:66
#define KDIS_EXPORT
Definition: KDefines.h:82
LifeFormAppearance m_LifeFormApp
Definition: EntityAppearance.h:70
Definition: GuidedMunitionsAppearance.h:53
LandPlatformAppearance m_LandApp
Definition: EntityAppearance.h:64
Definition: LifeFormAppearance.h:53